[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200125064356.GB1108497@mit.edu>
Date: Sat, 25 Jan 2020 01:43:56 -0500
From: "Theodore Y. Ts'o" <tytso@....edu>
To: Andreas Dilger <adilger@...ger.ca>
Cc: linux-ext4@...r.kernel.org
Subject: Re: [PATCH 2/2] mmp: abstract out repeated 'sizeof(buf), buf' usage
On Tue, Jan 14, 2020 at 02:42:18PM -0700, Andreas Dilger wrote:
> The printf("%.*s") format requires both the buffer size and buffer
> pointer to be specified for each use. Since this is repeatedly given
> as "(int)sizeof(buf), (char *)buf" for mmp_nodename and mmp_bdevname
> fields, with typecasts to avoid compiler warnings.
>
> Add a helper macro EXT2_LEN_STR() to avoid repeated boilerplate code.
>
> This can also be used for other superblock buffer fields that may not
> have NUL-terminated strings (e.g. s_volume_name, s_last_mounted,
> s_{first,last}_error_func, s_mount_opts) to simplify code and avoid
> the need for temporary buffers for NUL-termination.
>
> Annotate the superblock string fields that may not be NUL-terminated.
>
> Signed-off-by: Andreas Dilger <adilger@...ger.ca>
Applied, thanks.
- Ted
Powered by blists - more mailing lists