diff options
author | rwatson <rwatson@FreeBSD.org> | 2003-06-05 05:55:34 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2003-06-05 05:55:34 +0000 |
commit | 6b8a71ea4a26e2a16ffaecf323e0f05dec56fd1a (patch) | |
tree | db061588e68b6919ee6a8aba0b43d65006648400 /sys | |
parent | 9c43f2f46e63ba02659361780174ad82780a69cd (diff) | |
download | FreeBSD-src-6b8a71ea4a26e2a16ffaecf323e0f05dec56fd1a.zip FreeBSD-src-6b8a71ea4a26e2a16ffaecf323e0f05dec56fd1a.tar.gz |
If a system call comes in requesting to retrieve an attribute named
"", temporarily map it to a call to extattr_list_vp() to provide
compatibility for older applications using the "" API to retrieve
EA lists.
Use VOP_LISTEXTATTR() to support extattr_list_vp() rather than
VOP_GETEXTATTR(..., "", ...).
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Asssociates Laboratories
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_extattr.c | 14 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 14 |
2 files changed, 26 insertions, 2 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 8987fb7..fed094c2 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -88,6 +88,9 @@ static int setutimes(struct thread *td, struct vnode *, static int vn_access(struct vnode *vp, int user_flags, struct ucred *cred, struct thread *td); +static int extattr_list_vp(struct vnode *vp, int attrnamespace, void *data, + size_t nbytes, struct thread *td); + int (*union_dircheckp)(struct thread *td, struct vnode **, struct file *); int (*softdep_fsync_hook)(struct vnode *); @@ -4052,6 +4055,15 @@ extattr_get_vp(struct vnode *vp, int attrnamespace, const char *attrname, size_t size, *sizep; int error; + /* + * XXX: Temporary API compatibility for applications that know + * about this hack ("" means list), but haven't been updated + * for the extattr_list_*() system calls yet. This will go + * away for FreeBSD 5.3. + */ + if (strlen(attrname) == 0) + return (extattr_list_vp(vp, attrnamespace, data, nbytes, td)); + VOP_LEASE(vp, td, td->td_ucred, LEASE_READ); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); @@ -4371,7 +4383,7 @@ extattr_list_vp(struct vnode *vp, int attrnamespace, void *data, goto done; #endif - error = VOP_GETEXTATTR(vp, attrnamespace, "", auiop, sizep, + error = VOP_LISTEXTATTR(vp, attrnamespace, auiop, sizep, td->td_ucred, td); if (auiop != NULL) { diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 8987fb7..fed094c2 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -88,6 +88,9 @@ static int setutimes(struct thread *td, struct vnode *, static int vn_access(struct vnode *vp, int user_flags, struct ucred *cred, struct thread *td); +static int extattr_list_vp(struct vnode *vp, int attrnamespace, void *data, + size_t nbytes, struct thread *td); + int (*union_dircheckp)(struct thread *td, struct vnode **, struct file *); int (*softdep_fsync_hook)(struct vnode *); @@ -4052,6 +4055,15 @@ extattr_get_vp(struct vnode *vp, int attrnamespace, const char *attrname, size_t size, *sizep; int error; + /* + * XXX: Temporary API compatibility for applications that know + * about this hack ("" means list), but haven't been updated + * for the extattr_list_*() system calls yet. This will go + * away for FreeBSD 5.3. + */ + if (strlen(attrname) == 0) + return (extattr_list_vp(vp, attrnamespace, data, nbytes, td)); + VOP_LEASE(vp, td, td->td_ucred, LEASE_READ); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); @@ -4371,7 +4383,7 @@ extattr_list_vp(struct vnode *vp, int attrnamespace, void *data, goto done; #endif - error = VOP_GETEXTATTR(vp, attrnamespace, "", auiop, sizep, + error = VOP_LISTEXTATTR(vp, attrnamespace, auiop, sizep, td->td_ucred, td); if (auiop != NULL) { |