From: Bernd Schubert This is to allow fusermount to use the code from mount_fsmount.c. I.e. avoid code dup and add just re-use the new linux api mount functions from that file for fusermount. Signed-off-by: Bernd Schubert --- lib/mount.c | 7 ------- lib/mount_common_i.h | 2 -- lib/mount_i_linux.h | 4 ++-- lib/mount_util.c | 10 ++++++++++ lib/mount_util.h | 5 +++++ 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/mount.c b/lib/mount.c index f19817e2675713e988bb91fc658c52b36468462b..408e9d36896048fc167e264c95b6f6e31d86679f 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -713,13 +713,6 @@ out: return res; } -const char *fuse_mnt_get_devname(void) -{ - const char *devname = getenv(FUSE_KERN_DEVICE_ENV); - - return devname ? devname : "/dev/fuse"; -} - char *fuse_mnt_build_source(const struct mount_opts *mo) { const char *devname = fuse_mnt_get_devname(); diff --git a/lib/mount_common_i.h b/lib/mount_common_i.h index 34f0f9893918a14c83a57a3212f80cfc96ed2e6d..fc9ab443cc0cf6cf8438dd2ca486f6e37c8704e6 100644 --- a/lib/mount_common_i.h +++ b/lib/mount_common_i.h @@ -24,8 +24,6 @@ struct mount_opts; struct mount_opts *parse_mount_opts(struct fuse_args *args); void destroy_mount_opts(struct mount_opts *mo); unsigned int get_max_read(struct mount_opts *o); -char *fuse_mnt_build_source(const struct mount_opts *mo); -char *fuse_mnt_build_type(const struct mount_opts *mo); #endif /* FUSE_MOUNT_COMMON_I_H_ */ diff --git a/lib/mount_i_linux.h b/lib/mount_i_linux.h index 34c7386715155e8640cac68c218a1e1062990ce6..597b380076fccc1d38fd4d0b9108fc92a1adfa62 100644 --- a/lib/mount_i_linux.h +++ b/lib/mount_i_linux.h @@ -41,6 +41,6 @@ int fuse_kern_fsmount(const char *mnt, unsigned long flags, int blkdev, int fuse_kern_fsmount_mo(const char *mnt, struct mount_opts *mo, const char *mnt_opts); -int fuse_kern_fsmount_mo(const char *mnt, struct mount_opts *mo, - const char *mnt_opts); +char *fuse_mnt_build_source(const struct mount_opts *mo); +char *fuse_mnt_build_type(const struct mount_opts *mo); #endif /* FUSE_MOUNT_I_LINUX_H_ */ diff --git a/lib/mount_util.c b/lib/mount_util.c index 9ff711023fcb41fe24f1de21aaf811cb1c12d25e..b6b75e60874ae9b2ec0c96f2a62b4ec1943a2a00 100644 --- a/lib/mount_util.c +++ b/lib/mount_util.c @@ -10,6 +10,9 @@ #include "fuse_config.h" #include "mount_util.h" +#ifdef __linux__ +#include "mount_i_linux.h" +#endif #include #include @@ -451,3 +454,10 @@ int fuse_mnt_add_mount_helper(const char *mnt, const char *source, (void)mnt_opts; return 0; } + +const char *fuse_mnt_get_devname(void) +{ + const char *devname = getenv(FUSE_KERN_DEVICE_ENV); + + return devname ? devname : "/dev/fuse"; +} diff --git a/lib/mount_util.h b/lib/mount_util.h index e62052b626875abd6118b845de162d6c5c41857a..b83db556d5fdb4bd8dd5e1750c8d11faf7373d82 100644 --- a/lib/mount_util.h +++ b/lib/mount_util.h @@ -6,6 +6,9 @@ See the file LGPL2.txt. */ +#ifndef FUSE_MOUNT_UTIL_H_ +#define FUSE_MOUNT_UTIL_H_ + #include #include "mount_common_i.h" // IWYU pragma: keep @@ -31,3 +34,5 @@ int fuse_mnt_parse_fuse_fd(const char *mountpoint); const char *fuse_mnt_get_devname(void); int fuse_mnt_add_mount_helper(const char *mnt, const char *source, const char *type, const char *mnt_opts); + +#endif /* FUSE_MOUNT_UTIL_H_ */ -- 2.43.0