Module Name: src
Committed By: riz
Date: Sat May 19 15:03:32 UTC 2012
Modified Files:
src/sys/kern [netbsd-6]: vfs_xattr.c
src/sys/ufs/ufs [netbsd-6]: ufs_extattr.c
Log Message:
Pull up following revision(s) (requested by manu in ticket #260):
sys/kern/vfs_xattr.c: revision 1.31
sys/ufs/ufs/ufs_extattr.c: revision 1.39
Return ENODATA when no attribute is found, like Linux does. After
all we decided to adopt the Linux API, therefore there is rationale
to stick to it.
No standard tells us what to do, and our extended attribute API has not
been used in a release, therefore we do not break anything, and we get
more easily compatible with programs using the Linux extended attribute
API.
Note that FreeBSD and MacOS X return ENOATTR. FreeBSD has its own API
and MacOS X has a Linux-like API. How did the world get so complicated?
To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.6.1 src/sys/kern/vfs_xattr.c
cvs rdiff -u -r1.36 -r1.36.2.1 src/sys/ufs/ufs/ufs_extattr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/vfs_xattr.c
diff -u src/sys/kern/vfs_xattr.c:1.29 src/sys/kern/vfs_xattr.c:1.29.6.1
--- src/sys/kern/vfs_xattr.c:1.29 Wed Nov 9 18:29:28 2011
+++ src/sys/kern/vfs_xattr.c Sat May 19 15:03:31 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_xattr.c,v 1.29 2011/11/09 18:29:28 drochner Exp $ */
+/* $NetBSD: vfs_xattr.c,v 1.29.6.1 2012/05/19 15:03:31 riz Exp $ */
/*-
* Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.29 2011/11/09 18:29:28 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.29.6.1 2012/05/19 15:03:31 riz Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -230,7 +230,7 @@ extattr_set_vp(struct vnode *vp, int att
&attrlen, l->l_cred);
switch (error) {
- case ENOATTR:
+ case ENODATA:
if (flag & XATTR_REPLACE)
goto done;
break;
Index: src/sys/ufs/ufs/ufs_extattr.c
diff -u src/sys/ufs/ufs/ufs_extattr.c:1.36 src/sys/ufs/ufs/ufs_extattr.c:1.36.2.1
--- src/sys/ufs/ufs/ufs_extattr.c:1.36 Fri Jan 27 19:22:49 2012
+++ src/sys/ufs/ufs/ufs_extattr.c Sat May 19 15:03:31 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_extattr.c,v 1.36 2012/01/27 19:22:49 para Exp $ */
+/* $NetBSD: ufs_extattr.c,v 1.36.2.1 2012/05/19 15:03:31 riz Exp $ */
/*-
* Copyright (c) 1999-2002 Robert N. M. Watson
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.36 2012/01/27 19:22:49 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.36.2.1 2012/05/19 15:03:31 riz Exp $");
#ifdef _KERNEL_OPT
#include "opt_ffs.h"
@@ -834,7 +834,7 @@ ufs_extattr_disable(struct ufsmount *ump
uele = ufs_extattr_find_attr(ump, attrnamespace, attrname);
if (!uele)
- return (ENOATTR);
+ return (ENODATA);
LIST_REMOVE(uele, uele_entries);
@@ -981,7 +981,7 @@ ufs_extattr_get_header(struct vnode *vp,
/* Defined? */
if ((ueh->ueh_flags & UFS_EXTATTR_ATTR_FLAG_INUSE) == 0)
- return ENOATTR;
+ return ENODATA;
/* Valid for the current inode generation? */
if (ueh->ueh_i_gen != ip->i_gen) {
@@ -994,7 +994,7 @@ ufs_extattr_get_header(struct vnode *vp,
printf("%s (%s): inode gen inconsistency (%u, %jd)\n",
__func__, mp->mnt_stat.f_mntonname, ueh->ueh_i_gen,
(intmax_t)ip->i_gen);
- return ENOATTR;
+ return ENODATA;
}
/* Local size consistency check. */
@@ -1066,7 +1066,7 @@ ufs_extattr_get(struct vnode *vp, int at
attribute = ufs_extattr_find_attr(ump, attrnamespace, name);
if (!attribute)
- return (ENOATTR);
+ return (ENODATA);
/*
* Allow only offsets of zero to encourage the read/replace
@@ -1185,7 +1185,7 @@ ufs_extattr_list(struct vnode *vp, int a
continue;
error = ufs_extattr_get_header(vp, uele, &ueh, NULL);
- if (error == ENOATTR)
+ if (error == ENODATA)
continue;
if (error != 0)
return error;
@@ -1348,7 +1348,7 @@ ufs_extattr_set(struct vnode *vp, int at
attribute = ufs_extattr_autocreate_attr(vp, attrnamespace,
name, l);
if (!attribute)
- return (ENOATTR);
+ return (ENODATA);
}
/*
@@ -1457,7 +1457,7 @@ ufs_extattr_rm(struct vnode *vp, int att
attribute = ufs_extattr_find_attr(ump, attrnamespace, name);
if (!attribute)
- return (ENOATTR);
+ return (ENODATA);
/*
* Don't need to get a lock on the backing file if the getattr is