Skip to content

Commit

Permalink
IB/uverbs: Add devnode method to set path/mode
Browse files Browse the repository at this point in the history
We want udev to create a device node under /dev/infiniband with
permission 0666 for uverbsX devices, so add a devnode method to set the
appropriate info.

Signed-off-by: Roland Dreier <roland@purestorage.com>
  • Loading branch information
Roland Dreier committed May 23, 2011
1 parent 257313b commit 71c29bd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/infiniband/core/uverbs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,12 @@ static void ib_uverbs_remove_one(struct ib_device *device)
kfree(uverbs_dev);
}

static char *uverbs_devnode(struct device *dev, mode_t *mode)
{
*mode = 0666;
return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev));
}

static int __init ib_uverbs_init(void)
{
int ret;
Expand All @@ -842,6 +848,8 @@ static int __init ib_uverbs_init(void)
goto out_chrdev;
}

uverbs_class->devnode = uverbs_devnode;

ret = class_create_file(uverbs_class, &class_attr_abi_version.attr);
if (ret) {
printk(KERN_ERR "user_verbs: couldn't create abi_version attribute\n");
Expand Down

0 comments on commit 71c29bd

Please sign in to comment.