Re: [PATCH v2 4/4] common/rc: factor out _get|set_xfs_scratch_sb_field()

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

 



On Wed, Nov 08, 2017 at 08:49:08AM -0800, Darrick J. Wong wrote:
> On Wed, Nov 08, 2017 at 04:02:50PM +0800, Hou Tao wrote:
> > It's common to get and set the values of fields in XFS super block,
> > so factor them out as _get|set_xfs_scratch_sb_field() and update the
> > related test cases accordingly.
> > 
> > Signed-off-by: Hou Tao <houtao1@xxxxxxxxxx>
> > ---
> >  common/xfs    | 20 ++++++++++++++++++++
> >  tests/xfs/007 |  6 ++----
> >  tests/xfs/098 |  4 ++--
> >  tests/xfs/186 |  3 +--
> >  tests/xfs/199 | 13 ++++---------
> >  tests/xfs/307 | 11 ++---------
> >  tests/xfs/308 | 11 ++---------
> >  tests/xfs/339 |  6 +++---
> >  tests/xfs/340 |  2 +-
> >  tests/xfs/999 |  8 --------
> >  10 files changed, 37 insertions(+), 47 deletions(-)
> > 
> > diff --git a/common/xfs b/common/xfs
> > index d4fef94..82ddc24 100644
> > --- a/common/xfs
> > +++ b/common/xfs
> > @@ -599,3 +599,23 @@ _require_no_xfs_debug()
> >  		_notrun "Require XFS built without CONFIG_XFS_DEBUG"
> >  	fi
> >  }
> > +
> > +_get_xfs_scratch_sb_field()
> > +{
> > +	local field=$1
> > +
> > +	shift
> > +
> > +	_scratch_xfs_db -r -c 'sb 0' "$@" -c "print $field" | \
> > +	awk -v field=$field '$0 ~ field {print $3}'
> > +}
> > +
> > +_set_xfs_scratch_sb_field()
> > +{
> > +	local field=$1
> > +	local value=$2
> > +
> > +	shift 2
> > +
> > +	_scratch_xfs_db -x -c 'sb 0' "$@" -c "write $field -- $value"
> > +}
> 
> FWIW we already have _scratch_xfs_[gs]et_metadata_field in common/fuzzy.

Ah, thanks for the reminder! I forgot about them.. Tao, are the existing
helpers in common/fuzzy something you can use? And perhaps we should
move them to common/xfs then.

Thanks,
Eryu
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux