xfs: clean up the attr flag confusion

The ATTR_* flags have a long IRIX history, where they a userspace
interface, the on-disk format and an internal interface.  We've split
out the on-disk interface to the XFS_ATTR_* values, but despite (or
because?) of that the flag have still been a mess.  Switch the
internal interface to pass the on-disk XFS_ATTR_* flags for the
namespace and the Linux XATTR_* flags for the actual flags instead.
The ATTR_* values that are actually used are move to xfs_fs.h with a
new XFS_IOC_* prefix to not conflict with the userspace version that
has the same name and must have the same value.

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>
This commit is contained in:
Christoph Hellwig
2020-02-26 17:30:42 -08:00
committed by Darrick J. Wong
parent f3e93d95fe
commit d5f0f49a9b
13 changed files with 96 additions and 96 deletions

View File

@@ -295,7 +295,7 @@ xfs_attr_set(
struct xfs_inode *dp = args->dp;
struct xfs_mount *mp = dp->i_mount;
struct xfs_trans_res tres;
int rsvd = (args->flags & ATTR_ROOT) != 0;
bool rsvd = (args->attr_filter & XFS_ATTR_ROOT);
int error, local;
unsigned int total;
@@ -423,10 +423,10 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
trace_xfs_attr_sf_addname(args);
retval = xfs_attr_shortform_lookup(args);
if (retval == -ENOATTR && (args->flags & ATTR_REPLACE))
if (retval == -ENOATTR && (args->attr_flags & XATTR_REPLACE))
return retval;
if (retval == -EEXIST) {
if (args->flags & ATTR_CREATE)
if (args->attr_flags & XATTR_CREATE)
return retval;
retval = xfs_attr_shortform_remove(args);
if (retval)
@@ -436,7 +436,7 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
* that the leaf format add routine won't trip over the attr
* not being around.
*/
args->flags &= ~ATTR_REPLACE;
args->attr_flags &= ~XATTR_REPLACE;
}
if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||
@@ -489,10 +489,10 @@ xfs_attr_leaf_addname(
* the given flags produce an error or call for an atomic rename.
*/
retval = xfs_attr3_leaf_lookup_int(bp, args);
if (retval == -ENOATTR && (args->flags & ATTR_REPLACE))
if (retval == -ENOATTR && (args->attr_flags & XATTR_REPLACE))
goto out_brelse;
if (retval == -EEXIST) {
if (args->flags & ATTR_CREATE) /* pure create op */
if (args->attr_flags & XATTR_CREATE)
goto out_brelse;
trace_xfs_attr_leaf_replace(args);
@@ -763,10 +763,10 @@ restart:
goto out;
blk = &state->path.blk[ state->path.active-1 ];
ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
if (retval == -ENOATTR && (args->flags & ATTR_REPLACE))
if (retval == -ENOATTR && (args->attr_flags & XATTR_REPLACE))
goto out;
if (retval == -EEXIST) {
if (args->flags & ATTR_CREATE)
if (args->attr_flags & XATTR_CREATE)
goto out;
trace_xfs_attr_node_replace(args);