From: Karel Zak Date: Tue, 18 Oct 2022 09:38:45 +0000 (+0200) Subject: libmount: add inline function to access API file descritors X-Git-Tag: v2.39-rc1~234 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=1d53aed42c27a1fa1897b20a0f635d6622dd34ac;p=thirdparty%2Futil-linux.git libmount: add inline function to access API file descritors Signed-off-by: Karel Zak --- diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c index fced20b41d..397a2aa330 100644 --- a/libmount/src/hook_mount.c +++ b/libmount/src/hook_mount.c @@ -48,6 +48,8 @@ #ifdef UL_HAVE_MOUNT_API +#define get_sysapi(_cxt) mnt_context_get_sysapi(_cxt) + #define set_syscall_status(_cxt, _name, _x) __extension__ ({ \ if (!(_x)) { \ DBG(HOOK, ul_debug("syscall '%s' [%m]", _name)); \ @@ -113,11 +115,6 @@ static int hookset_deinit(struct libmnt_context *cxt, const struct libmnt_hookse return 0; } -static inline struct libmnt_sysapi *get_sysapi(struct libmnt_context *cxt, - const struct libmnt_hookset *hs) -{ - return mnt_context_get_hookset_data(cxt, hs); -} static int configure_superblock(struct libmnt_context *cxt, const struct libmnt_hookset *hs, int fd) @@ -221,7 +218,7 @@ static int hook_create_mount(struct libmnt_context *cxt, assert(cxt); assert(cxt->fs); - api = get_sysapi(cxt, hs); + api = get_sysapi(cxt); assert(api); if (api->fd_fs < 0) { @@ -285,7 +282,7 @@ static int hook_reconfigure_mount(struct libmnt_context *cxt, assert(cxt); - api = get_sysapi(cxt, hs); + api = get_sysapi(cxt); assert(api); assert(api->fd_tree >= 0); @@ -320,7 +317,7 @@ static int hook_set_vfsflags(struct libmnt_context *cxt, DBG(HOOK, ul_debugobj(hs, "setting VFS flags")); - api = get_sysapi(cxt, hs); + api = get_sysapi(cxt); assert(api); /* fallback only; necessary when init_sysapi() during preparation @@ -373,7 +370,7 @@ static int hook_set_propagation(struct libmnt_context *cxt, if (!ol) return -ENOMEM; - api = get_sysapi(cxt, hs); + api = get_sysapi(cxt); assert(api); /* fallback only; necessary when init_sysapi() during preparation @@ -429,7 +426,7 @@ static int hook_attach_target(struct libmnt_context *cxt, if (!target) return -EINVAL; - api = get_sysapi(cxt, hs); + api = get_sysapi(cxt); assert(api); assert(api->fd_tree >= 0); diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h index e6ac6b6651..1c7f579aca 100644 --- a/libmount/src/mountP.h +++ b/libmount/src/mountP.h @@ -633,6 +633,11 @@ struct libmnt_sysapi { int fd_fs; /* FD from fsopen() or fspick() */ int fd_tree; /* FD from fsmount() or open_tree() */ }; + +static inline struct libmnt_sysapi *mnt_context_get_sysapi(struct libmnt_context *cxt) +{ + return mnt_context_get_hookset_data(cxt, &hookset_mount); +} #endif #endif /* _LIBMOUNT_PRIVATE_H */