Message ID | 20210308155111.53874-4-chandanrlinux@gmail.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | xfs: Tests to verify inode fork extent count overflow detection | expand |
On Mon, Mar 08, 2021 at 09:21:01PM +0530, Chandan Babu R wrote: > This commit adds a helper function to obtain the value of a particular field > of an inode's fsxattr fields. > > Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com> > --- > common/xfs | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/common/xfs b/common/xfs > index f0ae321e..9a0ab484 100644 > --- a/common/xfs > +++ b/common/xfs > @@ -194,6 +194,18 @@ _xfs_get_file_block_size() > $XFS_INFO_PROG "$path" | grep realtime | sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g' > } > > +xfs_get_fsxattr() Shared helpers always begin with an underscore, e.g. _xfs_get_fsxattr() > +{ > + local field="$1" > + local path="$2" > + local value="" > + > + value=$($XFS_IO_PROG -c "stat" "$path" | grep "$field") > + value=${value##fsxattr.${field} = } > + > + echo "$value" This could be streamlined to: local value=$($XFS_IO_PROG -c "stat" "$path" | grep "$field") echo "${value##fsxattr.${field} = }" Right? --D > +} > + > # xfs_check script is planned to be deprecated. But, we want to > # be able to invoke "xfs_check" behavior in xfstests in order to > # maintain the current verification levels. > -- > 2.29.2 >
diff --git a/common/xfs b/common/xfs index f0ae321e..9a0ab484 100644 --- a/common/xfs +++ b/common/xfs @@ -194,6 +194,18 @@ _xfs_get_file_block_size() $XFS_INFO_PROG "$path" | grep realtime | sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g' } +xfs_get_fsxattr() +{ + local field="$1" + local path="$2" + local value="" + + value=$($XFS_IO_PROG -c "stat" "$path" | grep "$field") + value=${value##fsxattr.${field} = } + + echo "$value" +} + # xfs_check script is planned to be deprecated. But, we want to # be able to invoke "xfs_check" behavior in xfstests in order to # maintain the current verification levels.
This commit adds a helper function to obtain the value of a particular field of an inode's fsxattr fields. Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com> --- common/xfs | 12 ++++++++++++ 1 file changed, 12 insertions(+)