xfs: pass the attr value to put_listent when possible
Pass the attr value to put_listent when we have local xattrs or shortform xattrs. This will enable the GETPARENTS ioctl to use xfs_attr_list as its backend. Signed-off-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
daf9f88490
commit
8f4b980ee6
@ -47,8 +47,9 @@ struct xfs_attrlist_cursor_kern {
|
|||||||
|
|
||||||
|
|
||||||
/* void; state communicated via *context */
|
/* void; state communicated via *context */
|
||||||
typedef void (*put_listent_func_t)(struct xfs_attr_list_context *, int,
|
typedef void (*put_listent_func_t)(struct xfs_attr_list_context *context,
|
||||||
unsigned char *, int, int);
|
int flags, unsigned char *name, int namelen, void *value,
|
||||||
|
int valuelen);
|
||||||
|
|
||||||
struct xfs_attr_list_context {
|
struct xfs_attr_list_context {
|
||||||
struct xfs_trans *tp;
|
struct xfs_trans *tp;
|
||||||
|
@ -16,6 +16,7 @@ typedef struct xfs_attr_sf_sort {
|
|||||||
uint8_t flags; /* flags bits (see xfs_attr_leaf.h) */
|
uint8_t flags; /* flags bits (see xfs_attr_leaf.h) */
|
||||||
xfs_dahash_t hash; /* this entry's hash value */
|
xfs_dahash_t hash; /* this entry's hash value */
|
||||||
unsigned char *name; /* name value, pointer into buffer */
|
unsigned char *name; /* name value, pointer into buffer */
|
||||||
|
void *value;
|
||||||
} xfs_attr_sf_sort_t;
|
} xfs_attr_sf_sort_t;
|
||||||
|
|
||||||
#define XFS_ATTR_SF_ENTSIZE_MAX /* max space for name&value */ \
|
#define XFS_ATTR_SF_ENTSIZE_MAX /* max space for name&value */ \
|
||||||
|
@ -92,6 +92,7 @@ xfs_attr_shortform_list(
|
|||||||
sfe->flags,
|
sfe->flags,
|
||||||
sfe->nameval,
|
sfe->nameval,
|
||||||
(int)sfe->namelen,
|
(int)sfe->namelen,
|
||||||
|
&sfe->nameval[sfe->namelen],
|
||||||
(int)sfe->valuelen);
|
(int)sfe->valuelen);
|
||||||
/*
|
/*
|
||||||
* Either search callback finished early or
|
* Either search callback finished early or
|
||||||
@ -138,6 +139,7 @@ xfs_attr_shortform_list(
|
|||||||
sbp->name = sfe->nameval;
|
sbp->name = sfe->nameval;
|
||||||
sbp->namelen = sfe->namelen;
|
sbp->namelen = sfe->namelen;
|
||||||
/* These are bytes, and both on-disk, don't endian-flip */
|
/* These are bytes, and both on-disk, don't endian-flip */
|
||||||
|
sbp->value = &sfe->nameval[sfe->namelen],
|
||||||
sbp->valuelen = sfe->valuelen;
|
sbp->valuelen = sfe->valuelen;
|
||||||
sbp->flags = sfe->flags;
|
sbp->flags = sfe->flags;
|
||||||
sbp->hash = xfs_attr_hashval(dp->i_mount, sfe->flags,
|
sbp->hash = xfs_attr_hashval(dp->i_mount, sfe->flags,
|
||||||
@ -192,6 +194,7 @@ xfs_attr_shortform_list(
|
|||||||
sbp->flags,
|
sbp->flags,
|
||||||
sbp->name,
|
sbp->name,
|
||||||
sbp->namelen,
|
sbp->namelen,
|
||||||
|
sbp->value,
|
||||||
sbp->valuelen);
|
sbp->valuelen);
|
||||||
if (context->seen_enough)
|
if (context->seen_enough)
|
||||||
break;
|
break;
|
||||||
@ -479,6 +482,7 @@ xfs_attr3_leaf_list_int(
|
|||||||
*/
|
*/
|
||||||
for (; i < ichdr.count; entry++, i++) {
|
for (; i < ichdr.count; entry++, i++) {
|
||||||
char *name;
|
char *name;
|
||||||
|
void *value;
|
||||||
int namelen, valuelen;
|
int namelen, valuelen;
|
||||||
|
|
||||||
if (be32_to_cpu(entry->hashval) != cursor->hashval) {
|
if (be32_to_cpu(entry->hashval) != cursor->hashval) {
|
||||||
@ -496,6 +500,7 @@ xfs_attr3_leaf_list_int(
|
|||||||
name_loc = xfs_attr3_leaf_name_local(leaf, i);
|
name_loc = xfs_attr3_leaf_name_local(leaf, i);
|
||||||
name = name_loc->nameval;
|
name = name_loc->nameval;
|
||||||
namelen = name_loc->namelen;
|
namelen = name_loc->namelen;
|
||||||
|
value = &name_loc->nameval[name_loc->namelen];
|
||||||
valuelen = be16_to_cpu(name_loc->valuelen);
|
valuelen = be16_to_cpu(name_loc->valuelen);
|
||||||
} else {
|
} else {
|
||||||
xfs_attr_leaf_name_remote_t *name_rmt;
|
xfs_attr_leaf_name_remote_t *name_rmt;
|
||||||
@ -503,6 +508,7 @@ xfs_attr3_leaf_list_int(
|
|||||||
name_rmt = xfs_attr3_leaf_name_remote(leaf, i);
|
name_rmt = xfs_attr3_leaf_name_remote(leaf, i);
|
||||||
name = name_rmt->name;
|
name = name_rmt->name;
|
||||||
namelen = name_rmt->namelen;
|
namelen = name_rmt->namelen;
|
||||||
|
value = NULL;
|
||||||
valuelen = be32_to_cpu(name_rmt->valuelen);
|
valuelen = be32_to_cpu(name_rmt->valuelen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,7 +519,7 @@ xfs_attr3_leaf_list_int(
|
|||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
context->put_listent(context, entry->flags,
|
context->put_listent(context, entry->flags,
|
||||||
name, namelen, valuelen);
|
name, namelen, value, valuelen);
|
||||||
if (context->seen_enough)
|
if (context->seen_enough)
|
||||||
break;
|
break;
|
||||||
cursor->offset++;
|
cursor->offset++;
|
||||||
|
@ -310,6 +310,7 @@ xfs_ioc_attr_put_listent(
|
|||||||
int flags,
|
int flags,
|
||||||
unsigned char *name,
|
unsigned char *name,
|
||||||
int namelen,
|
int namelen,
|
||||||
|
void *value,
|
||||||
int valuelen)
|
int valuelen)
|
||||||
{
|
{
|
||||||
struct xfs_attrlist *alist = context->buffer;
|
struct xfs_attrlist *alist = context->buffer;
|
||||||
|
@ -222,6 +222,7 @@ xfs_xattr_put_listent(
|
|||||||
int flags,
|
int flags,
|
||||||
unsigned char *name,
|
unsigned char *name,
|
||||||
int namelen,
|
int namelen,
|
||||||
|
void *value,
|
||||||
int valuelen)
|
int valuelen)
|
||||||
{
|
{
|
||||||
char *prefix;
|
char *prefix;
|
||||||
|
Loading…
Reference in New Issue
Block a user