]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: improving readability
authorKarel Zak <kzak@redhat.com>
Tue, 29 Oct 2024 07:58:14 +0000 (08:58 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 29 Oct 2024 08:20:01 +0000 (09:20 +0100)
The function name mnt_optlist_is_recursive() is not accurate. It is
only used for propagation operations based on the MS_REC flag and
should not be confused with any other recursive stuff, such as
ro=recursive.

A more appropriate name for this function would be mnt_optlist_is_rpropagation().

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context.c
libmount/src/hook_idmap.c
libmount/src/mountP.h
libmount/src/optlist.c

index 96eb32d0296162937b1df4b676034fca9ba86351..565825ca5dd490622e150ccc1b60fce14af242a2 100644 (file)
@@ -1847,6 +1847,9 @@ int mnt_context_open_tree(struct libmnt_context *cxt, const char *path, unsigned
        if ((mflg & MS_BIND) && !(mflg & MS_REMOUNT)) {
                oflg |= OPEN_TREE_CLONE;
 
+               /* AT_RECURSIVE is only permitted for OPEN_TREE_CLONE (rbind).
+                * The other recursive operations are handled by
+                * mount_setattr() and are independent of open_tree() */
                if (mnt_optlist_is_rbind(cxt->optlist))
                        oflg |= AT_RECURSIVE;
        }
index 9b2425a77defd29e1249a2acf823cb995b53df87..0fa93355975020696350a612fa0cafa8fc2d1cfc 100644 (file)
@@ -303,7 +303,7 @@ static int hook_mount_post(
                .attr_set       = MOUNT_ATTR_IDMAP,
                .userns_fd      = hd->userns_fd
        };
-       const int recursive = mnt_optlist_is_recursive(cxt->optlist);
+       const int recursive = mnt_optlist_is_rpropagation(cxt->optlist);
        const char *target = mnt_fs_get_target(cxt->fs);
        int fd_tree = -1;
        int rc, is_private = 1;
index 2c1f62a8fff297431ed88e87709254345004265d..b54f6725920a45367e415aa14002d33d74915b82 100644 (file)
@@ -568,7 +568,7 @@ extern int mnt_optlist_strdup_optstr(struct libmnt_optlist *ls, char **optstr,
 extern int mnt_optlist_get_propagation(struct libmnt_optlist *ls);
 extern int mnt_optlist_is_propagation_only(struct libmnt_optlist *ls);
 extern int mnt_optlist_is_remount(struct libmnt_optlist *ls);
-extern int mnt_optlist_is_recursive(struct libmnt_optlist *ls);
+extern int mnt_optlist_is_rpropagation(struct libmnt_optlist *ls);
 extern int mnt_optlist_is_bind(struct libmnt_optlist *ls);
 extern int mnt_optlist_is_rbind(struct libmnt_optlist *ls);
 extern int mnt_optlist_is_move(struct libmnt_optlist *ls);
index 11a7eed047e070a8662be7f2fef730b0381352e8..2ba294929a731669245a15b81f6cef1bec35942e 100644 (file)
@@ -72,7 +72,7 @@ struct libmnt_optlist {
                        is_rdonly : 1,
                        is_move : 1,
                        is_silent : 1,
-                       is_recursive : 1;
+                       is_rpropagation : 1;    /* recursive propagation (rbind, rprivate, ...) */
 };
 
 struct libmnt_optlist *mnt_new_optlist(void)
@@ -203,7 +203,7 @@ int mnt_optlist_remove_opt(struct libmnt_optlist *ls, struct libmnt_opt *opt)
                        ls->is_silent = 0;
 
                if (opt->ent->id & MS_REC)
-                       ls->is_recursive = 0;
+                       ls->is_rpropagation = 0;
        }
 
        optlist_cleanup_cache(ls);
@@ -475,7 +475,7 @@ static struct libmnt_opt *optlist_new_opt(struct libmnt_optlist *ls,
                        ls->is_silent = 1;
 
                if (opt->ent->id & MS_REC) {
-                       ls->is_recursive = 1;
+                       ls->is_rpropagation = 1;
                        opt->recursive = 1;
                }
        }
@@ -1104,9 +1104,9 @@ int mnt_optlist_is_remount(struct libmnt_optlist *ls)
        return ls && ls->is_remount;
 }
 
-int mnt_optlist_is_recursive(struct libmnt_optlist *ls)
+int mnt_optlist_is_rpropagation(struct libmnt_optlist *ls)
 {
-       return ls && ls->is_recursive;
+       return ls && ls->is_rpropagation;
 }
 
 int mnt_optlist_is_move(struct libmnt_optlist *ls)