Re: [PATCH 19/24] mdrestore: Introduce mdrestore v1 operations

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

 



On Tue, May 23, 2023 at 10:48:11 AM -0700, Darrick J. Wong wrote:
> On Tue, May 23, 2023 at 02:30:45PM +0530, Chandan Babu R wrote:
>> In order to indicate the version of metadump files that they can work with,
>> this commit renames read_header(), show_info() and restore() functions to
>> read_header_v1(), show_info_v1() and restore_v1() respectively.
>> 
>> Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx>
>> ---
>>  mdrestore/xfs_mdrestore.c | 76 ++++++++++++++++++++++-----------------
>>  1 file changed, 43 insertions(+), 33 deletions(-)
>> 
>> diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c
>> index 895e5cdab..5ec1a47b0 100644
>> --- a/mdrestore/xfs_mdrestore.c
>> +++ b/mdrestore/xfs_mdrestore.c
>> @@ -86,16 +86,26 @@ open_device(
>>  	return fd;
>>  }
>>  
>> -static void read_header(struct xfs_metablock *mb, FILE *src_f)
>> +static void
>> +read_header_v1(
>> +	void			*header,
>> +	FILE			*mdfp)
>>  {
>> -	if (fread(mb, sizeof(*mb), 1, src_f) != 1)
>> +	struct xfs_metablock	*mb = header;
>> +
>> +	if (fread(mb, sizeof(*mb), 1, mdfp) != 1)
>>  		fatal("error reading from metadump file\n");
>>  	if (mb->mb_magic != cpu_to_be32(XFS_MD_MAGIC_V1))
>>  		fatal("specified file is not a metadata dump\n");
>>  }
>>  
>> -static void show_info(struct xfs_metablock *mb, const char *mdfile)
>> +static void
>> +show_info_v1(
>> +	void			*header,
>> +	const char		*mdfile)
>>  {
>> +	struct xfs_metablock	*mb = header;
>> +
>>  	if (mb->mb_info & XFS_METADUMP_INFO_FLAGS) {
>>  		printf("%s: %sobfuscated, %s log, %s metadata blocks\n",
>>  			mdfile,
>> @@ -107,24 +117,15 @@ static void show_info(struct xfs_metablock *mb, const char *mdfile)
>>  	}
>>  }
>>  
>> -/*
>> - * restore() -- do the actual work to restore the metadump
>> - *
>> - * @src_f: A FILE pointer to the source metadump
>> - * @dst_fd: the file descriptor for the target file
>> - * @is_target_file: designates whether the target is a regular file
>> - * @mbp: pointer to metadump's first xfs_metablock, read and verified by the caller
>> - *
>> - * src_f should be positioned just past a read the previously validated metablock
>> - */
>>  static void
>> -restore(
>> -	FILE			*src_f,
>> -	int			dst_fd,
>> -	int			is_target_file,
>> -	const struct xfs_metablock	*mbp)
>> +restore_v1(
>> +	void		*header,
>> +	FILE		*mdfp,
>> +	int		data_fd,
>
> Umm.  mdfp == "FILE * stream for reading the source" and "data_fd" == "fd
> pointing to data device for writing the filesystem"?
>
> I think I'd prefer md_fp and ddev_fd...
>

Ok. This is more readable that what I had written.

-- 
chandan



[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