fuse: add some patches and a default config from fedora

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-07-05 12:46:36 +02:00
parent e62911e535
commit 5e72e3f34a
5 changed files with 202 additions and 0 deletions

View File

@ -0,0 +1,2 @@
# mount_max = 1000
# user_allow_other

View File

@ -22,6 +22,9 @@
. config/options $1
mkdir -p $INSTALL/etc
cp $PKG_DIR/config/fuse.conf $INSTALL/etc
mkdir -p $INSTALL/lib/udev/rules.d
cp $PKG_BUILD/util/udev.rules $INSTALL/lib/udev/rules.d/99-fuse.rules

View File

@ -0,0 +1,20 @@
From ba47031f3557b81e732d41593c95e7b984b54b78 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 9 Aug 2010 12:09:00 +0400
Subject: [PATCH 1/3] Fix udev rules (Fedora-specific)
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
util/udev.rules | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/util/udev.rules b/util/udev.rules
index 9585111..bb8033f 100644
--- a/util/udev.rules
+++ b/util/udev.rules
@@ -1 +1 @@
-KERNEL=="fuse", MODE="0666"
+KERNEL=="fuse", MODE="0666",OWNER="root",GROUP="root"
--
1.7.3.1

View File

@ -0,0 +1,52 @@
From 459c84a3e5fda1ef7f7060d44903b31215857e70 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 9 Aug 2010 12:10:40 +0400
Subject: [PATCH 2/3] More parentheses
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
lib/fuse.c | 8 +++-----
lib/fuse_lowlevel.c | 2 +-
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/fuse.c b/lib/fuse.c
index 95cf50b..76c2681 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -961,17 +961,15 @@ static int fuse_compat_open(struct fuse_fs *fs, const char *path,
{
int err;
if (!fs->compat || fs->compat >= 25)
- err = fs->op.open(path, fi);
+ err = (fs->op.open)(path, fi);
else if (fs->compat == 22) {
struct fuse_file_info_compat tmp;
memcpy(&tmp, fi, sizeof(tmp));
- err = ((struct fuse_operations_compat22 *) &fs->op)->open(path,
- &tmp);
+ err = (((struct fuse_operations_compat22 *) &fs->op)->open)(path, &tmp);
memcpy(fi, &tmp, sizeof(tmp));
fi->fh = tmp.fh;
} else
- err = ((struct fuse_operations_compat2 *) &fs->op)
- ->open(path, fi->flags);
+ err = (((struct fuse_operations_compat2 *) &fs->op)->open)(path, fi->flags);
return err;
}
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index c519bfb..d6275b5 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -716,7 +716,7 @@ static void do_open(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fi.flags = arg->flags;
if (req->f->op.open)
- req->f->op.open(req, nodeid, &fi);
+ (req->f->op.open)(req, nodeid, &fi);
else
fuse_reply_open(req, &fi);
}
--
1.7.3.1

View File

@ -0,0 +1,125 @@
From d8bdebc639a84fa280153a466d4bb420fc9572bc Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Wed, 27 Oct 2010 16:29:45 +0400
Subject: [PATCH 3/3] Fix mounting FUSE fs into current working directory
See rhbz #622255 for bug description:
https://bugzilla.redhat.com/622255
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
lib/mount_util.c | 75 +++++++++++++-----------------------------------------
1 files changed, 18 insertions(+), 57 deletions(-)
diff --git a/lib/mount_util.c b/lib/mount_util.c
index 33e6697..b9a0895 100644
--- a/lib/mount_util.c
+++ b/lib/mount_util.c
@@ -54,8 +54,8 @@ static int mtab_needs_update(const char *mnt)
return 1;
}
-static int add_mount_legacy(const char *progname, const char *fsname,
- const char *mnt, const char *type, const char *opts)
+static int add_mount(const char *progname, const char *fsname,
+ const char *mnt, const char *type, const char *opts, int is_legacy)
{
int res;
int status;
@@ -76,6 +76,14 @@ static int add_mount_legacy(const char *progname, const char *fsname,
goto out_restore;
}
if (res == 0) {
+ /*
+ * Hide output, because old versions don't support
+ * --no-canonicalize
+ */
+ int fd = open("/dev/null", O_RDONLY);
+ dup2(fd, 1);
+ dup2(fd, 2);
+
char templ[] = "/tmp/fusermountXXXXXX";
char *tmp;
@@ -99,59 +107,12 @@ static int add_mount_legacy(const char *progname, const char *fsname,
exit(1);
}
rmdir(tmp);
- execl("/bin/mount", "/bin/mount", "-i", "-f", "-t", type,
- "-o", opts, fsname, mnt, NULL);
- fprintf(stderr, "%s: failed to execute /bin/mount: %s\n",
- progname, strerror(errno));
- exit(1);
- }
- res = waitpid(res, &status, 0);
- if (res == -1)
- fprintf(stderr, "%s: waitpid: %s\n", progname, strerror(errno));
-
- if (status != 0)
- res = -1;
-
- out_restore:
- sigprocmask(SIG_SETMASK, &oldmask, NULL);
-
- return res;
-}
-
-static int add_mount(const char *progname, const char *fsname,
- const char *mnt, const char *type, const char *opts)
-{
- int res;
- int status;
- sigset_t blockmask;
- sigset_t oldmask;
-
- sigemptyset(&blockmask);
- sigaddset(&blockmask, SIGCHLD);
- res = sigprocmask(SIG_BLOCK, &blockmask, &oldmask);
- if (res == -1) {
- fprintf(stderr, "%s: sigprocmask: %s\n", progname, strerror(errno));
- return -1;
- }
-
- res = fork();
- if (res == -1) {
- fprintf(stderr, "%s: fork: %s\n", progname, strerror(errno));
- goto out_restore;
- }
- if (res == 0) {
- /*
- * Hide output, because old versions don't support
- * --no-canonicalize
- */
- int fd = open("/dev/null", O_RDONLY);
- dup2(fd, 1);
- dup2(fd, 2);
-
- sigprocmask(SIG_SETMASK, &oldmask, NULL);
- setuid(geteuid());
- execl("/bin/mount", "/bin/mount", "--no-canonicalize", "-i",
- "-f", "-t", type, "-o", opts, fsname, mnt, NULL);
+ if(is_legacy)
+ execl("/bin/mount", "/bin/mount", "-i",
+ "-f", "-t", type, "-o", opts, fsname, mnt, NULL);
+ else
+ execl("/bin/mount", "/bin/mount", "--no-canonicalize", "-i",
+ "-f", "-t", type, "-o", opts, fsname, mnt, NULL);
fprintf(stderr, "%s: failed to execute /bin/mount: %s\n",
progname, strerror(errno));
exit(1);
@@ -177,9 +138,9 @@ int fuse_mnt_add_mount(const char *progname, const char *fsname,
if (!mtab_needs_update(mnt))
return 0;
- res = add_mount(progname, fsname, mnt, type, opts);
+ res = add_mount(progname, fsname, mnt, type, opts, 0);
if (res == -1)
- res = add_mount_legacy(progname, fsname, mnt, type, opts);
+ res = add_mount(progname, fsname, mnt, type, opts, 1);
return res;
}
--
1.7.3.1