Re: [PATCH 07/16] reftable/block: rename `block_reader` to `reftable_block`

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

 



On 25/03/31 10:41AM, Patrick Steinhardt wrote:
> The `block_reader` structure is used to access parsed data of a reftable
> block. The structure is currently treated as an internal implementation
> detail and not exposed via our public interfaces. The functionality
> provided by the structure is useful to external users of the reftable
> library though, for example when implementing consistency checks that
> need to scan through the blocks manually.
> 
> Rename the structure to `reftable_block` now that the name has been made
> available in the preceding commit. This name is in line with the naming
> schema used for other data structures like `reftable_table` in that it
> describes the underlying entity that it provides access to.
> 
> The new data structure isn't yet exposed via the public interface, which
> is left for a subsequent commit.
> 
> Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
> ---
>  reftable/block.c                | 142 ++++++++++++++++++++--------------------
>  reftable/block.h                |  29 ++++----
>  reftable/iter.c                 |   9 ++-
>  reftable/iter.h                 |   2 +-
>  reftable/table.c                |  46 ++++++-------
>  reftable/table.h                |   8 ++-
>  t/unit-tests/t-reftable-block.c | 102 ++++++++++++++---------------
>  7 files changed, 172 insertions(+), 166 deletions(-)
> 
> diff --git a/reftable/block.c b/reftable/block.c
> index ad162ecdbf6..d188665388d 100644
> --- a/reftable/block.c
> +++ b/reftable/block.c
> @@ -222,10 +222,10 @@ static int read_block(struct reftable_block_source *source,
>  	return block_source_read_data(source, dest, off, sz);
>  }
>  
> -int block_reader_init(struct block_reader *br,
> -		      struct reftable_block_source *source,
> -		      uint32_t offset, uint32_t header_size,
> -		      uint32_t table_block_size, uint32_t hash_size)
> +int reftable_block_init(struct reftable_block *block,
> +			struct reftable_block_source *source,
> +			uint32_t offset, uint32_t header_size,
> +			uint32_t table_block_size, uint32_t hash_size)
>  {
>  	uint32_t guess_block_size = table_block_size ?
>  		table_block_size : DEFAULT_BLOCK_SIZE;
> @@ -236,19 +236,19 @@ int block_reader_init(struct block_reader *br,
>  	uint8_t block_type;
>  	int err;
>  
> -	err = read_block(source, &br->block, offset, guess_block_size);
> +	err = read_block(source, &block->block, offset, guess_block_size);
>  	if (err < 0)
>  		goto done;
>  
> -	block_type = br->block.data[header_size];
> +	block_type = block->block.data[header_size];

Ah, in the previous patch I suggested renaming the `block` field to
`data`, but I guess that would lead to `block->data.data` here and would
also be a bit funny. It's probably fine to just leave it as-is then.

The rest of this patch is just a refactor to rename types from
`block_reader` to `reftable_block` and associated variable names to
match which all looks correct.

-Justin




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux