diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2009-02-06 21:46:47 -0500 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-03-30 12:59:20 -0400 |
commit | 818fd20673df82031e604bb784d836f1fc2e2451 (patch) | |
tree | 2517bba7961d62b650003fbf7e049f446bd9c3a1 /drivers/xen/xenfs | |
parent | 6d02c42698f99eccb290ac53d4f10ca883b9f90c (diff) |
xen: add "capabilities" file
The xenfs capabilities file allows usermode to determine what
capabilities the domain has. The only one at present is "control_d"
in a privileged domain.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'drivers/xen/xenfs')
-rw-r--r-- | drivers/xen/xenfs/super.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c index 515741a8e6b8..6559e0c752ce 100644 --- a/drivers/xen/xenfs/super.c +++ b/drivers/xen/xenfs/super.c | |||
@@ -20,10 +20,27 @@ | |||
20 | MODULE_DESCRIPTION("Xen filesystem"); | 20 | MODULE_DESCRIPTION("Xen filesystem"); |
21 | MODULE_LICENSE("GPL"); | 21 | MODULE_LICENSE("GPL"); |
22 | 22 | ||
23 | static ssize_t capabilities_read(struct file *file, char __user *buf, | ||
24 | size_t size, loff_t *off) | ||
25 | { | ||
26 | char *tmp = ""; | ||
27 | |||
28 | if (xen_initial_domain()) | ||
29 | tmp = "control_d\n"; | ||
30 | |||
31 | return simple_read_from_buffer(buf, size, off, tmp, strlen(tmp)); | ||
32 | } | ||
33 | |||
34 | static const struct file_operations capabilities_file_ops = { | ||
35 | .read = capabilities_read, | ||
36 | }; | ||
37 | |||
23 | static int xenfs_fill_super(struct super_block *sb, void *data, int silent) | 38 | static int xenfs_fill_super(struct super_block *sb, void *data, int silent) |
24 | { | 39 | { |
25 | static struct tree_descr xenfs_files[] = { | 40 | static struct tree_descr xenfs_files[] = { |
26 | [2] = {"xenbus", &xenbus_file_ops, S_IRUSR|S_IWUSR}, | 41 | [1] = {}, |
42 | { "xenbus", &xenbus_file_ops, S_IRUSR|S_IWUSR }, | ||
43 | { "capabilities", &capabilities_file_ops, S_IRUGO }, | ||
27 | {""}, | 44 | {""}, |
28 | }; | 45 | }; |
29 | 46 | ||