tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cp/mv and extended attributes preservation

On Wed, Jul 27, 2011 at 10:09:50AM +1000, Simon Burge wrote:
> If you do this, can a single copy of copy_file_xattr() be used, and
> referenced from the other program?

I would be nice to have it in libc for everybody use. We could hvbe:
int extattr_copy_file(int namespace, const char *from, const char *to);,
int extattr_copy_link(int namespace, const char *from, const char *to);
int extattr_copy_fd(int namespace, int from_fd, int to_fd);

OTOH, the FreeBSD derived API is ugly enough, we can decide to 
depreciate it and go with the Linux style API, with something like:
int cpxattr(const char *from, const char *to);
int lcpxattr(const char *from, const char *to);
int fcpxattr(int from_fd, int to_fd);

The latter would copy all known namespaces. But perhaps you were just
suggesting that the function should move to a standalone src/bin/mv/utils.c 
and have src/bin/cp/utils.c doing @ #include "../mv/utils.c" ?

Emmanuel Dreyfus

Home | Main Index | Thread Index | Old Index