]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: (optlist) add is_silent shortcut
authorKarel Zak <kzak@redhat.com>
Tue, 23 Aug 2022 11:18:54 +0000 (13:18 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 3 Jan 2023 11:58:42 +0000 (12:58 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/mountP.h
libmount/src/optlist.c

index 5365ef84f52c7edfa94adcd7efd33166107c8d65..95a5d10bb55f48ecb144692b4dd36736f9fe8608 100644 (file)
@@ -536,6 +536,7 @@ extern int mnt_optlist_is_remount(struct libmnt_optlist *ls);
 extern int mnt_optlist_is_bind(struct libmnt_optlist *ls);
 extern int mnt_optlist_is_move(struct libmnt_optlist *ls);
 extern int mnt_optlist_is_rdonly(struct libmnt_optlist *ls);
+extern int mnt_optlist_is_silent(struct libmnt_optlist *ls);
 
 extern int mnt_optlist_merge_opts(struct libmnt_optlist *ls);
 
index b6e7e5cd8f9d1ae9f07e7ea464a1a33a9264a885..b3cc90c334bd8492fdb5ba6aa9880c0aa5ddf98c 100644 (file)
@@ -55,7 +55,8 @@ struct libmnt_optlist {
                        is_remount : 1,
                        is_bind : 1,
                        is_rdonly : 1,
-                       is_move : 1;
+                       is_move : 1,
+                       is_silent : 1;
 };
 
 struct libmnt_optlist *mnt_new_optlist(void)
@@ -181,6 +182,8 @@ int mnt_optlist_remove_opt(struct libmnt_optlist *ls, struct libmnt_opt *opt)
                        ls->is_rdonly = 0;
                else if (opt->ent->id == MS_MOVE)
                        ls->is_move = 0;
+               else if (opt->ent->id == MS_SILENT)
+                       ls->is_silent = 0;
        }
 
        optlist_cleanup_cache(ls, opt->map);
@@ -365,6 +368,7 @@ static struct libmnt_opt *optlist_new_opt(struct libmnt_optlist *ls,
        else
                list_add_tail(&opt->opts, &ls->opts);
 
+       /* shortcuts */
        if (map && ent && map == ls->linux_map) {
                if (ent->id & MS_PROPAGATION)
                        ls->propagation |= ent->id;
@@ -376,6 +380,8 @@ static struct libmnt_opt *optlist_new_opt(struct libmnt_optlist *ls,
                        ls->is_rdonly = 1;
                else if (opt->ent->id == MS_MOVE)
                        ls->is_move = 1;
+               else if (opt->ent->id == MS_SILENT)
+                       ls->is_silent = 1;
        }
 
        if (ent && map) {
@@ -805,6 +811,11 @@ int mnt_optlist_is_rdonly(struct libmnt_optlist *ls)
        return ls && ls->is_rdonly;
 }
 
+int mnt_optlist_is_silent(struct libmnt_optlist *ls)
+{
+       return ls && ls->is_silent;
+}
+
 
 int mnt_opt_has_value(struct libmnt_opt *opt)
 {