diff options
| author | Christian Brauner <brauner@kernel.org> | 2025-02-21 14:13:01 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-03-04 09:29:52 +0100 |
| commit | 2f576220cd8129a303ef4bac4b08e3937c42eff8 (patch) | |
| tree | 1558f134d87138864e402ad6085a2287a735f5bb /fs/mount.h | |
| parent | 3b0cdba4da55188b8ae49430f2730fade56b43ae (diff) | |
fs: add mnt_ns_empty() helper
Add a helper that checks whether a give mount namespace is empty instead
of open-coding the specific data structure check. This also be will be
used in follow-up patches.
Link: https://lore.kernel.org/r/20250221-brauner-open_tree-v1-2-dbcfcb98c676@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/mount.h')
| -rw-r--r-- | fs/mount.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/mount.h b/fs/mount.h index 820a79f1f735..e2501a724688 100644 --- a/fs/mount.h +++ b/fs/mount.h @@ -157,6 +157,11 @@ static inline bool mnt_ns_attached(const struct mount *mnt) return !RB_EMPTY_NODE(&mnt->mnt_node); } +static inline bool mnt_ns_empty(const struct mnt_namespace *ns) +{ + return RB_EMPTY_ROOT(&ns->mounts); +} + static inline void move_from_ns(struct mount *mnt, struct list_head *dt_list) { struct mnt_namespace *ns = mnt->mnt_ns; |