diff options
author | Nathan Scott <nathans@sgi.com> | 2001-04-25 05:09:42 +0000 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2001-04-25 05:09:42 +0000 |
commit | a276dd51c33073e08ecf646fe0f4834382c2c5d2 (patch) | |
tree | 4571eac5e809dd297b3f47dca70763acd374822d | |
parent | d07643493924977a570e23d0b9a6e6322e73c3d4 (diff) | |
download | attr-a276dd51c33073e08ecf646fe0f4834382c2c5d2.tar.gz |
bump the revision number.
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | build/rpm/attr.spec.in | 15 | ||||
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | debian/control | 22 | ||||
-rw-r--r-- | doc/CHANGES | 6 | ||||
-rw-r--r-- | include/Makefile | 2 | ||||
-rw-r--r-- | include/attr_kern.h | 65 | ||||
-rw-r--r-- | include/attributes.h | 129 | ||||
-rw-r--r-- | libattr/attr.c | 22 | ||||
-rw-r--r-- | man/man1/attr.1 | 9 |
10 files changed, 160 insertions, 116 deletions
@@ -3,5 +3,5 @@ # PKG_MAJOR=1 PKG_MINOR=0 -PKG_REVISION=1 +PKG_REVISION=2 PKG_BUILD=0 diff --git a/build/rpm/attr.spec.in b/build/rpm/attr.spec.in index 54dfdb7..c9d4990 100644 --- a/build/rpm/attr.spec.in +++ b/build/rpm/attr.spec.in @@ -13,8 +13,8 @@ URL: http://oss.sgi.com/projects/xfs/ Group: System Environment/Base %description -An *experimental* command (attr) to manipulate extended attributes -under Linux. +A utility for manipulating extended attributes on filesystem +objects, compatible with the SGI IRIX tool of the same name. %package devel Summary: Extended attribute static libraries and headers. @@ -23,9 +23,14 @@ Requires: @pkg_name@ %description devel attr-devel contains the libraries and header files needed to -develop programs which make use of extended attributes. -This is an *experimental* interface, currently only XFS is -supported, and the interface may change. +develop programs which make use of extended attributes. This +interface is compatible with the SGI IRIX extended attribute +interface, and makes use of an unofficial Linux system call. + +Currently only XFS is supported, and the (experimental, unofficial) +system call interface is likely to change in the future. However, +the API built above this system call is unlikely to change and is +used by programs such as xfsdump(8), xfsrestore(8) and xfs_fsr(8). You should install attr-devel if you want to develop programs which make use of extended attributes. If you install attr-devel, diff --git a/debian/changelog b/debian/changelog index 0508f35..8dab674 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -attr (1.0.0) unstable; urgency=low +attr (1.0.2) unstable; urgency=low * Initial release. - -- Nathan Scott <nathans@debian.org> Thu, 4 Jan 2001 11:15:11 -0500 + -- Nathan Scott <nathans@debian.org> Wed, 25 Apr 2001 12:19:15 +1000 Local variables: mode: debian-changelog diff --git a/debian/control b/debian/control index e2961f2..7315eaf 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,5 @@ Source: attr -Section: admin +Section: utils Priority: optional Maintainer: Nathan Scott <nathans@debian.org> Build-Depends: autoconf, debmake @@ -8,9 +8,9 @@ Standards-Version: 3.1.1 Package: attr Depends: ${shlibs:Depends} Architecture: any -Description: Experimental utility for manipulating extended attributes - An *experimental* command to manipulate filesystem extended - attributes. Currently, only the XFS filesystem is supported. +Description: Utility for manipulating filesystem extended attributes + A utility for manipulating extended attributes on filesystem + objects, compatible with the SGI IRIX tool of the same name. Package: attr-dev Section: devel @@ -18,7 +18,13 @@ Priority: extra Depends: libc6-dev, attr Architecture: any Description: Extended attribute static libraries and headers. - attr-dev contains the libraries and header files needed to - develop programs which make use of extended attributes. - This is an *experimental* interface, currently only XFS is - supported, and the interface is likely to change. + attr-dev contains the libraries and header files needed to develop + programs which make use of extended attributes. + . + This interface is compatible with the SGI IRIX extended attribute + interface, and makes use of an unofficial Linux system call. + . + Currently only XFS is supported, and the (experimental, unofficial) + system call interface is likely to change in the future. However, + the API built above this system call is unlikely to change and is + used by programs such as xfsdump(8), xfsrestore(8) and xfs_fsr(8). diff --git a/doc/CHANGES b/doc/CHANGES index 47c7f38..d39b666 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,6 +1,10 @@ +attr-1.0.2 (24 April 2001) + - rearrange headers to make system call internals private + - update package descriptions + attr-1.0.1 (30 January 2001) - - minor rpm and deb packaging work + - minor rpm and deb packaging work attr-1.0.0 (15 January 2001) - extended attribute code abstracted from xfs-cmds package diff --git a/include/Makefile b/include/Makefile index 53f77db..677e83e 100644 --- a/include/Makefile +++ b/include/Makefile @@ -34,7 +34,7 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs HFILES = attributes.h -LSRCFILES = builddefs.in buildrules +LSRCFILES = builddefs.in buildrules attr_kern.h default install : diff --git a/include/attr_kern.h b/include/attr_kern.h new file mode 100644 index 0000000..3be50b9 --- /dev/null +++ b/include/attr_kern.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ + */ +#ifndef __ATTR_KERN_H__ +#define __ATTR_KERN_H__ + +/* + * The (experimental) Linux generic attribute syscall - attrctl(2) + */ + +typedef union attr_obj { + char *path; + int fd; + pid_t pid; +} attr_obj_t; + +/* + * attr_obj_t type identifiers + */ +#define ATTR_TYPE_FD 1 /* file descriptor */ +#define ATTR_TYPE_PATH 2 /* path - follow symlinks */ +#define ATTR_TYPE_LPATH 3 /* path - don't follow symlinks */ +#define ATTR_TYPE_PID 4 /* process id */ + +/* + * Kernel-internal version of the attrlist cursor. + */ +typedef struct attrlist_cursor_kern { + __u32 hashval; /* hash value of next entry to add */ + __u32 blkno; /* block containing entry (suggestion)*/ + __u32 offset; /* offset in list of equal-hashvals */ + __u16 pad1; /* padding to match user-level */ + __u8 pad2; /* padding to match user-level */ + __u8 initted; /* T/F: cursor has been initialized */ +} attrlist_cursor_kern_t; + +#endif /* __ATTR_KERN_H__ */ diff --git a/include/attributes.h b/include/attributes.h index bb94692..56acf36 100644 --- a/include/attributes.h +++ b/include/attributes.h @@ -37,15 +37,36 @@ extern "C" { #endif /* - * The (experimental) Linux generic attribute syscall - attrctl(2) + * An IRIX-compatible extended attributes API */ -typedef union attr_obj { - char *path; - int fd; - pid_t pid; -} attr_obj_t; +/* + * Valid command flags, may be used with all API calls. + * Multiple flags should be bitwise OR'ed together. + */ +#define ATTR_ROOT 0x0001 /* use attrs in root namespace, not user */ +#define ATTR_CREATE 0x0002 /* pure create: fail if attr already exists */ +#define ATTR_REPLACE 0x0004 /* pure set: fail if attr does not exist */ +#define ATTR_SHIFT 16 /* for supporting extensions */ + +/* + * Additional API specific opcodes & flags + */ +#define ATTR_DONTFOLLOW (0x0001 << ATTR_SHIFT) /* do not follow symlinks */ +#define ATTR_TRUST (0x0002 << ATTR_SHIFT) + /* tell server we are trusted to properly handle extended attributes */ + +#define ATTR_KERNOTIME (0x0004 << ATTR_SHIFT) + /* don't update inode timestamps. + * The DMI needs a way to update attributes without affecting the + * inode timestamps. Note that this flag is not set-able from user + * mode - it is kernel internal only, but it must not conflict with + * the user flags either. + */ +/* + * Generic extended attribute operation structure + */ typedef struct attr_op { int opcode; /* which operation to perform */ int error; /* result (an errno) of this operation [out] */ @@ -56,49 +77,16 @@ typedef struct attr_op { void *aux; /* optional cmd specific data */ } attr_op_t; -extern int attrctl (attr_obj_t __obj, int __type, attr_op_t *__ops, int __count); - -/* - * attr_obj_t type identifiers - */ -#define ATTR_TYPE_FD 1 /* file descriptor */ -#define ATTR_TYPE_PATH 2 /* path - follow symlinks */ -#define ATTR_TYPE_LPATH 3 /* path - don't follow symlinks */ -#define ATTR_TYPE_PID 4 /* process id */ - /* - * attrctl(2) commands + * Valid attr_op, attr_multi_op opcodes */ #define ATTR_OP_GET 1 /* return the indicated attr's value */ #define ATTR_OP_SET 2 /* set/create the indicated attr/value pair */ #define ATTR_OP_REMOVE 3 /* remove the indicated attr */ #define ATTR_OP_LIST 4 /* list attributes associated with a file */ -#define ATTR_OP_EXT 32 /* for supporting extensions */ - -/* - * Valid command flags, may be used with all attrctl(2) commands. - * Flags should be bitwise OR'ed together. - */ -#define ATTR_ROOT 0x0001 /* use attrs in root namespace, not user */ -#define ATTR_CREATE 0x0002 /* pure create: fail if attr already exists */ -#define ATTR_REPLACE 0x0004 /* pure set: fail if attr does not exist */ -#define ATTR_SHIFT 16 /* for supporting extensions */ -/* - * Additional API specific opcodes & flags - */ -#define ATTR_OP_IRIX_LIST (ATTR_OP_EXT + 0) /* IRIX: for supporting */ - /* attr_list(f) API semantics */ -#define ATTR_DONTFOLLOW (0x0001 << ATTR_SHIFT) /* IRIX: do not follow symlinks */ -#define ATTR_TRUST (0x0002 << ATTR_SHIFT) /* IRIX: tell server we can be */ - /* trusted to properly handle */ - /* extended attributes */ - -/* - * - * The IRIX extended attributes API, fully implemented by XFS - * - */ +#define ATTR_OP_EXT 32 /* for supporting extensions */ +#define ATTR_OP_IRIX_LIST (ATTR_OP_EXT + 0) /* IRIX attr_list semantics */ /* * The maximum size (into the kernel or returned from the kernel) of an @@ -109,23 +97,23 @@ extern int attrctl (attr_obj_t __obj, int __type, attr_op_t *__ops, int __count) /* * Define how lists of attribute names are returned to the user from - * the attr_list() syscall. A large, 32bit aligned, buffer is passed in + * the attr_list() call. A large, 32bit aligned, buffer is passed in * along with its size. We put an array of offsets at the top that each * reference an attrlist_ent_t and pack the attrlist_ent_t's at the bottom. */ typedef struct attrlist { - __s32 al_count; /* number of entries in attrlist */ - __s32 al_more; /* T/F: more attrs (do syscall again) */ - __s32 al_offset[1]; /* byte offsets of attrs [var-sized] */ + __s32 al_count; /* number of entries in attrlist */ + __s32 al_more; /* T/F: more attrs (do call again) */ + __s32 al_offset[1]; /* byte offsets of attrs [var-sized] */ } attrlist_t; /* * Show the interesting info about one attribute. This is what the * al_offset[i] entry points to. */ -typedef struct attrlist_ent { /* data from attr_list() */ - __u32 a_valuelen; /* number bytes in value of attr */ - char a_name[1]; /* attr name (NULL terminated) */ +typedef struct attrlist_ent { /* data from attr_list() */ + __u32 a_valuelen; /* number bytes in value of attr */ + char a_name[1]; /* attr name (NULL terminated) */ } attrlist_ent_t; /* @@ -138,27 +126,27 @@ typedef struct attrlist_ent { /* data from attr_list() */ /* - * Implement a "cursor" for use in successive attr_list() system calls. + * Implement a "cursor" for use in successive attr_list() calls. * It provides a way to find the last attribute that was returned in the - * last attr_list() syscall so that we can get the next one without missing + * last attr_list() call so that we can get the next one without missing * any. This should be bzero()ed before use and whenever it is desired to * start over from the beginning of the attribute list. The only valid * operation on a cursor is to bzero() it. */ typedef struct attrlist_cursor { - __u32 opaque[4]; /* an opaque cookie */ + __u32 opaque[4]; /* an opaque cookie */ } attrlist_cursor_t; /* * Multi-attribute operation vector. */ typedef struct attr_multiop { - int am_opcode; /* which operation to perform (ATTR_OP_GET etc.)*/ + int am_opcode; /* operation to perform (ATTR_OP_GET, etc.) */ int am_error; /* [out arg] result of this sub-op (an errno) */ char *am_attrname; /* attribute name to work with */ char *am_attrvalue; /* [in/out arg] attribute value (raw bytes) */ int am_length; /* [in/out arg] length of value */ - int am_flags; /* bitwise OR of attrctl(2) flags defined above */ + int am_flags; /* bitwise OR of attr API flags defined above */ } attr_multiop_t; #define ATTR_MAX_MULTIOPS 128 /* max number ops in an oplist array */ @@ -168,10 +156,10 @@ typedef struct attr_multiop { * be set to the actual number of bytes used in the value buffer upon return. * The return value is -1 on error (w/errno set appropriately), 0 on success. */ -extern int attr_get (const char *path, const char *attrname, char *attrvalue, - int *valuelength, int flags); -extern int attr_getf (int fd, const char *attrname, char *attrvalue, - int *valuelength, int flags); +extern int attr_get (const char *__path, const char *__attrname, + char *__attrvalue, int *__valuelength, int __flags); +extern int attr_getf (int __fd, const char *__attrname, char *__attrvalue, + int *__valuelength, int __flags); /* * Set the value of an attribute, creating the attribute if necessary. @@ -227,31 +215,6 @@ extern int attr_multi (const char *__path, attr_multiop_t *__oplist, extern int attr_multif (int __fd, attr_multiop_t *__oplist, int __count, int __flags); -#ifdef __KERNEL__ - -/* - * The DMI needs a way to update attributes without affecting the inode - * timestamps. Note that this flag is not settable from user mode, it is - * kernel internal only, but it must not conflict with the above flags either. - */ -#define ATTR_KERNOTIME (0x0004 << ATTR_SHIFT) /* IRIX: don't update the inode */ - /* timestamps */ - -/* - * Kernel-internal version of the attrlist cursor. - */ -typedef struct attrlist_cursor_kern { - __u32 hashval; /* hash value of next entry to add */ - __u32 blkno; /* block containing entry (suggestion)*/ - __u32 offset; /* offset in list of equal-hashvals */ - __u16 pad1; /* padding to match user-level */ - __u8 pad2; /* padding to match user-level */ - __u8 initted; /* T/F: cursor has been initialized */ -} attrlist_cursor_kern_t; - -#endif /* __KERNEL__ */ - - #ifdef __cplusplus } #endif diff --git a/libattr/attr.c b/libattr/attr.c index 4d0a7cb..907290a 100644 --- a/libattr/attr.c +++ b/libattr/attr.c @@ -30,19 +30,21 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <stdio.h> #include <errno.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #include <sys/types.h> #include <asm/types.h> -#include <unistd.h> + #include <attributes.h> +#include <attr_kern.h> -/* - * Function prototypes - */ +/* Experimental system call interface for Linux */ +static int attrctl(attr_obj_t, int, attr_op_t *, int); + +/* Other local function prototypes */ static int _attr_get(attr_obj_t, int, const char *, char *, int *, int); static int _attr_set(attr_obj_t, int, const char *, const char *, const int, int); static int _attr_remove(attr_obj_t, int, const char *, int); @@ -50,6 +52,7 @@ static int _attr_listf(attr_obj_t, int, char *, const int, int, attrlist_cursor_t *); static int _attr_multif(attr_obj_t, int, attr_multiop_t *, int, int); + /* * Get the value of an attribute. */ @@ -287,7 +290,7 @@ _attr_multif(attr_obj_t obj, int type, attr_multiop_t *multiops, int count, /* - * attrctl(2) system call function definition. + * attrctl(2) experimental system call function definition. */ #if __i386__ @@ -304,14 +307,13 @@ _attr_multif(attr_obj_t obj, int type, attr_multiop_t *multiops, int count, # define HAVE_ACL_SYSCALL 0 #endif -int +static int attrctl(attr_obj_t obj, int type, attr_op_t *ops, int count) { #if HAVE_ACL_SYSCALL return syscall(SYS__attrctl, * (long *) &obj, type, ops, count); #else - fprintf(stderr, "libattr: attrctl system call not defined " - "for this architecture\n"); - return 0; + errno = ENOSYS; + return -1; #endif } diff --git a/man/man1/attr.1 b/man/man1/attr.1 index 7d0302e..bf6cbbe 100644 --- a/man/man1/attr.1 +++ b/man/man1/attr.1 @@ -16,7 +16,6 @@ attr \- manipulate Extended Attributes on filesystem objects .SH OVERVIEW Extended Attributes implement the ability for a user to attach name/value pairs to objects within the filesystem. -They are currently only supported in XFS filesystems. .P They could be used to store meta-information about the file. For example "character-set=kanji" could tell a document browser to @@ -56,8 +55,6 @@ The address space is protected by the normal file permissions mechanism, so the owner of the file can decide who is able to see and/or modify the value of attributes on any particular file. -.P -Attributes are currently supported only in the XFS filesystem type. .SH DESCRIPTION The .I attr @@ -149,9 +146,8 @@ but will not print status messages (to \f4stdout\fP). .SH "NOTES" The standard file interchange/archive programs .IR tar (1), -.IR cpio (1), and -.IR bru (1) +.IR cpio (1) will not archive or restore Extended Attributes, while the .IR xfsdump (8) @@ -163,3 +159,6 @@ attr_multi(2), attr_multif(2), attr_remove(2), attr_removef(2), attr_set(2), attr_setf(2), xfsdump(8). +.SH BUGS +The extended attributes system call used by this program is +experimental and is currently only supported by the XFS filesystem. |