extattr.9 (167010) | extattr.9 (167259) |
---|---|
1.\"- 2.\" Copyright (c) 1999, 2000, 2001, 2003 Robert N. M. Watson 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\" | 1.\"- 2.\" Copyright (c) 1999, 2000, 2001, 2003 Robert N. M. Watson 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\" |
26.\" $FreeBSD: head/share/man/man9/extattr.9 167010 2007-02-26 06:18:53Z mckusick $ | 26.\" $FreeBSD: head/share/man/man9/extattr.9 167259 2007-03-06 08:13:21Z mckusick $ |
27.\" 28.Dd December 23, 1999 29.Os 30.Dt EXTATTR 9 31.Sh NAME 32.Nm extattr 33.Nd virtual file system named extended attributes 34.Sh SYNOPSIS --- 38 unchanged lines hidden (view full) --- 73Extended attributes are named using a null-terminated character string. 74Depending on underlying file system semantics, this name may or may not be 75case-sensitive. 76Appropriate vnode extended attribute calls are: 77.Xr VOP_GETEXTATTR 9 , 78.Xr VOP_LISTEXTATTR 9 , 79and 80.Xr VOP_SETEXTATTR 9 . | 27.\" 28.Dd December 23, 1999 29.Os 30.Dt EXTATTR 9 31.Sh NAME 32.Nm extattr 33.Nd virtual file system named extended attributes 34.Sh SYNOPSIS --- 38 unchanged lines hidden (view full) --- 73Extended attributes are named using a null-terminated character string. 74Depending on underlying file system semantics, this name may or may not be 75case-sensitive. 76Appropriate vnode extended attribute calls are: 77.Xr VOP_GETEXTATTR 9 , 78.Xr VOP_LISTEXTATTR 9 , 79and 80.Xr VOP_SETEXTATTR 9 . |
81.Pp 82The format of an external attribute is defined by the extattr structure: 83.Bd -literal 84struct extattr { 85 int32_t ea_length; /* length of this attribute */ 86 int8_t ea_namespace; /* name space of this attribute */ 87 int8_t ea_contentpadlen; /* padding at end of attribute */ 88 int8_t ea_namelength; /* length of attribute name */ 89 char ea_name[1]; /* null-terminated attribute name */ 90 /* extended attribute content follows */ 91}; 92.Ed 93.Pp 94Several macros are defined to manipulate these structures. 95Each macro takes a pointer to an extattr structure. 96.Bl -tag -width ".Dv EXTATTR_SET_LENGTHS(eap, size)" 97.It Dv EXTATTR_NEXT(eap) 98Returns a pointer to the next extended attribute following 99.Fa eap . 100.It Dv EXTATTR_CONTENT(eap) 101Returns a pointer to the extended attribute content referenced by 102.Fa eap . 103.It Dv EXTATTR_CONTENT_SIZE(eap) 104Returns the size of the extended attribute content referenced by 105.Fa eap . 106.It Dv EXTATTR_SET_LENGTHS(eap, size) 107Called with the size of the attribute content after initializing 108the attribute name to calculate and set the 109.Fa ea_length , 110.Fa ea_namelength , 111and 112.Fa ea_contentpadlen 113fields of the extended attribute structure. 114.El 115.Pp 116The following code identifies an ACL: 117.Bd -literal 118 if (eap->ea_namespace == EXTATTR_NAMESPACE_SYSTEM && 119 !strcmp(eap->ea_name, POSIX1E_ACL_ACCESS_EXTATTR_NAME) { 120 aclp = EXTATTR_CONTENT(eap); 121 acllen = EXTATTR_CONTENT_SIZE(eap); 122 ... 123 } 124.Ed 125.Pp 126The following code creates an extended attribute 127containing a copy of a structure 128.Fa mygif : 129.Bd -literal 130 eap->ea_namespace = EXTATTR_NAMESPACE_USER; 131 strcpy(eap->ea_name, "filepic.gif"); 132 EXTATTR_SET_LENGTHS(eap, sizeof(struct mygif)); 133 memcpy(EXTATTR_CONTENT(eap), &mygif, sizeof(struct mygif)); 134.Ed 135.Pp | |
136.Sh SEE ALSO 137.Xr VFS 9 , 138.Xr VFS_EXTATTRCTL 9 , 139.Xr VOP_GETEXTATTR 9 , 140.Xr VOP_LISTEXTATTR 9 , 141.Xr VOP_SETEXTATTR 9 142.Sh AUTHORS 143This manual page was written by 144.An Robert Watson . 145.Sh BUGS 146In addition, the interface does not provide a mechanism to retrieve 147the current set of available attributes; it has been suggested that 148providing a 149.Dv NULL 150attribute name should cause a list of defined attributes for the passed file 151or directory, but this is not currently implemented. | 81.Sh SEE ALSO 82.Xr VFS 9 , 83.Xr VFS_EXTATTRCTL 9 , 84.Xr VOP_GETEXTATTR 9 , 85.Xr VOP_LISTEXTATTR 9 , 86.Xr VOP_SETEXTATTR 9 87.Sh AUTHORS 88This manual page was written by 89.An Robert Watson . 90.Sh BUGS 91In addition, the interface does not provide a mechanism to retrieve 92the current set of available attributes; it has been suggested that 93providing a 94.Dv NULL 95attribute name should cause a list of defined attributes for the passed file 96or directory, but this is not currently implemented. |