inode.c (db50b96c0f28a21c5a4a19ecaba12d0972aab06a) inode.c (87729a5514e855ce2c71e3e33833a106b8caf2ae)
1/*
2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
4
5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING.
7*/
8

--- 17 unchanged lines hidden (view full) ---

26static kmem_cache_t *fuse_inode_cachep;
27
28#define FUSE_SUPER_MAGIC 0x65735546
29
30struct fuse_mount_data {
31 int fd;
32 unsigned rootmode;
33 unsigned user_id;
1/*
2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
4
5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING.
7*/
8

--- 17 unchanged lines hidden (view full) ---

26static kmem_cache_t *fuse_inode_cachep;
27
28#define FUSE_SUPER_MAGIC 0x65735546
29
30struct fuse_mount_data {
31 int fd;
32 unsigned rootmode;
33 unsigned user_id;
34 unsigned group_id;
34 unsigned flags;
35 unsigned max_read;
36};
37
38static struct inode *fuse_alloc_inode(struct super_block *sb)
39{
40 struct inode *inode;
41 struct fuse_inode *fi;

--- 152 unchanged lines hidden (view full) ---

194 down_write(&fc->sbput_sem);
195 while (!list_empty(&fc->background))
196 fuse_release_background(list_entry(fc->background.next,
197 struct fuse_req, bg_entry));
198
199 spin_lock(&fuse_lock);
200 fc->mounted = 0;
201 fc->user_id = 0;
35 unsigned flags;
36 unsigned max_read;
37};
38
39static struct inode *fuse_alloc_inode(struct super_block *sb)
40{
41 struct inode *inode;
42 struct fuse_inode *fi;

--- 152 unchanged lines hidden (view full) ---

195 down_write(&fc->sbput_sem);
196 while (!list_empty(&fc->background))
197 fuse_release_background(list_entry(fc->background.next,
198 struct fuse_req, bg_entry));
199
200 spin_lock(&fuse_lock);
201 fc->mounted = 0;
202 fc->user_id = 0;
203 fc->group_id = 0;
202 fc->flags = 0;
203 /* Flush all readers on this fs */
204 wake_up_all(&fc->waitq);
205 up_write(&fc->sbput_sem);
206 fuse_release_conn(fc);
207 spin_unlock(&fuse_lock);
208}
209

--- 33 unchanged lines hidden (view full) ---

243 fuse_put_request(fc, req);
244 return err;
245}
246
247enum {
248 OPT_FD,
249 OPT_ROOTMODE,
250 OPT_USER_ID,
204 fc->flags = 0;
205 /* Flush all readers on this fs */
206 wake_up_all(&fc->waitq);
207 up_write(&fc->sbput_sem);
208 fuse_release_conn(fc);
209 spin_unlock(&fuse_lock);
210}
211

--- 33 unchanged lines hidden (view full) ---

245 fuse_put_request(fc, req);
246 return err;
247}
248
249enum {
250 OPT_FD,
251 OPT_ROOTMODE,
252 OPT_USER_ID,
253 OPT_GROUP_ID,
251 OPT_DEFAULT_PERMISSIONS,
252 OPT_ALLOW_OTHER,
253 OPT_KERNEL_CACHE,
254 OPT_MAX_READ,
255 OPT_ERR
256};
257
258static match_table_t tokens = {
259 {OPT_FD, "fd=%u"},
260 {OPT_ROOTMODE, "rootmode=%o"},
261 {OPT_USER_ID, "user_id=%u"},
254 OPT_DEFAULT_PERMISSIONS,
255 OPT_ALLOW_OTHER,
256 OPT_KERNEL_CACHE,
257 OPT_MAX_READ,
258 OPT_ERR
259};
260
261static match_table_t tokens = {
262 {OPT_FD, "fd=%u"},
263 {OPT_ROOTMODE, "rootmode=%o"},
264 {OPT_USER_ID, "user_id=%u"},
265 {OPT_GROUP_ID, "group_id=%u"},
262 {OPT_DEFAULT_PERMISSIONS, "default_permissions"},
263 {OPT_ALLOW_OTHER, "allow_other"},
264 {OPT_KERNEL_CACHE, "kernel_cache"},
265 {OPT_MAX_READ, "max_read=%u"},
266 {OPT_ERR, NULL}
267};
268
269static int parse_fuse_opt(char *opt, struct fuse_mount_data *d)

--- 25 unchanged lines hidden (view full) ---

