linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Junling Zheng <zhengjunling@huawei.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 4/4] f2fs: unify the length of versions
Date: Fri, 30 Sep 2016 09:25:28 -0700	[thread overview]
Message-ID: <20160930162528.GA46477@jaegeuk> (raw)
In-Reply-To: <1475145517-18366-4-git-send-email-zhengjunling@huawei.com>

On Thu, Sep 29, 2016 at 06:38:37PM +0800, Junling Zheng wrote:
> Currently, versions in f2fs_configuration have one more byte, so versions
> in f2fs_super_block may not end with '\0', which will cause errors while
> printing it in print_raw_sb_info(). Unify the length of versions to fix it.

This is to handle non-zero terminated version characters in f2fs_super_block.
What is your point?

Thanks,

> 
> Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
> ---
>  include/f2fs_fs.h | 6 +++---
>  lib/libf2fs.c     | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
> index 1345e2d..e666076 100644
> --- a/include/f2fs_fs.h
> +++ b/include/f2fs_fs.h
> @@ -270,9 +270,9 @@ struct f2fs_configuration {
>  	u_int64_t target_sectors;
>  	u_int32_t sectors_per_blk;
>  	u_int32_t blks_per_seg;
> -	__u8 init_version[VERSION_LEN + 1];
> -	__u8 sb_version[VERSION_LEN + 1];
> -	__u8 version[VERSION_LEN + 1];
> +	__u8 init_version[VERSION_LEN];
> +	__u8 sb_version[VERSION_LEN];
> +	__u8 version[VERSION_LEN];
>  	char *vol_label;
>  	int heap;
>  	int32_t fd, kd;
> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
> index 706cc34..0a9436b 100644
> --- a/lib/libf2fs.c
> +++ b/lib/libf2fs.c
> @@ -570,11 +570,11 @@ int f2fs_dev_is_umounted(struct f2fs_configuration *c)
>  void get_kernel_version(__u8 *version)
>  {
>  	int i;
> -	for (i = 0; i < VERSION_LEN; i++) {
> +	for (i = 0; i < VERSION_LEN - 1; i++) {
>  		if (version[i] == '\n')
>  			break;
>  	}
> -	memset(version + i, 0, VERSION_LEN + 1 - i);
> +	memset(version + i, 0, VERSION_LEN - i);
>  }
>  
>  int f2fs_get_device_info(struct f2fs_configuration *c)
> -- 
> 2.7.4
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------

  reply	other threads:[~2016-09-30 16:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29 10:38 [PATCH 1/4] fsck.f2fs: free cp_page_1 in validate_checkpoint Junling Zheng
2016-09-29 10:38 ` [PATCH 2/4] fsck.f2fs: fix incorrect ERR_MSG in f2fs_do_mount Junling Zheng
2016-09-29 10:38 ` [PATCH 3/4] fsck.f2fs: fix a typo in check_sector_size Junling Zheng
2016-09-29 10:38 ` [PATCH 4/4] f2fs: unify the length of versions Junling Zheng
2016-09-30 16:25   ` Jaegeuk Kim [this message]
2016-10-08  1:08     ` Junling Zheng
2016-10-10 16:49       ` Jaegeuk Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160930162528.GA46477@jaegeuk \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=zhengjunling@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).