OSDN Git Service

xfs: remove ATTR_KERNOVAL
authorChristoph Hellwig <hch@lst.de>
Thu, 27 Feb 2020 01:30:35 +0000 (17:30 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 3 Mar 2020 04:55:53 +0000 (20:55 -0800)
We can just pass down the Linux convention of a zero valuelen to just
query for the existance of an attribute to the low-level code instead.
The use in the legacy xfs_attr_list code only used by the ioctl
interface was already dead code, as the callers check that the flag
is not present.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/libxfs/xfs_attr.c
fs/xfs/libxfs/xfs_attr.h
fs/xfs/libxfs/xfs_attr_leaf.c
fs/xfs/libxfs/xfs_attr_remote.c
fs/xfs/xfs_attr_list.c
fs/xfs/xfs_xattr.c

index fd095e3..4694177 100644 (file)
@@ -94,9 +94,9 @@ xfs_attr_get_ilocked(
 /*
  * Retrieve an extended attribute by name, and its value if requested.
  *
- * If ATTR_KERNOVAL is set in args->flags, then the caller does not want the
- * value, just an indication whether the attribute exists and the size of the
- * value if it exists. The size is returned in args.valuelen.
+ * If args->valuelen is zero, then the caller does not want the value, just an
+ * indication whether the attribute exists and the size of the value if it
+ * exists. The size is returned in args.valuelen.
  *
  * If the attribute is found, but exceeds the size limit set by the caller in
  * args->valuelen, return -ERANGE with the size of the attribute that was found
@@ -115,7 +115,7 @@ xfs_attr_get(
        uint                    lock_mode;
        int                     error;
 
-       ASSERT((args->flags & (ATTR_ALLOC | ATTR_KERNOVAL)) || args->value);
+       ASSERT((args->flags & ATTR_ALLOC) || !args->valuelen || args->value);
 
        XFS_STATS_INC(args->dp->i_mount, xs_attr_get);
 
index b8c4ed2..fe064cd 100644 (file)
@@ -34,12 +34,11 @@ struct xfs_attr_list_context;
 #define ATTR_REPLACE   0x0020  /* pure set: fail if attr does not exist */
 
 #define ATTR_KERNOTIME 0x1000  /* [kernel] don't update inode timestamps */
-#define ATTR_KERNOVAL  0x2000  /* [kernel] get attr size only, not value */
 
 #define ATTR_ALLOC     0x8000  /* [kernel] allocate xattr buffer on demand */
 
 #define ATTR_KERNEL_FLAGS \
-       (ATTR_KERNOTIME | ATTR_KERNOVAL | ATTR_ALLOC)
+       (ATTR_KERNOTIME | ATTR_ALLOC)
 
 #define XFS_ATTR_FLAGS \
        { ATTR_DONTFOLLOW,      "DONTFOLLOW" }, \
@@ -49,7 +48,6 @@ struct xfs_attr_list_context;
        { ATTR_CREATE,          "CREATE" }, \
        { ATTR_REPLACE,         "REPLACE" }, \
        { ATTR_KERNOTIME,       "KERNOTIME" }, \
-       { ATTR_KERNOVAL,        "KERNOVAL" }, \
        { ATTR_ALLOC,           "ALLOC" }
 
 /*
index fed537a..5e700df 100644 (file)
@@ -464,7 +464,7 @@ xfs_attr_copy_value(
        /*
         * No copy if all we have to do is get the length
         */
-       if (args->flags & ATTR_KERNOVAL) {
+       if (!args->valuelen) {
                args->valuelen = valuelen;
                return 0;
        }
@@ -830,9 +830,9 @@ xfs_attr_shortform_lookup(xfs_da_args_t *args)
 /*
  * Retrieve the attribute value and length.
  *
- * If ATTR_KERNOVAL is specified, only the length needs to be returned.
- * Unlike a lookup, we only return an error if the attribute does not
- * exist or we can't retrieve the value.
+ * If args->valuelen is zero, only the length needs to be returned.  Unlike a
+ * lookup, we only return an error if the attribute does not exist or we can't
+ * retrieve the value.
  */
 int
 xfs_attr_shortform_getvalue(
@@ -2444,9 +2444,9 @@ xfs_attr3_leaf_lookup_int(
  * Get the value associated with an attribute name from a leaf attribute
  * list structure.
  *
- * If ATTR_KERNOVAL is specified, only the length needs to be returned.
- * Unlike a lookup, we only return an error if the attribute does not
- * exist or we can't retrieve the value.
+ * If args->valuelen is zero, only the length needs to be returned.  Unlike a
+ * lookup, we only return an error if the attribute does not exist or we can't
+ * retrieve the value.
  */
 int
 xfs_attr3_leaf_getvalue(
index 8b7f74b..01ad7f3 100644 (file)
@@ -397,7 +397,7 @@ xfs_attr_rmtval_get(
 
        trace_xfs_attr_rmtval_get(args);
 
-       ASSERT(!(args->flags & ATTR_KERNOVAL));
+       ASSERT(args->valuelen != 0);
        ASSERT(args->rmtvaluelen == args->valuelen);
 
        valuelen = args->rmtvaluelen;
index f7c4f6b..b430521 100644 (file)
@@ -568,7 +568,6 @@ xfs_attr_put_listent(
        int arraytop;
 
        ASSERT(!context->seen_enough);
-       ASSERT(!(context->flags & ATTR_KERNOVAL));
        ASSERT(context->count >= 0);
        ASSERT(context->count < (ATTR_MAX_VALUELEN/8));
        ASSERT(context->firstu >= sizeof(*alist));
@@ -637,8 +636,6 @@ xfs_attr_list(
         */
        if (((long)buffer) & (sizeof(int)-1))
                return -EFAULT;
-       if (flags & ATTR_KERNOVAL)
-               bufsize = 0;
 
        /*
         * Initialize the output buffer.
index 5411f3b..05c1d6d 100644 (file)
@@ -33,10 +33,6 @@ xfs_xattr_get(const struct xattr_handler *handler, struct dentry *unused,
        };
        int                     error;
 
-       /* Convert Linux syscall to XFS internal ATTR flags */
-       if (!size)
-               args.flags |= ATTR_KERNOVAL;
-
        error = xfs_attr_get(&args);
        if (error)
                return error;