Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 148381 | Differences between
and this patch

Collapse All | Expand All

(-)submount-0.9/subfs-0.9/subfs.c (-11 / +43 lines)
Lines 26-31 Link Here
26
#include <linux/signal.h>
26
#include <linux/signal.h>
27
#include <linux/sched.h>
27
#include <linux/sched.h>
28
#include <linux/version.h>
28
#include <linux/version.h>
29
#include <linux/rcupdate.h>
29
30
30
#include "subfs.h"
31
#include "subfs.h"
31
32
Lines 95-105 static void subfs_send_signal(void) Link Here
95
	struct task_struct *task = current;
96
	struct task_struct *task = current;
96
	int signal = SIGCONT;
97
	int signal = SIGCONT;
97
98
98
	read_lock(&tasklist_lock);
99
	rcu_read_lock();
99
	spin_lock_irq(&task->sighand->siglock);
100
	spin_lock_irq(&task->sighand->siglock);
100
	sigaddset(&task->pending.signal, signal);
101
	sigaddset(&task->pending.signal, signal);
101
	spin_unlock_irq(&task->sighand->siglock);
102
	spin_unlock_irq(&task->sighand->siglock);
102
	read_unlock(&tasklist_lock);
103
	rcu_read_unlock();
103
	set_tsk_thread_flag(task, TIF_SIGPENDING);
104
	set_tsk_thread_flag(task, TIF_SIGPENDING);
104
	return;
105
	return;
