sfdisk: cleanup option names
Rename options to --part-{label,uuid,type} to be compatible with another tools (like lsblk, parts, etc). Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
351fad5069
commit
e36fb07af6
|
@ -55,10 +55,6 @@ addressed by \fIpartno\fR.
|
||||||
Switch on the bootable flag. If \fIpartno\fR no specified then lists all partitions
|
Switch on the bootable flag. If \fIpartno\fR no specified then lists all partitions
|
||||||
with enabled flag.
|
with enabled flag.
|
||||||
.TP
|
.TP
|
||||||
.BR \-c , " \-\-type " \fIdevice\fR " " \fIpartno\fR " "[\fItype\fR]
|
|
||||||
Change partition type. If \fItype\fR no specified then print the current
|
|
||||||
partition type. The argument \fItype\fR is hex for MBR or GUID for GPT.
|
|
||||||
.TP
|
|
||||||
.BR \-d , " \-\-dump " \fIdevice\fR
|
.BR \-d , " \-\-dump " \fIdevice\fR
|
||||||
Dump the partitions of a device in a format that is usable as input to sfdisk.
|
Dump the partitions of a device in a format that is usable as input to sfdisk.
|
||||||
See the section "BACKUP PARTITION TABLE".
|
See the section "BACKUP PARTITION TABLE".
|
||||||
|
@ -70,21 +66,25 @@ List geometry of all or specified devices.
|
||||||
List partitions of all or specified devices. This command can be used
|
List partitions of all or specified devices. This command can be used
|
||||||
together with \fB\-\-verify\fR.
|
together with \fB\-\-verify\fR.
|
||||||
.TP
|
.TP
|
||||||
|
.BR \-\-part\-label " " \fIdevice\fR " " \fIpartno\fR " "[\fIlabel\fR]
|
||||||
|
Change GPT partition name (label). If \fIlabel\fR no specified then print the current
|
||||||
|
partition label.
|
||||||
|
.TP
|
||||||
|
.BR \-\-part-type " " \fIdevice\fR " " \fIpartno\fR " "[\fItype\fR]
|
||||||
|
Change partition type. If \fItype\fR no specified then print the current
|
||||||
|
partition type. The argument \fItype\fR is hex for MBR or GUID for GPT.
|
||||||
|
For backward compatibility the option -c, --id has the same meaning.
|
||||||
|
.TP
|
||||||
|
.BR \-\-part\-uuid " " \fIdevice\fR " " \fIpartno\fR " "[\fIuuid\fR]
|
||||||
|
Change GPT partition UUID. If \fIuuid\fR no specified then print the current
|
||||||
|
partition UUID.
|
||||||
|
.TP
|
||||||
.BR \-s , " \-\-show-size " [\fIdevice\fR ...]
|
.BR \-s , " \-\-show-size " [\fIdevice\fR ...]
|
||||||
List sizes of all or specified devices.
|
List sizes of all or specified devices.
|
||||||
.TP
|
.TP
|
||||||
.BR \-T , " \-\-list-types
|
.BR \-T , " \-\-list-types
|
||||||
Print all supported types for the current disk label or label specified by
|
Print all supported types for the current disk label or label specified by
|
||||||
\fB\-\-label\fR.
|
\fB\-\-label\fR.
|
||||||
.TP
|
|
||||||
.BR \-U , " \-\-uuid " \fIdevice\fR " " \fIpartno\fR " "[\fIuuid\fR]
|
|
||||||
Change GPT partition UUID. If \fIuuid\fR no specified then print the current
|
|
||||||
partition UUID.
|
|
||||||
.TP
|
|
||||||
.BR \-\-name " " \fIdevice\fR " " \fIpartno\fR " "[\fIname\fR]
|
|
||||||
Change GPT partition name (label). If \fIname\fR no specified then print the current
|
|
||||||
partition name.
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR \-V , " \-\-verify
|
.BR \-V , " \-\-verify
|
||||||
Test whether partition table and partitions seem correct.
|
Test whether partition table and partitions seem correct.
|
||||||
|
|
|
@ -71,7 +71,7 @@ enum {
|
||||||
ACT_VERIFY,
|
ACT_VERIFY,
|
||||||
ACT_PARTTYPE,
|
ACT_PARTTYPE,
|
||||||
ACT_PARTUUID,
|
ACT_PARTUUID,
|
||||||
ACT_PARTNAME,
|
ACT_PARTLABEL,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sfdisk {
|
struct sfdisk {
|
||||||
|
@ -646,7 +646,7 @@ static void assign_device_partition(struct sfdisk *sf,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sfdisk --type <device> <partno> [<type>]
|
* sfdisk --part-type <device> <partno> [<type>]
|
||||||
*/
|
*/
|
||||||
static int command_parttype(struct sfdisk *sf, int argc, char **argv)
|
static int command_parttype(struct sfdisk *sf, int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -711,7 +711,7 @@ static int command_parttype(struct sfdisk *sf, int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sfdisk --uuid <device> <partno> [<uuid>]
|
* sfdisk --part-uuid <device> <partno> [<uuid>]
|
||||||
*/
|
*/
|
||||||
static int command_partuuid(struct sfdisk *sf, int argc, char **argv)
|
static int command_partuuid(struct sfdisk *sf, int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -766,9 +766,9 @@ static int command_partuuid(struct sfdisk *sf, int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sfdisk --name <device> <partno> [<name>]
|
* sfdisk --part-label <device> <partno> [<label>]
|
||||||
*/
|
*/
|
||||||
static int command_partname(struct sfdisk *sf, int argc, char **argv)
|
static int command_partlabel(struct sfdisk *sf, int argc, char **argv)
|
||||||
{
|
{
|
||||||
size_t partno;
|
size_t partno;
|
||||||
struct fdisk_partition *pa = NULL;
|
struct fdisk_partition *pa = NULL;
|
||||||
|
@ -1229,16 +1229,18 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
|
||||||
|
|
||||||
fputs(_("\nCommands:\n"), out);
|
fputs(_("\nCommands:\n"), out);
|
||||||
fputs(_(" -a, --activate <dev> [<part> ...] list or set bootable MBR partitions\n"), out);
|
fputs(_(" -a, --activate <dev> [<part> ...] list or set bootable MBR partitions\n"), out);
|
||||||
fputs(_(" -c, --type <dev> <part> [<type>] print or change partition type\n"), out);
|
|
||||||
fputs(_(" -d, --dump <dev> dump partition table (usable for later input)\n"), out);
|
fputs(_(" -d, --dump <dev> dump partition table (usable for later input)\n"), out);
|
||||||
fputs(_(" -g, --show-geometry [<dev> ...] list geometry of all or specified devices\n"), out);
|
fputs(_(" -g, --show-geometry [<dev> ...] list geometry of all or specified devices\n"), out);
|
||||||
fputs(_(" -l, --list [<dev> ...] list partitions of each device\n"), out);
|
fputs(_(" -l, --list [<dev> ...] list partitions of each device\n"), out);
|
||||||
fputs(_(" --name <dev> <part> [<name>] print or change partition name\n"), out);
|
|
||||||
fputs(_(" -s, --show-size [<dev> ...] list sizes of all or specified devices\n"), out);
|
fputs(_(" -s, --show-size [<dev> ...] list sizes of all or specified devices\n"), out);
|
||||||
fputs(_(" -T, --list-types print the recognized types (see -X)\n"), out);
|
fputs(_(" -T, --list-types print the recognized types (see -X)\n"), out);
|
||||||
fputs(_(" -U, --uuid <dev> <part> [<uuid>] print or change partition uuid\n"), out);
|
|
||||||
fputs(_(" -V, --verify test whether partitions seem correct\n"), out);
|
fputs(_(" -V, --verify test whether partitions seem correct\n"), out);
|
||||||
|
|
||||||
|
fputs(USAGE_SEPARATOR, out);
|
||||||
|
fputs(_(" --part-label <dev> <part> [<str>] print or change partition label\n"), out);
|
||||||
|
fputs(_(" --part-type <dev> <part> [<type>] print or change partition type\n"), out);
|
||||||
|
fputs(_(" --part-uuid <dev> <part> [<uuid>] print or change partition uuid\n"), out);
|
||||||
|
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
fputs(_(" <dev> device (usually disk) path\n"), out);
|
fputs(_(" <dev> device (usually disk) path\n"), out);
|
||||||
fputs(_(" <part> partition number\n"), out);
|
fputs(_(" <part> partition number\n"), out);
|
||||||
|
@ -1279,7 +1281,9 @@ int main(int argc, char *argv[])
|
||||||
OPT_PRINT_ID,
|
OPT_PRINT_ID,
|
||||||
OPT_ID,
|
OPT_ID,
|
||||||
OPT_NOREREAD,
|
OPT_NOREREAD,
|
||||||
OPT_PARTNAME
|
OPT_PARTUUID,
|
||||||
|
OPT_PARTLABEL,
|
||||||
|
OPT_PARTTYPE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
|
@ -1301,15 +1305,16 @@ int main(int argc, char *argv[])
|
||||||
{ "quiet", no_argument, NULL, 'q' },
|
{ "quiet", no_argument, NULL, 'q' },
|
||||||
{ "verify", no_argument, NULL, 'V' },
|
{ "verify", no_argument, NULL, 'V' },
|
||||||
{ "version", no_argument, NULL, 'v' },
|
{ "version", no_argument, NULL, 'v' },
|
||||||
{ "uuid", no_argument, NULL, 'U' },
|
|
||||||
{ "name", no_argument, NULL, OPT_PARTNAME },
|
{ "part-uuid", no_argument, NULL, OPT_PARTUUID },
|
||||||
|
{ "part-label", no_argument, NULL, OPT_PARTLABEL },
|
||||||
|
{ "part-type", no_argument, NULL, OPT_PARTTYPE },
|
||||||
|
|
||||||
{ "unit", required_argument, NULL, 'u' }, /* deprecated */
|
{ "unit", required_argument, NULL, 'u' }, /* deprecated */
|
||||||
{ "Linux", no_argument, NULL, 'L' }, /* deprecated */
|
{ "Linux", no_argument, NULL, 'L' }, /* deprecated */
|
||||||
|
|
||||||
{ "type", no_argument, NULL, 'c' }, /* wanted */
|
|
||||||
{ "change-id",no_argument, NULL, OPT_CHANGE_ID }, /* deprecated */
|
{ "change-id",no_argument, NULL, OPT_CHANGE_ID }, /* deprecated */
|
||||||
{ "id", no_argument, NULL, OPT_ID }, /* deprecated */
|
{ "id", no_argument, NULL, 'c' }, /* deprecated */
|
||||||
{ "print-id",no_argument, NULL, OPT_PRINT_ID }, /* deprecated */
|
{ "print-id",no_argument, NULL, OPT_PRINT_ID }, /* deprecated */
|
||||||
|
|
||||||
{ NULL, 0, 0, 0 },
|
{ NULL, 0, 0, 0 },
|
||||||
|
@ -1320,7 +1325,7 @@ int main(int argc, char *argv[])
|
||||||
textdomain(PACKAGE);
|
textdomain(PACKAGE);
|
||||||
atexit(close_stdout);
|
atexit(close_stdout);
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "aAdfhglLO:nN:qsTiu:UvVX:",
|
while ((c = getopt_long(argc, argv, "aAbcdfghlLO:nN:qsTu:vVX:",
|
||||||
longopts, &longidx)) != -1) {
|
longopts, &longidx)) != -1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'a':
|
case 'a':
|
||||||
|
@ -1335,15 +1340,22 @@ int main(int argc, char *argv[])
|
||||||
case OPT_CHANGE_ID:
|
case OPT_CHANGE_ID:
|
||||||
case OPT_PRINT_ID:
|
case OPT_PRINT_ID:
|
||||||
case OPT_ID:
|
case OPT_ID:
|
||||||
warnx(_("%s is deprecated in favour of --type"),
|
warnx(_("%s is deprecated in favour of ---part-type"),
|
||||||
longopts[longidx].name);
|
longopts[longidx].name);
|
||||||
/* fallthrough */
|
|
||||||
case 'c':
|
|
||||||
sf->act = ACT_PARTTYPE;
|
sf->act = ACT_PARTTYPE;
|
||||||
|
case 'c':
|
||||||
|
warnx(_("--id s deprecated in favour of ---part-type"));
|
||||||
|
sf->act = ACT_PARTTYPE;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
sf->act = ACT_DUMP;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
sf->force = 1;
|
sf->force = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'g':
|
||||||
|
sf->act = ACT_SHOW_GEOM;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(stdout);
|
usage(stdout);
|
||||||
break;
|
break;
|
||||||
|
@ -1351,18 +1363,12 @@ int main(int argc, char *argv[])
|
||||||
sf->act = ACT_LIST;
|
sf->act = ACT_LIST;
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
warnx(_("--Linux option is deprecated and unnecessary"));
|
warnx(_("--Linux option is unnecessary and deprecated"));
|
||||||
break;
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
sf->backup = 1;
|
sf->backup = 1;
|
||||||
sf->backup_file = optarg;
|
sf->backup_file = optarg;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
|
||||||
sf->act = ACT_DUMP;
|
|
||||||
break;
|
|
||||||
case 'g':
|
|
||||||
sf->act = ACT_SHOW_GEOM;
|
|
||||||
break;
|
|
||||||
case 'n':
|
case 'n':
|
||||||
sf->noact = 1;
|
sf->noact = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1372,18 +1378,12 @@ int main(int argc, char *argv[])
|
||||||
case 'q':
|
case 'q':
|
||||||
sf->quiet = 1;
|
sf->quiet = 1;
|
||||||
break;
|
break;
|
||||||
case 'X':
|
|
||||||
sf->label = optarg;
|
|
||||||
break;
|
|
||||||
case 's':
|
case 's':
|
||||||
sf->act = ACT_SHOW_SIZE;
|
sf->act = ACT_SHOW_SIZE;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
sf->act = ACT_LIST_TYPES;
|
sf->act = ACT_LIST_TYPES;
|
||||||
break;
|
break;
|
||||||
case 'U':
|
|
||||||
sf->act = ACT_PARTUUID;
|
|
||||||
break;
|
|
||||||
case 'u':
|
case 'u':
|
||||||
/* deprecated */
|
/* deprecated */
|
||||||
warnx(_("--unit option is deprecated, only sectors are supported"));
|
warnx(_("--unit option is deprecated, only sectors are supported"));
|
||||||
|
@ -1397,12 +1397,23 @@ int main(int argc, char *argv[])
|
||||||
case 'V':
|
case 'V':
|
||||||
sf->verify = 1;
|
sf->verify = 1;
|
||||||
break;
|
break;
|
||||||
case OPT_PARTNAME:
|
case 'X':
|
||||||
sf->act = ACT_PARTNAME;
|
sf->label = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OPT_PARTUUID:
|
||||||
|
sf->act = ACT_PARTUUID;
|
||||||
|
break;
|
||||||
|
case OPT_PARTTYPE:
|
||||||
|
sf->act = ACT_PARTTYPE;
|
||||||
|
break;
|
||||||
|
case OPT_PARTLABEL:
|
||||||
|
sf->act = ACT_PARTLABEL;
|
||||||
break;
|
break;
|
||||||
case OPT_NOREREAD:
|
case OPT_NOREREAD:
|
||||||
sf->noreread = 1;
|
sf->noreread = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
usage(stderr);
|
usage(stderr);
|
||||||
}
|
}
|
||||||
|
@ -1456,8 +1467,8 @@ int main(int argc, char *argv[])
|
||||||
rc = command_partuuid(sf, argc - optind, argv + optind);
|
rc = command_partuuid(sf, argc - optind, argv + optind);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACT_PARTNAME:
|
case ACT_PARTLABEL:
|
||||||
rc = command_partname(sf, argc - optind, argv + optind);
|
rc = command_partlabel(sf, argc - optind, argv + optind);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue