]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sfdisk: disambiguate units of --show-size
authorChris Morin <chris.morin2@gmail.com>
Fri, 19 May 2017 00:07:19 +0000 (20:07 -0400)
committerKarel Zak <kzak@redhat.com>
Mon, 22 May 2017 09:29:10 +0000 (11:29 +0200)
[kzak@redhat.com: - use optutils.h]

Signed-off-by: Chris Morin <chris.morin2@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/sfdisk.8
disk-utils/sfdisk.c

index b67befc44fc35756d5af78b776801831a2ac3f76..5266ca744e2c822f72eb1005f52447ebaf26f6e0 100644 (file)
@@ -132,7 +132,9 @@ then print the current partition UUID.
 Renumber the partitions, ordering them by their start offset.
 .TP
 .BR \-s , " \-\-show\-size " [ \fIdevice ...]
-List the sizes of all or the specified devices.
+List the sizes of all or the specified devices in units of 1024 byte size.
+This command is DEPRECATED in favour of
+.BR blockdev (1).
 .TP
 .BR \-T , " \-\-list\-types"
 Print all supported types for the current disk label or the label specified by
@@ -219,7 +221,8 @@ specified in the format \fI+list\fP (e.g. \fB-o +UUID\fP).
 Suppress extra info messages.
 .TP
 .BR \-u , " \-\-unit S"
-Deprecated option.  Only the sector unit is supported.
+Deprecated option.  Only the sector unit is supported. This option is not
+supported when using the --show-size command.
 .TP
 .BR \-X , " \-\-label " \fItype
 Specify the disk label type (e.g. \fBdos\fR, \fBgpt\fR, ...).  If this option
index fe85c26abef1bee02c70fb3555fc7d332b56bcfb..2ac8cef0222c3aaefd80d77e09be8cc902c235c0 100644 (file)
@@ -49,6 +49,7 @@
 #include "all-io.h"
 #include "rpmatch.h"
 #include "loopdev.h"
+#include "optutils.h"
 
 #include "libfdisk.h"
 #include "fdisk-list.h"
@@ -1961,7 +1962,6 @@ int main(int argc, char *argv[])
                { "output",  required_argument, NULL, 'o' },
                { "partno",  required_argument, NULL, 'N' },
                { "reorder", no_argument,       NULL, 'r' },
-               { "show-size", no_argument,     NULL, 's' },
                { "show-geometry", no_argument, NULL, 'g' },
                { "quiet",   no_argument,       NULL, 'q' },
                { "verify",  no_argument,       NULL, 'V' },
@@ -1975,8 +1975,9 @@ int main(int argc, char *argv[])
                { "part-attrs", no_argument,    NULL, OPT_PARTATTRS },
 
                { "show-pt-geometry", no_argument, NULL, 'G' },         /* deprecated */
-               { "unit",    required_argument, NULL, 'u' },
+               { "unit",    required_argument, NULL, 'u' },            /* deprecated */
                { "Linux",   no_argument,       NULL, 'L' },            /* deprecated */
+               { "show-size", no_argument,     NULL, 's' },            /* deprecated */
 
                { "change-id",no_argument,      NULL, OPT_CHANGE_ID },  /* deprecated */
                { "id",      no_argument,       NULL, 'c' },            /* deprecated */
@@ -1984,6 +1985,12 @@ int main(int argc, char *argv[])
 
                { NULL, 0, NULL, 0 },
        };
+       static const ul_excl_t excl[] = {       /* rows and cols in ASCII order */
+               { 's','u'},                     /* --show-size --unit */
+               { 0 }
+       };
+       int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
+
 
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
@@ -1992,6 +1999,9 @@ int main(int argc, char *argv[])
 
        while ((c = getopt_long(argc, argv, "aAbcdfFgGhJlLo:O:nN:qrsTu:vVX:Y:w:W:",
                                        longopts, &longidx)) != -1) {
+
+               err_exclusive_options(c, longopts, excl, excl_st);
+
                switch(c) {
                case 'A':
                        sf->act = ACT_ACTIVATE;