105
}
106
}
Lines 279-287 static int subfs_open(struct inode *inod Link Here
279
280
280
/*  Implements the statfs method so df and such will work on the mountpoint.
281
/*  Implements the statfs method so df and such will work on the mountpoint.
281
 */
282
 */
283
#ifdef NEW_VFS_ROOT_DENTRY_API
284
static int subfs_statfs(struct dentry *dentry, struct kstatfs *buf)
285
{
286
	struct subfs_mount *sfs_mnt = dentry->d_sb->s_fs_info;
287
#else
282
static int subfs_statfs(struct super_block *sb, struct kstatfs *buf)
288
static int subfs_statfs(struct super_block *sb, struct kstatfs *buf)
283
{
289
{
284
	struct subfs_mount *sfs_mnt = sb->s_fs_info;
290
	struct subfs_mount *sfs_mnt = sb->s_fs_info;
291
#endif
285
	struct vfsmount *child;
292
	struct vfsmount *child;
286
	if (down_interruptible(&sfs_mnt->sem))
293
	if (down_interruptible(&sfs_mnt->sem))
287
		return -ERESTARTSYS;
294
		return -ERESTARTSYS;
Lines 405-437 static int proc_opts(struct subfs_mount Link Here
405
 * subfs_mount structure is pointed to by the s_fs_info field of the
412
 * subfs_mount structure is pointed to by the s_fs_info field of the
406
 * superblock structure.
413
 * superblock structure.
407
 */
414
 */
415
#ifdef NEW_VFS_ROOT_DENTRY_API
416
static int subfs_get_super(struct file_system_type *fst,
417
				int flags, const char *devname, void *data, struct vfsmount *mnt)
418
#else
408
static struct super_block *subfs_get_super(struct file_system_type *fst,
419
static struct super_block *subfs_get_super(struct file_system_type *fst,
409
				int flags, const char *devname, void *data)
420
				int flags, const char *devname, void *data)
421
#endif
410
{
422
{
411
	char *device;
423
	char *device;
412
	struct subfs_mount *newmount;
424
	struct subfs_mount *newmount;
413
	int ret;
425
	int ret;
414
426
415
	if (!(newmount = kmalloc(sizeof(struct subfs_mount), GFP_KERNEL)))
427
	if (!(newmount = kmalloc(sizeof(struct subfs_mount), GFP_KERNEL))) {
416
		return ERR_PTR(-ENOMEM);
428
		ret = -ENOMEM;
429
		goto err;
430
	}
417
	newmount->req_fs = NULL;
431
	newmount->req_fs = NULL;
418
	newmount->sb = NULL;
432
	newmount->sb = NULL;
419
	newmount->mount = NULL;
433
	newmount->mount = NULL;
420
	newmount->procuid = 0;
434
	newmount->procuid = 0;
421
	sema_init(&newmount->sem, 1);
435
	sema_init(&newmount->sem, 1);
422
	if (!(device = kmalloc((strlen(devname) + 1), GFP_KERNEL)))
436
	if (!(device = kmalloc((strlen(devname) + 1), GFP_KERNEL))) {
423
		return ERR_PTR(-ENOMEM);
437
		ret = -ENOMEM;
438
		goto err;
439
	}
424
	strcpy(device, devname);
440
	strcpy(device, devname);
425
	newmount->device = device;
441
	newmount->device = device;
426
        if (!(newmount->helper_prog =
442
        if (!(newmount->helper_prog =
427
        		kmalloc(sizeof(SUBMOUNTD_PATH), GFP_KERNEL)))
443
        		kmalloc(sizeof(SUBMOUNTD_PATH), GFP_KERNEL))) {
428
        	return ERR_PTR(-ENOMEM);
444
			ret = -ENOMEM;
445
			goto err;
446
		}
429
	strcpy(newmount->helper_prog, SUBMOUNTD_PATH);
447
	strcpy(newmount->helper_prog, SUBMOUNTD_PATH);
430
	if ((ret = proc_opts(newmount, data)))
448
	if ((ret = proc_opts(newmount, data)))
431
		return ERR_PTR(ret);
449
		goto err;
432
	newmount->sb = get_sb_nodev(fst, flags, data, subfs_fill_super);
433
	newmount->sb->s_fs_info = newmount;
450
	newmount->sb->s_fs_info = newmount;
434
	return newmount->sb;
451
#ifdef NEW_VFS_ROOT_DENTRY_API
452
	ret = get_sb_nodev(fst, flags, data, subfs_fill_super, mnt);
453
	if (ret)
454
		goto err;
455
	newmount->sb = mnt->mnt_sb;
456
	return ret;
457
#else
458
	return get_sb_nodev(fst, flags, data, subfs_fill_super);
459
#endif
460
461
err:
462
#ifdef NEW_VFS_ROOT_DENTRY_API
463
	return ret;
464
#else
465
	retrun ERR_PTR(ret);
466
#endif
435
}
467
}
436
468
437
469
(-)submount-0.9/subfs-0.9/subfs.h (-1 / +13 lines)
Lines 19-24 Link Here
19
19
20
#define ROOT_MODE 0777
20
#define ROOT_MODE 0777
21
21
22
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)
23
#define NEW_VFS_ROOT_DENTRY_API
24
#endif
25
22
struct subfs_mount {
26
struct subfs_mount {
23
	char *device;
27
	char *device;
24
	char *options;
28
	char *options;
Lines 33-40 struct subfs_mount { Link Here
33
37
34
38
35
static void subfs_kill_super(struct super_block *sb);
39
static void subfs_kill_super(struct super_block *sb);
40
41
#ifdef NEW_VFS_ROOT_DENTRY_API
42
static int subfs_get_super(struct file_system_type *fst,
43
		int flags, const char *devname, void *data, struct vfsmount *mnt);
44
static int subfs_statfs(struct dentry *dentry, struct kstatfs *buf);
45
#else
36
static struct super_block *subfs_get_super(struct file_system_type *fst,
46
static struct super_block *subfs_get_super(struct file_system_type *fst,
37
		int flags, const char *devname, void *data);
47
		int flags, const char *devname, void *data);
48
static int subfs_statfs(struct super_block *sb, struct kstatfs *buf);
49
#endif
50
38
static struct vfsmount *get_subfs_vfsmount(struct super_block *sb);
51
static struct vfsmount *get_subfs_vfsmount(struct super_block *sb);
39
static int subfs_fill_super(struct super_block *sb, void *data,
52
static int subfs_fill_super(struct super_block *sb, void *data,
40
			    int silent);
53
			    int silent);
Lines 47-53 static int mount_real_fs(struct subfs_mo Link Here
47
static void subfs_send_signal(void);
60
static void subfs_send_signal(void);
48
static void subfs_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
61
static void subfs_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
49
			     struct dentry *dentry);
62
			     struct dentry *dentry);
50
static int subfs_statfs(struct super_block *sb, struct kstatfs *buf);
51
63
52
64
53
static struct file_system_type subfs_type = {
65
static struct file_system_type subfs_type = {

Return to bug 148381