]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fstrim: rename --quite to --quite-unsupported
authorKarel Zak <kzak@redhat.com>
Tue, 31 Mar 2020 10:26:54 +0000 (12:26 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 31 Mar 2020 10:26:54 +0000 (12:26 +0200)
We use --verbose together with --quite in service files. It seems
confusing, let's make the option more descriptive.

Addresses: https://github.com/karelzak/util-linux/issues/1001
Signed-off-by: Karel Zak <kzak@redhat.com>
bash-completion/fstrim
sys-utils/fstrim.8
sys-utils/fstrim.c
sys-utils/fstrim.service.in

index 14ebf1429bc09c19778569caf2c64ce127a463ab..075c0817c63b92fb4e0ed7421c08aeb0f97575ea 100644 (file)
@@ -17,7 +17,7 @@ _fstrim_module()
                -*)
                        OPTS="--all
                                --fstab
-                               --quiet
+                               --quiet-unsupported
                                --offset
                                --length
                                --minimum
index a7adc6a03e557cec9aeee3ee434326a8a2b1de62..ef6772a962bd56ee2fc2125e36c3a9e8d1fff5de 100644 (file)
@@ -99,9 +99,10 @@ LVM setup, etc.  These reductions would not be reflected in fstrim_range.len
 .B \-\-length
 option).
 .TP
-.B \-\-quiet
-Suppress trim operation (ioctl) error messages.  This option is meant to be used in systemd service
-file or in cron scripts to hide warnings that are result of known problems,
+.B \-\-quiet\-unsupported
+Suppress error messages if trim operation (ioctl) is unsupported.  This option
+is meant to be used in systemd service file or in cron scripts to hide warnings
+that are result of known problems,
 such as NTFS driver
 reporting
 .I Bad file descriptor
index 6c84432426d3e7728422c0943a184c4b72349596..de1ef52e87eeef69ca3ef9a8f9134d6efbe86a59 100644 (file)
@@ -60,7 +60,7 @@ struct fstrim_control {
        struct fstrim_range range;
 
        unsigned int verbose : 1,
-                    quiet   : 1,
+                    quiet_unsupp : 1,
                     fstab   : 1,
                     dryrun : 1;
 };
@@ -357,7 +357,7 @@ static int fstrim_all(struct fstrim_control *ctl)
                rc = fstrim_filesystem(ctl, tgt, src);
                if (rc < 0)
                       cnt_err++;
-               else if (rc == 1 && !ctl->quiet)
+               else if (rc == 1 && !ctl->quiet_unsupp)
                        warnx(_("%s: the discard operation is not supported"), tgt);
        }
        mnt_free_iter(itr);
@@ -385,14 +385,14 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(_("Discard unused blocks on a mounted filesystem.\n"), out);
 
        fputs(USAGE_OPTIONS, out);
-       fputs(_(" -a, --all           trim all supported mounted filesystems\n"), out);
-       fputs(_(" -A, --fstab         trim all supported mounted filesystems from /etc/fstab\n"), out);
-       fputs(_(" -o, --offset <num>  the offset in bytes to start discarding from\n"), out);
-       fputs(_(" -l, --length <num>  the number of bytes to discard\n"), out);
-       fputs(_(" -m, --minimum <num> the minimum extent length to discard\n"), out);
-       fputs(_(" -v, --verbose       print number of discarded bytes\n"), out);
-       fputs(_("     --quiet         suppress trim error messages\n"), out);
-       fputs(_(" -n, --dry-run       does everything, but trim\n"), out);
+       fputs(_(" -a, --all                trim all supported mounted filesystems\n"), out);
+       fputs(_(" -A, --fstab              trim all supported mounted filesystems from /etc/fstab\n"), out);
+       fputs(_(" -o, --offset <num>       the offset in bytes to start discarding from\n"), out);
+       fputs(_(" -l, --length <num>       the number of bytes to discard\n"), out);
+       fputs(_(" -m, --minimum <num>      the minimum extent length to discard\n"), out);
+       fputs(_(" -v, --verbose            print number of discarded bytes\n"), out);
+       fputs(_("     --quiet-unsupported  suppress error messages if trim unsupported\n"), out);
+       fputs(_(" -n, --dry-run            does everything, but trim\n"), out);
 
        fputs(USAGE_SEPARATOR, out);
        printf(USAGE_HELP_OPTIONS(21));
@@ -412,7 +412,7 @@ int main(int argc, char **argv)
                        .range = { .len = ULLONG_MAX }
        };
        enum {
-               OPT_QUIET = CHAR_MAX + 1
+               OPT_QUIET_UNSUPP = CHAR_MAX + 1
        };
 
        static const struct option longopts[] = {
@@ -424,7 +424,7 @@ int main(int argc, char **argv)
            { "length",    required_argument, NULL, 'l' },
            { "minimum",   required_argument, NULL, 'm' },
            { "verbose",   no_argument,       NULL, 'v' },
-           { "quiet",     no_argument,       NULL, OPT_QUIET },
+           { "quiet-unsupported", no_argument,       NULL, OPT_QUIET_UNSUPP },
            { "dry-run",   no_argument,       NULL, 'n' },
            { NULL, 0, NULL, 0 }
        };
@@ -460,8 +460,8 @@ int main(int argc, char **argv)
                case 'v':
                        ctl.verbose = 1;
                        break;
-               case OPT_QUIET:
-                       ctl.quiet = 1;
+               case OPT_QUIET_UNSUPP:
+                       ctl.quiet_unsupp = 1;
                        break;
                case 'h':
                        usage();
@@ -490,7 +490,7 @@ int main(int argc, char **argv)
                return EXIT_FAILURE;
 
        rc = fstrim_filesystem(&ctl, path, NULL);
-       if (rc == 1 && !ctl.quiet)
+       if (rc == 1 && !ctl.quiet_unsupp)
                warnx(_("%s: the discard operation is not supported"), path);
 
        return rc == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
index b58728ef4cad3899735f4269a6f838e9d18f1091..bf8d3645e44817e2771c55e34e3cf6b63416f521 100644 (file)
@@ -5,7 +5,7 @@ ConditionVirtualization=!container
 
 [Service]
 Type=oneshot
-ExecStart=@sbindir@/fstrim --fstab --verbose --quiet
+ExecStart=@sbindir@/fstrim --fstab --verbose --quiet-unsupported
 PrivateDevices=no
 PrivateNetwork=yes
 PrivateUsers=no