Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Return ENODATA when no attribute is found, like Linux do...



details:   https://anonhg.NetBSD.org/src/rev/6c550a4abeda
branches:  trunk
changeset: 779087:6c550a4abeda
user:      manu <manu%NetBSD.org@localhost>
date:      Tue May 01 07:48:25 2012 +0000

description:
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?

diffstat:

 sys/kern/vfs_xattr.c      |   6 +++---
 sys/ufs/ufs/ufs_extattr.c |  18 +++++++++---------
 2 files changed, 12 insertions(+), 12 deletions(-)

diffs (108 lines):

diff -r ce9350921f10 -r 6c550a4abeda sys/kern/vfs_xattr.c
--- a/sys/kern/vfs_xattr.c      Tue May 01 07:46:47 2012 +0000
+++ b/sys/kern/vfs_xattr.c      Tue May 01 07:48:25 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_xattr.c,v 1.30 2012/03/13 18:40:57 elad Exp $      */
+/*     $NetBSD: vfs_xattr.c,v 1.31 2012/05/01 07:48:25 manu 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.30 2012/03/13 18:40:57 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.31 2012/05/01 07:48:25 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -219,7 +219,7 @@
                                       &attrlen, l->l_cred);
 
                switch (error) {
-               case ENOATTR:
+               case ENODATA:
                        if (flag & XATTR_REPLACE)
                                goto done;
                        break;
diff -r ce9350921f10 -r 6c550a4abeda sys/ufs/ufs/ufs_extattr.c
--- a/sys/ufs/ufs/ufs_extattr.c Tue May 01 07:46:47 2012 +0000
+++ b/sys/ufs/ufs/ufs_extattr.c Tue May 01 07:48:25 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_extattr.c,v 1.38 2012/03/26 11:03:43 wiz Exp $     */
+/*     $NetBSD: ufs_extattr.c,v 1.39 2012/05/01 07:48:25 manu 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.38 2012/03/26 11:03:43 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.39 2012/05/01 07:48:25 manu Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ffs.h"
@@ -886,7 +886,7 @@
 
        uele = ufs_extattr_find_attr(ump, attrnamespace, attrname);
        if (!uele)
-               return (ENOATTR);
+               return (ENODATA);
 
        LIST_REMOVE(uele, uele_entries);
 
@@ -1034,7 +1034,7 @@
 
        /* 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) {
@@ -1047,7 +1047,7 @@
                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. */
@@ -1120,7 +1120,7 @@
 
        attribute = ufs_extattr_find_attr(ump, attrnamespace, name);
        if (!attribute)
-               return (ENOATTR);
+               return (ENODATA);
 
        /*
         * Allow only offsets of zero to encourage the read/replace
@@ -1244,7 +1244,7 @@
                        continue;
 
                error = ufs_extattr_get_header(vp, uele, &ueh, NULL);
-               if (error == ENOATTR)
+               if (error == ENODATA)
                        continue;       
                if (error != 0)
                        return error;
@@ -1408,7 +1408,7 @@
                attribute =  ufs_extattr_autocreate_attr(vp, attrnamespace, 
                                                         name, l);
                if  (!attribute)
-                       return (ENOATTR);
+                       return (ENODATA);
        }
 
        /*
@@ -1518,7 +1518,7 @@
 
        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



Home | Main Index | Thread Index | Old Index