From 6f385414b27e929bd14435ea8342cde4bae0ef8d Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Fri, 17 Mar 2006 15:05:40 +0000 Subject: fix --- lib/mount.c | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) (limited to 'lib/mount.c') diff --git a/lib/mount.c b/lib/mount.c index 5c568e9..045a4a6 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -6,9 +6,8 @@ See the file COPYING.LIB. */ -#include "fuse.h" +#include "fuse_i.h" #include "fuse_opt.h" -#include "fuse_compat.h" #include #include @@ -167,28 +166,26 @@ static int receive_fd(int fd) return *(int*)CMSG_DATA(cmsg); } -void fuse_unmount_compat22(const char *mountpoint) -{ - fuse_unmount(mountpoint, -1); -} - -void fuse_unmount(const char *mountpoint, int fd) +void fuse_kern_unmount(const char *mountpoint, int fd) { const char *mountprog = FUSERMOUNT_PROG; - struct pollfd pfd; - int res; int pid; if (!mountpoint) return; - pfd.fd = fd; - pfd.events = 0; - res = poll(&pfd, 1, 0); - /* If file poll returns POLLERR on the device file descriptor, - then the filesystem is already unmounted */ - if (res == 1 && (pfd.revents & POLLERR)) - return; + if (fd != -1) { + int res; + struct pollfd pfd; + + pfd.fd = fd; + pfd.events = 0; + res = poll(&pfd, 1, 0); + /* If file poll returns POLLERR on the device file descriptor, + then the filesystem is already unmounted */ + if (res == 1 && (pfd.revents & POLLERR)) + return; + } #ifdef HAVE_FORK pid = fork(); @@ -216,6 +213,11 @@ void fuse_unmount(const char *mountpoint, int fd) waitpid(pid, NULL, 0); } +void fuse_unmount_compat22(const char *mountpoint) +{ + fuse_kern_unmount(mountpoint, -1); +} + int fuse_mount_compat22(const char *mountpoint, const char *opts) { const char *mountprog = FUSERMOUNT_PROG; @@ -277,7 +279,7 @@ int fuse_mount_compat22(const char *mountpoint, const char *opts) return rv; } -int fuse_mount(const char *mountpoint, struct fuse_args *args) +int fuse_kern_mount(const char *mountpoint, struct fuse_args *args) { struct mount_opts mo; int res = -1; @@ -301,12 +303,5 @@ int fuse_mount(const char *mountpoint, struct fuse_args *args) return res; } -int fuse_mount_compat1(const char *mountpoint, const char *args[]) -{ - /* just ignore mount args for now */ - (void) args; - return fuse_mount_compat22(mountpoint, NULL); -} - __asm__(".symver fuse_mount_compat22,fuse_mount@FUSE_2.2"); __asm__(".symver fuse_unmount_compat22,fuse_unmount@FUSE_2.2"); -- cgit v1.2.3