Commit f70158b9 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] futex filesystem handling

Eeek....

futex.c is seriously b0rken.
parent ca3dd564
......@@ -48,7 +48,7 @@
extern void send_sigio(struct fown_struct *fown, int fd, int band);
/* Everyone needs a dentry and inode */
static struct dentry *futex_dentry;
static struct vfsmount *futex_mnt;
/* We use this instead of a normal wait_queue_t, so we can wake only
the relevent ones (hashed queues may be shared) */
......@@ -272,7 +272,8 @@ static int futex_fd(struct list_head *head,
return -ENFILE;
}
filp->f_op = &futex_fops;
filp->f_dentry = dget(futex_dentry);
filp->f_vfsmnt = mntget(futex_mnt);
filp->f_dentry = dget(futex_mnt->mnt_root);
if (signal) {
filp->f_owner.pid = current->pid;
......@@ -348,46 +349,16 @@ asmlinkage int sys_futex(void *uaddr, int op, int val, struct timespec *utime)
return ret;
}
/* FIXME: Oh yeah, makes sense to write a filesystem... */
static struct super_operations futexfs_ops = { statfs: simple_statfs };
/* Don't check error returns: we're dead if they happen */
static int futexfs_fill_super(struct super_block *sb, void *data, int silent)
{
struct inode *root;
sb->s_blocksize = 1024;
sb->s_blocksize_bits = 10;
sb->s_magic = 0xBAD1DEA;
sb->s_op = &futexfs_ops;
root = new_inode(sb);
root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
root->i_uid = root->i_gid = 0;
root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME;
sb->s_root = d_alloc(NULL, &(const struct qstr) { "futex", 5, 0 });
sb->s_root->d_sb = sb;
sb->s_root->d_parent = sb->s_root;
d_instantiate(sb->s_root, root);
/* We never let this drop to zero. */
futex_dentry = dget(sb->s_root);
return 0;
}
static struct super_block *
futexfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_nodev(fs_type, flags, data, futexfs_fill_super);
return get_sb_pseudo(fs_type, "futex", NULL, 0xBAD1DEA);
}
static struct file_system_type futex_fs_type = {
name: "futexfs",
get_sb: futexfs_get_sb,
kill_sb: kill_anon_super,
};
static int __init init(void)
......@@ -395,7 +366,7 @@ static int __init init(void)
unsigned int i;
register_filesystem(&futex_fs_type);
kern_mount(&futex_fs_type);
futex_mnt = kern_mount(&futex_fs_type);
for (i = 0; i < ARRAY_SIZE(futex_queues); i++)
INIT_LIST_HEAD(&futex_queues[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment