1 |
dpavlin |
4 |
/* |
2 |
|
|
FUSE: Filesystem in Userspace |
3 |
|
|
Copyright (C) 2001-2004 Miklos Szeredi <miklos@szeredi.hu> |
4 |
|
|
|
5 |
|
|
This program can be distributed under the terms of the GNU LGPL. |
6 |
|
|
See the file COPYING.LIB. |
7 |
|
|
*/ |
8 |
|
|
|
9 |
|
|
#include "fuse.h" |
10 |
|
|
#include <stdio.h> |
11 |
|
|
#include <pthread.h> |
12 |
|
|
|
13 |
|
|
/* FUSE flags: */ |
14 |
|
|
|
15 |
|
|
/** Enable debuging output */ |
16 |
|
|
#define FUSE_DEBUG (1 << 1) |
17 |
|
|
|
18 |
|
|
/** If a file is removed but it's still open, don't hide the file but |
19 |
|
|
remove it immediately */ |
20 |
|
|
#define FUSE_HARD_REMOVE (1 << 2) |
21 |
|
|
|
22 |
|
|
|
23 |
|
|
typedef unsigned long fino_t; |
24 |
|
|
|
25 |
|
|
struct node { |
26 |
|
|
struct node *name_next; |
27 |
|
|
struct node *ino_next; |
28 |
|
|
fino_t ino; |
29 |
|
|
unsigned int generation; |
30 |
|
|
fino_t parent; |
31 |
|
|
char *name; |
32 |
|
|
int mode; |
33 |
|
|
int rdev; |
34 |
|
|
int version; |
35 |
|
|
int open_count; |
36 |
|
|
int is_hidden; |
37 |
|
|
}; |
38 |
|
|
|
39 |
|
|
struct fuse { |
40 |
|
|
int flags; |
41 |
|
|
int fd; |
42 |
|
|
struct fuse_operations op; |
43 |
|
|
struct node **name_table; |
44 |
|
|
size_t name_table_size; |
45 |
|
|
struct node **ino_table; |
46 |
|
|
size_t ino_table_size; |
47 |
|
|
fino_t ctr; |
48 |
|
|
unsigned int generation; |
49 |
|
|
unsigned int hidectr; |
50 |
|
|
unsigned int fh_ctr; |
51 |
|
|
pthread_mutex_t lock; |
52 |
|
|
int numworker; |
53 |
|
|
int numavail; |
54 |
|
|
struct fuse_context *(*getcontext)(struct fuse *); |
55 |
|
|
struct fuse_context context; |
56 |
|
|
pthread_key_t context_key; |
57 |
|
|
volatile int exited; |
58 |
|
|
int majorver; |
59 |
|
|
int minorver; |
60 |
|
|
}; |
61 |
|
|
|
62 |
|
|
struct fuse_dirhandle { |
63 |
|
|
struct fuse *fuse; |
64 |
|
|
fino_t dir; |
65 |
|
|
FILE *fp; |
66 |
|
|
}; |
67 |
|
|
|
68 |
|
|
struct fuse_cmd { |
69 |
|
|
char *buf; |
70 |
|
|
size_t buflen; |
71 |
|
|
}; |