Skip to content

Commit

Permalink
xen: add "capabilities" file
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jsgf authored and Jeremy Fitzhardinge committed Mar 30, 2009
1 parent 6d02c42 commit 818fd20
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion drivers/xen/xenfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,27 @@
MODULE_DESCRIPTION("Xen filesystem");
MODULE_LICENSE("GPL");

static ssize_t capabilities_read(struct file *file, char __user *buf,
size_t size, loff_t *off)
{
char *tmp = "";

if (xen_initial_domain())
tmp = "control_d\n";

return simple_read_from_buffer(buf, size, off, tmp, strlen(tmp));
}

static const struct file_operations capabilities_file_ops = {
.read = capabilities_read,
};

static int xenfs_fill_super(struct super_block *sb, void *data, int silent)
{
static struct tree_descr xenfs_files[] = {
[2] = {"xenbus", &xenbus_file_ops, S_IRUSR|S_IWUSR},
[1] = {},
{ "xenbus", &xenbus_file_ops, S_IRUSR|S_IWUSR },
{ "capabilities", &capabilities_file_ops, S_IRUGO },
{""},
};

Expand Down

0 comments on commit 818fd20

Please sign in to comment.