From: Miklos Szeredi <miklos@szeredi.hu>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [patch 09/12] fuse: add support for block device based filesystems
Date: Mon, 16 Oct 2006 18:27:18 +0200 [thread overview]
Message-ID: <20061016162804.404125000@szeredi.hu> (raw)
In-Reply-To: <20061016162709.369579000@szeredi.hu>
[-- Attachment #1: fuse_blockdev.patch --]
[-- Type: text/plain, Size: 3596 bytes --]
I never intended this, but people started using fuse to implement
block device based "real" filesystems (ntfs-3g, zfs).
The following four patches add better support for these kinds of
filesystems. Unlike "normal" fuse filesystems, using this feature
should require superuser privileges (enforced by the fusermount
utility).
Thanks to Szabolcs Szakacsits for the input and testing.
This patch adds a 'fuseblk' filesystem type, which is only different
from the 'fuse' filesystem type in how the 'dev_name' mount argument
is interpreted.
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
---
Index: linux/Documentation/filesystems/fuse.txt
===================================================================
--- linux.orig/Documentation/filesystems/fuse.txt 2006-10-16 16:17:30.000000000 +0200
+++ linux/Documentation/filesystems/fuse.txt 2006-10-16 16:21:33.000000000 +0200
@@ -51,6 +51,22 @@ homepage:
http://fuse.sourceforge.net/
+Filesystem type
+~~~~~~~~~~~~~~~
+
+The filesystem type given to mount(2) can be one of the following:
+
+'fuse'
+
+ This is the usual way to mount a FUSE filesystem. The first
+ argument of the mount system call may contain an arbitrary string,
+ which is not interpreted by the kernel.
+
+'fuseblk'
+
+ The filesystem is block device based. The first argument of the
+ mount system call is interpreted as the name of the device.
+
Mount options
~~~~~~~~~~~~~
Index: linux/fs/fuse/inode.c
===================================================================
--- linux.orig/fs/fuse/inode.c 2006-10-16 16:17:36.000000000 +0200
+++ linux/fs/fuse/inode.c 2006-10-16 16:21:33.000000000 +0200
@@ -591,6 +591,14 @@ static int fuse_get_sb(struct file_syste
return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt);
}
+static int fuse_get_sb_blk(struct file_system_type *fs_type,
+ int flags, const char *dev_name,
+ void *raw_data, struct vfsmount *mnt)
+{
+ return get_sb_bdev(fs_type, flags, dev_name, raw_data, fuse_fill_super,
+ mnt);
+}
+
static struct file_system_type fuse_fs_type = {
.owner = THIS_MODULE,
.name = "fuse",
@@ -598,6 +606,14 @@ static struct file_system_type fuse_fs_t
.kill_sb = kill_anon_super,
};
+static struct file_system_type fuseblk_fs_type = {
+ .owner = THIS_MODULE,
+ .name = "fuseblk",
+ .get_sb = fuse_get_sb_blk,
+ .kill_sb = kill_block_super,
+ .fs_flags = FS_REQUIRES_DEV,
+};
+
static decl_subsys(fuse, NULL, NULL);
static decl_subsys(connections, NULL, NULL);
@@ -617,24 +633,34 @@ static int __init fuse_fs_init(void)
err = register_filesystem(&fuse_fs_type);
if (err)
- printk("fuse: failed to register filesystem\n");
- else {
- fuse_inode_cachep = kmem_cache_create("fuse_inode",
- sizeof(struct fuse_inode),
- 0, SLAB_HWCACHE_ALIGN,
- fuse_inode_init_once, NULL);
- if (!fuse_inode_cachep) {
- unregister_filesystem(&fuse_fs_type);
- err = -ENOMEM;
- }
- }
+ goto out;
+ err = register_filesystem(&fuseblk_fs_type);
+ if (err)
+ goto out_unreg;
+
+ fuse_inode_cachep = kmem_cache_create("fuse_inode",
+ sizeof(struct fuse_inode),
+ 0, SLAB_HWCACHE_ALIGN,
+ fuse_inode_init_once, NULL);
+ err = -ENOMEM;
+ if (!fuse_inode_cachep)
+ goto out_unreg2;
+
+ return 0;
+
+ out_unreg2:
+ unregister_filesystem(&fuseblk_fs_type);
+ out_unreg:
+ unregister_filesystem(&fuse_fs_type);
+ out:
return err;
}
static void fuse_fs_cleanup(void)
{
unregister_filesystem(&fuse_fs_type);
+ unregister_filesystem(&fuseblk_fs_type);
kmem_cache_destroy(fuse_inode_cachep);
}
--
next prev parent reply other threads:[~2006-10-16 16:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-16 16:27 [patch 00/12] fuse update Miklos Szeredi
2006-10-16 16:27 ` [patch 01/12] fuse: fix hang on SMP Miklos Szeredi
2006-10-16 23:51 ` Andrew Morton
2006-10-17 12:53 ` Mike Day
2006-10-17 13:43 ` Miklos Szeredi
2006-10-16 16:27 ` [patch 02/12] document i_size_write locking rules Miklos Szeredi
2006-10-16 16:27 ` [patch 03/12] fuse: locking fix for nlookup Miklos Szeredi
2006-10-16 16:27 ` [patch 04/12] fuse: fix spurious BUG Miklos Szeredi
2006-10-16 16:27 ` [patch 05/12] fuse: fix handling of moved directory Miklos Szeredi
2006-10-16 16:27 ` [patch 06/12] fuse: fix dereferencing dentry parent Miklos Szeredi
2006-10-16 16:27 ` [patch 07/12] fuse: update userspace interface to version 7.8 Miklos Szeredi
2006-10-16 16:27 ` [patch 08/12] fuse: minor cleanup in fuse_dentry_revalidate Miklos Szeredi
2006-10-16 16:27 ` Miklos Szeredi [this message]
2006-10-16 16:27 ` [patch 10/12] fuse: add blksize option Miklos Szeredi
2006-10-16 16:27 ` [patch 11/12] fuse: add bmap support Miklos Szeredi
2006-10-16 16:27 ` [patch 12/12] fuse: add DESTROY operation Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061016162804.404125000@szeredi.hu \
--to=miklos@szeredi.hu \
--cc=akpm@osdl.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®