aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/util.c
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2001-10-28 19:44:14 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2001-10-28 19:44:14 +0000
commit85c74fcdfd9e67d411c3e1734b34effd0d73fa4d (patch)
tree908e39d3e0b84bd733261cdde16ef6ae707f2352 /kernel/util.c
parent90d8bef61c8c40472ddfb1aafeeb6473ec51a053 (diff)
downloadlibfuse-85c74fcdfd9e67d411c3e1734b34effd0d73fa4d.tar.gz
x
Diffstat (limited to 'kernel/util.c')
-rw-r--r--kernel/util.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/kernel/util.c b/kernel/util.c
new file mode 100644
index 0000000..57b1a90
--- /dev/null
+++ b/kernel/util.c
@@ -0,0 +1,61 @@
+/*
+ FUSE: Filesystem in Userspace
+ Copyright (C) 2001 Miklos Szeredi (mszeredi@inf.bme.hu)
+
+ This program can be distributed under the terms of the GNU GPL.
+ See the file COPYING.
+*/
+
+#include "fuse_i.h"
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+
+#define FUSE_VERSION "0.1"
+
+spinlock_t fuse_lock = SPIN_LOCK_UNLOCKED;
+
+/* Must be called with the fuse lock held */
+void fuse_release_conn(struct fuse_conn *fc)
+{
+ if(fc->sb == NULL && fc->file == NULL) {
+ kfree(fc);
+ }
+}
+
+int init_module(void)
+{
+ int res;
+
+ printk(KERN_DEBUG "fuse init (version %s)\n", FUSE_VERSION);
+
+ res = fuse_fs_init();
+ if(res)
+ goto err;
+
+ res = fuse_dev_init();
+ if(res)
+ goto err_fs_cleanup;
+
+ return 0;
+
+ err_fs_cleanup:
+ fuse_fs_cleanup();
+ err:
+ return res;
+}
+
+void cleanup_module(void)
+{
+ printk(KERN_DEBUG "fuse cleanup\n");
+
+ fuse_fs_cleanup();
+ fuse_dev_cleanup();
+}
+
+/*
+ * Local Variables:
+ * indent-tabs-mode: t
+ * c-basic-offset: 8
+ */