aboutsummaryrefslogtreecommitdiff
path: root/kernel/util.c
blob: 9b7bec173d7ef17663dbcd93b1e1e18c8df8ef75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
    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>

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 %i)\n", FUSE_KERNEL_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
 */