aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/extattr.h
Commit message (Collapse)AuthorAgeFilesLines
* sys/sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326256
* restore(8): Handle extended attribute names correctlyConrad Meyer2017-01-181-1/+2
| | | | | | | | | | | | | | | | | UFS2 extended attribute names are not NUL-terminated. Handle appropriately. Correct the EXTATTR_BASE_LENGTH() macro, which handled ea_namelength == one (mod eight) extended attributes incorrectly. PR: 216127 Reported by: dewayne at heuristicsystems.com.au Reviewed by: kib@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D9208 Notes: svn path=/head/; revision=312393
* Fix return type of extattr_set_* and fix rmextattr(8) utility.Matthew D Fleming2013-04-021-3/+3
| | | | | | | | | | | | extattr_set_{fd,file,link} is logically a write(2)-like operation and should return ssize_t, just like extattr_get_*. Also, the user-space utility was using an int for the return value of extattr_get_* and extattr_list_*, both of which return an ssize_t. MFC after: 1 week Notes: svn path=/head/; revision=248995
* Introduce accmode_t. This is required for NFSv4 ACLs - it will be neccessaryEdward Tomasz Napierala2008-10-281-1/+2
| | | | | | | | | | to add more V* constants, and the variables changed by this patch were often being assigned to mode_t variables, which is 16 bit. Approved by: rwatson (mentor) Notes: svn path=/head/; revision=184413
* Revert/re-make previous commit in a manner that maintains hyphenation ofRobert Watson2007-03-161-3/+4
| | | | | | | | | | extended attributes. I'm not sure I like it, but it is grammatically more correct. Requested by: mckusick Notes: svn path=/head/; revision=167650
* Minor white space tweaks in comments.Robert Watson2007-03-161-3/+3
| | | | Notes: svn path=/head/; revision=167635
* Move macros describing extended attributes in UFS fromKirk McKusick2007-03-061-47/+0
| | | | | | | | | | | | | | <sys/extattr.h> to <ufs/ufs/extattr.h>. Move description of extended attributes in UFS from man9/extattr.9 to man5/fs.5. Note that restore will not compile until <sys/extattr.h> and <ufs/ufs/extattr.h> have been updated. Suggested by: Robert Watson Notes: svn path=/head/; revision=167259
* KASSERT fails when the condition is false, not when it is true.Kirk McKusick2007-02-271-1/+1
| | | | Notes: svn path=/head/; revision=167057
* Declare a `struct extattr' that defines the format of an extendedKirk McKusick2007-02-261-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | attribute. Also define some macros to manipulate one of these structures. Explain their use in the extattr.9 manual page. The next step will be to make a sweep through the kernel replacing the old pointer manipulation code. To get an idea of how they would be used, the ffs_findextattr() function in ufs/ffs/ffs_vnops.c is currently written as follows: /* * Vnode operating to retrieve a named extended attribute. * * Locate a particular EA (nspace:name) in the area (ptr:length), and return * the length of the EA, and possibly the pointer to the entry and to the data. */ static int ffs_findextattr(u_char *ptr, u_int length, int nspace, const char *name, u_char **eap, u_char **eac) { u_char *p, *pe, *pn, *p0; int eapad1, eapad2, ealength, ealen, nlen; uint32_t ul; pe = ptr + length; nlen = strlen(name); for (p = ptr; p < pe; p = pn) { p0 = p; bcopy(p, &ul, sizeof(ul)); pn = p + ul; /* make sure this entry is complete */ if (pn > pe) break; p += sizeof(uint32_t); if (*p != nspace) continue; p++; eapad2 = *p++; if (*p != nlen) continue; p++; if (bcmp(p, name, nlen)) continue; ealength = sizeof(uint32_t) + 3 + nlen; eapad1 = 8 - (ealength % 8); if (eapad1 == 8) eapad1 = 0; ealength += eapad1; ealen = ul - ealength - eapad2; p += nlen + eapad1; if (eap != NULL) *eap = p0; if (eac != NULL) *eac = p; return (ealen); } return(-1); } After applying the structure and macros, it would look like this: /* * Vnode operating to retrieve a named extended attribute. * * Locate a particular EA (nspace:name) in the area (ptr:length), and return * the length of the EA, and possibly the pointer to the entry and to the data. */ static int ffs_findextattr(u_char *ptr, u_int length, int nspace, const char *name, u_char **eapp, u_char **eac) { struct extattr *eap, *eaend; eaend = (struct extattr *)(ptr + length); for (eap = (struct extattr *)ptr; eap < eaend; eap = EXTATTR_NEXT(eap)){ /* make sure this entry is complete */ if (EXTATTR_NEXT(eap) > eaend) break; if (eap->ea_namespace != nspace || eap->ea_namelength != length || bcmp(eap->ea_name, name, length)) continue; if (eapp != NULL) *eapp = eap; if (eac != NULL) *eac = EXTATTR_CONTENT(eap); return (EXTATTR_CONTENT_SIZE(eap)); } return(-1); } Not only is it considerably shorter, but it hopefully more readable :-) Notes: svn path=/head/; revision=167010
* Comment extended attribute name space constants.Robert Watson2006-07-231-0/+4
| | | | Notes: svn path=/head/; revision=160596
* Userspace prototypes for the extattr_list_*() system calls.Robert Watson2003-06-041-0/+6
| | | | Notes: svn path=/head/; revision=115805
* Prototypes for new link extended attribute calls. Sync to MAC tree.Robert Watson2002-10-091-0/+6
| | | | | | | | Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Notes: svn path=/head/; revision=104733
* Introduce new extattr_check_cred() function which implements the canonicalPoul-Henning Kamp2002-09-051-0/+5
| | | | | | | | | crential washing for extended attributes. Sponsored by: DARPA & NAI Labs. Notes: svn path=/head/; revision=102987
* More s/file system/filesystem/gTom Rhodes2002-05-161-1/+1
| | | | Notes: svn path=/head/; revision=96755
* Part I: Update extended attribute API and ABI:Robert Watson2002-02-101-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Modify the system call syntax for extattr_{get,set}_{fd,file}() so as not to use the scatter gather API (which appeared not to be used by any consumers, and be less portable), rather, accepts 'data' and 'nbytes' in the style of other simple read/write interfaces. This changes the API and ABI. o Modify system call semantics so that extattr_get_{fd,file}() return a size_t. When performing a read, the number of bytes read will be returned, unless the data pointer is NULL, in which case the number of bytes of data are returned. This changes the API only. o Modify the VOP_GETEXTATTR() vnode operation to accept a *size_t argument so as to return the size, if desirable. If set to NULL, the size will not be returned. o Update various filesystems (pseodofs, ufs) to DTRT. These changes should make extended attributes more useful and more portable. More commits to rebuild the system call files, as well as update userland utilities to follow. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=90448
* o Update copyright dates.Robert Watson2001-11-011-12/+5
| | | | | | | | | | o Add reference to TrustedBSD Project in license header. o Update dated comments, including comment in extattr.h claiming that no file systems support extended attributes. o Improve comment consistency. Notes: svn path=/head/; revision=85845
* o Introduce extattr_{delete,get,set}_fd() to allow extended attributeRobert Watson2001-03-311-8/+13
| | | | | | | | | | | | | | | | operations on file descriptors, which complement the existing set of calls, extattr_{delete,get,set}_file() which act on paths. In doing so, restructure the system call implementation such that the two sets of functions share most of the relevant code, rather than duplicating it. This pushes the vnode locking into the shared code, but keeps the copying in of some arguments in the system call code. Allowing access via file descriptors reduces the opportunity for race conditions when managing extended attributes. Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=75038
* o Rename "namespace" argument to "attrnamespace" as namespace is a C++Robert Watson2001-03-191-4/+4
| | | | | | | | | | reserved word. Submitted by: jkh Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=74437
* o Change the API and ABI of the Extended Attribute kernel interfaces toRobert Watson2001-03-151-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce a new argument, "namespace", rather than relying on a first- character namespace indicator. This is in line with more recent thinking on EA interfaces on various mailing lists, including the posix1e, Linux acl-devel, and trustedbsd-discuss forums. Two namespaces are defined by default, EXTATTR_NAMESPACE_SYSTEM and EXTATTR_NAMESPACE_USER, where the primary distinction lies in the access control model: user EAs are accessible based on the normal MAC and DAC file/directory protections, and system attributes are limited to kernel-originated or appropriately privileged userland requests. o These API changes occur at several levels: the namespace argument is introduced in the extattr_{get,set}_file() system call interfaces, at the vnode operation level in the vop_{get,set}extattr() interfaces, and in the UFS extended attribute implementation. Changes are also introduced in the VFS extattrctl() interface (system call, VFS, and UFS implementation), where the arguments are modified to include a namespace field, as well as modified to advoid direct access to userspace variables from below the VFS layer (in the style of recent changes to mount by adrian@FreeBSD.org). This required some cleanup and bug fixing regarding VFS locks and the VFS interface, as a vnode pointer may now be optionally submitted to the VFS_EXTATTRCTL() call. Updated documentation for the VFS interface will be committed shortly. o In the near future, the auto-starting feature will be updated to search two sub-directories to the ".attribute" directory in appropriate file systems: "user" and "system" to locate attributes intended for those namespaces, as the single filename is no longer sufficient to indicate what namespace the attribute is intended for. Until this is committed, all attributes auto-started by UFS will be placed in the EXTATTR_NAMESPACE_SYSTEM namespace. o The default POSIX.1e attribute names for ACLs and Capabilities have been updated to no longer include the '$' in their filename. As such, if you're using these features, you'll need to rename the attribute backing files to the same names without '$' symbols in front. o Note that these changes will require changes in userland, which will be committed shortly. These include modifications to the extended attribute utilities, as well as to libutil for new namespace string conversion routines. Once the matching userland changes are committed, a buildworld is recommended to update all the necessary include files and verify that the kernel and userland environments are in sync. Note: If you do not use extended attributes (most people won't), upgrading is not imperative although since the system call API has changed, the new userland extended attribute code will no longer compile with old include files. o Couple of minor cleanups while I'm there: make more code compilation conditional on FFS_EXTATTR, which should recover a bit of space on kernels running without EA's, as well as update copyright dates. Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=74273
* Fix bde'isms in acl/extattr syscall interface, renaming syscalls toRobert Watson2000-01-191-11/+17
| | | | | | | | | prettier (?) names, adding some const's around here, et al. Reviewed by: bde Notes: svn path=/head/; revision=56272
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"Peter Wemm1999-12-291-2/+2
| | | | | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come. Notes: svn path=/head/; revision=55205
* Second pass commit to introduce new ACL and Extended Attribute systemRobert Watson1999-12-191-0/+57
calls, vnops, vfsops, both in /kern, and to individual file systems that require a vfsop_ array entry. Reviewed by: eivind Notes: svn path=/head/; revision=54803