295 break;
296
297 case OPT_USER_ID:
298 if (match_int(&args[0], &value))
299 return 0;
300 d->user_id = value;
301 break;
302
266 {OPT_DEFAULT_PERMISSIONS, "default_permissions"},
267 {OPT_ALLOW_OTHER, "allow_other"},
268 {OPT_KERNEL_CACHE, "kernel_cache"},
269 {OPT_MAX_READ, "max_read=%u"},
270 {OPT_ERR, NULL}
271};
272
273static int parse_fuse_opt(char *opt, struct fuse_mount_data *d)

--- 25 unchanged lines hidden (view full) ---

299 break;
300
301 case OPT_USER_ID:
302 if (match_int(&args[0], &value))
303 return 0;
304 d->user_id = value;
305 break;
306
307 case OPT_GROUP_ID:
308 if (match_int(&args[0], &value))
309 return 0;
310 d->group_id = value;
311 break;
312
303 case OPT_DEFAULT_PERMISSIONS:
304 d->flags |= FUSE_DEFAULT_PERMISSIONS;
305 break;
306
307 case OPT_ALLOW_OTHER:
308 d->flags |= FUSE_ALLOW_OTHER;
309 break;
310

--- 17 unchanged lines hidden (view full) ---

328 return 1;
329}
330
331static int fuse_show_options(struct seq_file *m, struct vfsmount *mnt)
332{
333 struct fuse_conn *fc = get_fuse_conn_super(mnt->mnt_sb);
334
335 seq_printf(m, ",user_id=%u", fc->user_id);
313 case OPT_DEFAULT_PERMISSIONS:
314 d->flags |= FUSE_DEFAULT_PERMISSIONS;
315 break;
316
317 case OPT_ALLOW_OTHER:
318 d->flags |= FUSE_ALLOW_OTHER;
319 break;
320

--- 17 unchanged lines hidden (view full) ---

338 return 1;
339}
340
341static int fuse_show_options(struct seq_file *m, struct vfsmount *mnt)
342{
343 struct fuse_conn *fc = get_fuse_conn_super(mnt->mnt_sb);
344
345 seq_printf(m, ",user_id=%u", fc->user_id);
346 seq_printf(m, ",group_id=%u", fc->group_id);
336 if (fc->flags & FUSE_DEFAULT_PERMISSIONS)
337 seq_puts(m, ",default_permissions");
338 if (fc->flags & FUSE_ALLOW_OTHER)
339 seq_puts(m, ",allow_other");
340 if (fc->flags & FUSE_KERNEL_CACHE)
341 seq_puts(m, ",kernel_cache");
342 if (fc->max_read != ~0)
343 seq_printf(m, ",max_read=%u", fc->max_read);

--- 116 unchanged lines hidden (view full) ---

460
461 fc = get_conn(file, sb);
462 fput(file);
463 if (IS_ERR(fc))
464 return PTR_ERR(fc);
465
466 fc->flags = d.flags;
467 fc->user_id = d.user_id;
347 if (fc->flags & FUSE_DEFAULT_PERMISSIONS)
348 seq_puts(m, ",default_permissions");
349 if (fc->flags & FUSE_ALLOW_OTHER)
350 seq_puts(m, ",allow_other");
351 if (fc->flags & FUSE_KERNEL_CACHE)
352 seq_puts(m, ",kernel_cache");
353 if (fc->max_read != ~0)
354 seq_printf(m, ",max_read=%u", fc->max_read);

--- 116 unchanged lines hidden (view full) ---

471
472 fc = get_conn(file, sb);
473 fput(file);
474 if (IS_ERR(fc))
475 return PTR_ERR(fc);
476
477 fc->flags = d.flags;
478 fc->user_id = d.user_id;
479 fc->group_id = d.group_id;
468 fc->max_read = d.max_read;
469 if (fc->max_read / PAGE_CACHE_SIZE < fc->bdi.ra_pages)
470 fc->bdi.ra_pages = fc->max_read / PAGE_CACHE_SIZE;
471
472 err = -ENOMEM;
473 root = get_root_inode(sb, d.rootmode);
474 if (root == NULL)
475 goto err;

--- 101 unchanged lines hidden ---
480 fc->max_read = d.max_read;
481 if (fc->max_read / PAGE_CACHE_SIZE < fc->bdi.ra_pages)
482 fc->bdi.ra_pages = fc->max_read / PAGE_CACHE_SIZE;
483
484 err = -ENOMEM;
485 root = get_root_inode(sb, d.rootmode);
486 if (root == NULL)
487 goto err;

--- 101 unchanged lines hidden ---