diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/xen/xenfs/super.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/xen/xenfs/super.c')
-rw-r--r-- | drivers/xen/xenfs/super.c | 66 |
1 files changed, 60 insertions, 6 deletions
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c index 78bfab0700ba..1aa389719846 100644 --- a/drivers/xen/xenfs/super.c +++ b/drivers/xen/xenfs/super.c | |||
@@ -22,6 +22,46 @@ | |||
22 | MODULE_DESCRIPTION("Xen filesystem"); | 22 | MODULE_DESCRIPTION("Xen filesystem"); |
23 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
24 | 24 | ||
25 | static struct inode *xenfs_make_inode(struct super_block *sb, int mode) | ||
26 | { | ||
27 | struct inode *ret = new_inode(sb); | ||
28 | |||
29 | if (ret) { | ||
30 | ret->i_mode = mode; | ||
31 | ret->i_uid = ret->i_gid = 0; | ||
32 | ret->i_blocks = 0; | ||
33 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; | ||
34 | } | ||
35 | return ret; | ||
36 | } | ||
37 | |||
38 | static struct dentry *xenfs_create_file(struct super_block *sb, | ||
39 | struct dentry *parent, | ||
40 | const char *name, | ||
41 | const struct file_operations *fops, | ||
42 | void *data, | ||
43 | int mode) | ||
44 | { | ||
45 | struct dentry *dentry; | ||
46 | struct inode *inode; | ||
47 | |||
48 | dentry = d_alloc_name(parent, name); | ||
49 | if (!dentry) | ||
50 | return NULL; | ||
51 | |||
52 | inode = xenfs_make_inode(sb, S_IFREG | mode); | ||
53 | if (!inode) { | ||
54 | dput(dentry); | ||
55 | return NULL; | ||
56 | } | ||
57 | |||
58 | inode->i_fop = fops; | ||
59 | inode->i_private = data; | ||
60 | |||
61 | d_add(dentry, inode); | ||
62 | return dentry; | ||
63 | } | ||
64 | |||
25 | static ssize_t capabilities_read(struct file *file, char __user *buf, | 65 | static ssize_t capabilities_read(struct file *file, char __user *buf, |
26 | size_t size, loff_t *off) | 66 | size_t size, loff_t *off) |
27 | { | 67 | { |
@@ -35,6 +75,7 @@ static ssize_t capabilities_read(struct file *file, char __user *buf, | |||
35 | 75 | ||
36 | static const struct file_operations capabilities_file_ops = { | 76 | static const struct file_operations capabilities_file_ops = { |
37 | .read = capabilities_read, | 77 | .read = capabilities_read, |
78 | .llseek = default_llseek, | ||
38 | }; | 79 | }; |
39 | 80 | ||
40 | static int xenfs_fill_super(struct super_block *sb, void *data, int silent) | 81 | static int xenfs_fill_super(struct super_block *sb, void *data, int silent) |
@@ -43,23 +84,36 @@ static int xenfs_fill_super(struct super_block *sb, void *data, int silent) | |||
43 | [1] = {}, | 84 | [1] = {}, |
44 | { "xenbus", &xenbus_file_ops, S_IRUSR|S_IWUSR }, | 85 | { "xenbus", &xenbus_file_ops, S_IRUSR|S_IWUSR }, |
45 | { "capabilities", &capabilities_file_ops, S_IRUGO }, | 86 | { "capabilities", &capabilities_file_ops, S_IRUGO }, |
87 | { "privcmd", &privcmd_file_ops, S_IRUSR|S_IWUSR }, | ||
46 | {""}, | 88 | {""}, |
47 | }; | 89 | }; |
90 | int rc; | ||
91 | |||
92 | rc = simple_fill_super(sb, XENFS_SUPER_MAGIC, xenfs_files); | ||
93 | if (rc < 0) | ||
94 | return rc; | ||
95 | |||
96 | if (xen_initial_domain()) { | ||
97 | xenfs_create_file(sb, sb->s_root, "xsd_kva", | ||
98 | &xsd_kva_file_ops, NULL, S_IRUSR|S_IWUSR); | ||
99 | xenfs_create_file(sb, sb->s_root, "xsd_port", | ||
100 | &xsd_port_file_ops, NULL, S_IRUSR|S_IWUSR); | ||
101 | } | ||
48 | 102 | ||
49 | return simple_fill_super(sb, XENFS_SUPER_MAGIC, xenfs_files); | 103 | return rc; |
50 | } | 104 | } |
51 | 105 | ||
52 | static int xenfs_get_sb(struct file_system_type *fs_type, | 106 | static struct dentry *xenfs_mount(struct file_system_type *fs_type, |
53 | int flags, const char *dev_name, | 107 | int flags, const char *dev_name, |
54 | void *data, struct vfsmount *mnt) | 108 | void *data) |
55 | { | 109 | { |
56 | return get_sb_single(fs_type, flags, data, xenfs_fill_super, mnt); | 110 | return mount_single(fs_type, flags, data, xenfs_fill_super); |
57 | } | 111 | } |
58 | 112 | ||
59 | static struct file_system_type xenfs_type = { | 113 | static struct file_system_type xenfs_type = { |
60 | .owner = THIS_MODULE, | 114 | .owner = THIS_MODULE, |
61 | .name = "xenfs", | 115 | .name = "xenfs", |
62 | .get_sb = xenfs_get_sb, | 116 | .mount = xenfs_mount, |
63 | .kill_sb = kill_litter_super, | 117 | .kill_sb = kill_litter_super, |
64 | }; | 118 | }; |
65 | 119 | ||