This patch makes no functional changes. Struct initializers that
use C89 or GCC-only syntax are updated to C99 syntax. Variables of
type struct option are renamed to long_opts for consistency.
C89 positional initializers require values to be placed in the
correct order. This will cause errors if the fields of the struct
definition are reordered or fields are added or removed. C99 named
initializers avoid this problem, and also automatically clear any
values that are not explicitly set.
This patch updates lfs_changelog_clear() to use the C99 syntax.
Test-Parameters: trivial
Signed-off-by: Steve Guminski <stephenx.guminski@intel.com>
Change-Id: Ib9847af80b7eb76bf81b9692baa5c6deb4cdad85
Reviewed-on: https://review.whamcloud.com/27523
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
static int lfs_fid2path(int argc, char **argv)
{
static int lfs_fid2path(int argc, char **argv)
{
- struct option long_opts[] = {
- {"cur", no_argument, 0, 'c'},
- {"link", required_argument, 0, 'l'},
- {"rec", required_argument, 0, 'r'},
- {0, 0, 0, 0}
- };
- char short_opts[] = "cl:r:";
- char *device, *fid, *path;
- long long recno = -1;
- int linkno = -1;
- int lnktmp;
- int printcur = 0;
+ struct option long_opts[] = {
+ { .val = 'c', .name = "cur", .has_arg = no_argument },
+ { .val = 'l', .name = "link", .has_arg = required_argument },
+ { .val = 'r', .name = "rec", .has_arg = required_argument },
+ { .name = NULL } };
+ char short_opts[] = "cl:r:";
+ char *device, *fid, *path;
+ long long recno = -1;
+ int linkno = -1;
+ int lnktmp;
+ int printcur = 0;
- while ((rc = getopt_long(argc, argv, short_opts,
- long_opts, NULL)) != -1) {
+ while ((rc = getopt_long(argc, argv, short_opts,
+ long_opts, NULL)) != -1) {
switch (rc) {
case 'c':
printcur++;
switch (rc) {
case 'c':
printcur++;