From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: "Luis R. Rodriguez" <mcgrof@kernel.org>
Cc: sandeen@sandeen.net, linux-xfs@vger.kernel.org, jack@suse.com,
jeffm@suse.com, okurz@suse.com, lpechacek@suse.com,
jtulak@redhat.com
Subject: Re: [PATCH v3 2/4] mkfs: move shared config structs and into their own headers
Date: Thu, 24 May 2018 20:35:48 -0700 [thread overview]
Message-ID: <20180525033548.GQ14384@magnolia> (raw)
In-Reply-To: <20180525031943.29440-3-mcgrof@kernel.org>
On Thu, May 24, 2018 at 08:19:41PM -0700, Luis R. Rodriguez wrote:
> Both struct sb_feat_args and struct mkfs_default_params will be shared
> between CLI processing and the configuration file processing added later,
> so move these to their own header.
>
> This will help ensure we split things neatly later and also will help
> ensure the configuration file processing code from the CLI code are kept
> separate and cannot touch each other's data structures. This also makes
> it clear what is actually shared between both.
>
> There are no introduced functional changes in this commit and no
> documentation changes, this is just code shuffling.
>
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> ---
> mkfs/config.h | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> mkfs/xfs_mkfs.c | 55 +---------------------------------------
> 2 files changed, 79 insertions(+), 54 deletions(-)
> create mode 100644 mkfs/config.h
>
> diff --git a/mkfs/config.h b/mkfs/config.h
> new file mode 100644
> index 000000000000..e5ea968e2d65
> --- /dev/null
> +++ b/mkfs/config.h
> @@ -0,0 +1,78 @@
> +/*
> + * Copyright (c) 2000-2005 Silicon Graphics, Inc.
> + * Copyright (c) 2016-2017 Red Hat, Inc.
> + * All Rights Reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it would be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write the Free Software Foundation,
> + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +#ifndef _XFS_MKFS_CONFIG_H
> +#define _XFS_MKFS_CONFIG_H
> +
> +struct fsxattr;
> +
> +/*
> + * Shared superblock configuration options
> + *
> + * These options provide shared configuration tunables for the filesystem
> + * superblock. There are three possible sources for these options set, each
> + * source can overriding the later source:
> + *
> + * o built-in defaults
> + * o configuration file (XXX)
> + * o command line
> + *
> + * These values are not used directly - they are inputs into the mkfs geometry
> + * validation.
> + */
> +struct sb_feat_args {
> + int log_version;
> + int attr_version;
> + int dir_version;
> + bool inode_align; /* XFS_SB_VERSION_ALIGNBIT */
> + bool nci; /* XFS_SB_VERSION_BORGBIT */
> + bool lazy_sb_counters; /* XFS_SB_VERSION2_LAZYSBCOUNTBIT */
> + bool parent_pointers; /* XFS_SB_VERSION2_PARENTBIT */
> + bool projid32bit; /* XFS_SB_VERSION2_PROJID32BIT */
> + bool crcs_enabled; /* XFS_SB_VERSION2_CRCBIT */
> + bool dirftype; /* XFS_SB_VERSION2_FTYPE */
> + bool finobt; /* XFS_SB_FEAT_RO_COMPAT_FINOBT */
> + bool spinodes; /* XFS_SB_FEAT_INCOMPAT_SPINODES */
> + bool rmapbt; /* XFS_SB_FEAT_RO_COMPAT_RMAPBT */
> + bool reflink; /* XFS_SB_FEAT_RO_COMPAT_REFLINK */
> + bool nodalign;
> + bool nortalign;
> +};
> +
> +/*
> + * Default filesystem features and configuration values
> + *
> + * This structure contains the default mkfs values that are to be used when
> + * a user does not specify the option on the command line. We do not use these
> + * values directly - they are inputs to the mkfs geometry validation and
> + * calculations.
> + */
> +struct mkfs_default_params {
> + char *source; /* where the defaults came from */
> +
> + int sectorsize;
> + int blocksize;
Indentation ^^^ is uneven with the rest of the struct, but otherwise:
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> +
> + /* feature flags that are set */
> + struct sb_feat_args sb_feat;
> +
> + /* root inode characteristics */
> + struct fsxattr fsx;
> +};
> +
> +#endif /* _XFS_MKFS_CONFIG_H */
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index 95cd6ced13f0..217bb972538d 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -20,6 +20,7 @@
> #include <ctype.h>
> #include "xfs_multidisk.h"
> #include "libxcmd.h"
> +#include "config.h"
>
>
>
> @@ -706,39 +707,6 @@ cli_opt_set(
> opts->subopt_params[subopt].str_seen;
> }
>
> -/*
> - * Shared superblock configuration options
> - *
> - * These options provide shared configuration tunables for the filesystem
> - * superblock. There are three possible sources for these options set, each
> - * source can overriding the later source:
> - *
> - * o built-in defaults
> - * o configuration file (XXX)
> - * o command line
> - *
> - * These values are not used directly - they are inputs into the mkfs geometry
> - * validation.
> - */
> -struct sb_feat_args {
> - int log_version;
> - int attr_version;
> - int dir_version;
> - bool inode_align; /* XFS_SB_VERSION_ALIGNBIT */
> - bool nci; /* XFS_SB_VERSION_BORGBIT */
> - bool lazy_sb_counters; /* XFS_SB_VERSION2_LAZYSBCOUNTBIT */
> - bool parent_pointers; /* XFS_SB_VERSION2_PARENTBIT */
> - bool projid32bit; /* XFS_SB_VERSION2_PROJID32BIT */
> - bool crcs_enabled; /* XFS_SB_VERSION2_CRCBIT */
> - bool dirftype; /* XFS_SB_VERSION2_FTYPE */
> - bool finobt; /* XFS_SB_FEAT_RO_COMPAT_FINOBT */
> - bool spinodes; /* XFS_SB_FEAT_INCOMPAT_SPINODES */
> - bool rmapbt; /* XFS_SB_FEAT_RO_COMPAT_RMAPBT */
> - bool reflink; /* XFS_SB_FEAT_RO_COMPAT_REFLINK */
> - bool nodalign;
> - bool nortalign;
> -};
> -
> /*
> * Options configured on the command line.
> *
> @@ -850,27 +818,6 @@ struct mkfs_params {
> struct sb_feat_args sb_feat;
> };
>
> -/*
> - * Default filesystem features and configuration values
> - *
> - * This structure contains the default mkfs values that are to be used when
> - * a user does not specify the option on the command line. We do not use these
> - * values directly - they are inputs to the mkfs geometry validation and
> - * calculations.
> - */
> -struct mkfs_default_params {
> - char *source; /* where the defaults came from */
> -
> - int sectorsize;
> - int blocksize;
> -
> - /* feature flags that are set */
> - struct sb_feat_args sb_feat;
> -
> - /* root inode characteristics */
> - struct fsxattr fsx;
> -};
> -
> static void __attribute__((noreturn))
> usage( void )
> {
> --
> 2.16.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-05-25 3:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-25 3:19 [PATCH v3 0/4] xfsprogs: add mkfs.xfs configuration file parsing support Luis R. Rodriguez
2018-05-25 3:19 ` [PATCH v3 1/4] mkfs: distinguish between struct sb_feat_args and struct cli_params Luis R. Rodriguez
2018-05-25 3:34 ` Darrick J. Wong
2018-05-25 3:19 ` [PATCH v3 2/4] mkfs: move shared config structs and into their own headers Luis R. Rodriguez
2018-05-25 3:35 ` Darrick J. Wong [this message]
2018-05-25 3:38 ` Luis R. Rodriguez
2018-05-25 3:19 ` [PATCH v3 3/4] mkfs.xfs: add configuration file parsing support using our own parser Luis R. Rodriguez
2018-05-25 4:01 ` Darrick J. Wong
2018-05-25 23:33 ` Luis R. Rodriguez
2018-05-26 0:05 ` Darrick J. Wong
2018-05-25 3:19 ` [PATCH v3 4/4] debian/rules: use the new sysconfdir configuration setting Luis R. Rodriguez
2018-05-25 4:02 ` Darrick J. Wong
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=20180525033548.GQ14384@magnolia \
--to=darrick.wong@oracle.com \
--cc=jack@suse.com \
--cc=jeffm@suse.com \
--cc=jtulak@redhat.com \
--cc=linux-xfs@vger.kernel.org \
--cc=lpechacek@suse.com \
--cc=mcgrof@kernel.org \
--cc=okurz@suse.com \
--cc=sandeen@sandeen.net \
/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).