Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 151258
b: refs/heads/master
c: b03f38b
h: refs/heads/master
v: v3
  • Loading branch information
Kay Sievers authored and Greg Kroah-Hartman committed Jun 16, 2009
1 parent bfbdb02 commit ce7e89b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f7a386c5b8ff34cd84ae922603d1c6f9d234edee
refs/heads/master: b03f38b685e2e1db174fb8982930e789a516f414
10 changes: 10 additions & 0 deletions trunk/block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,10 +996,20 @@ struct class block_class = {
.name = "block",
};

static char *block_nodename(struct device *dev)
{
struct gendisk *disk = dev_to_disk(dev);

if (disk->nodename)
return disk->nodename(disk);
return NULL;
}

static struct device_type disk_type = {
.name = "disk",
.groups = disk_attr_groups,
.release = disk_release,
.nodename = block_nodename,
};

#ifdef CONFIG_PROC_FS
Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/block/pktcdvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2855,6 +2855,11 @@ static struct block_device_operations pktcdvd_ops = {
.media_changed = pkt_media_changed,
};

static char *pktcdvd_nodename(struct gendisk *gd)
{
return kasprintf(GFP_KERNEL, "pktcdvd/%s", gd->disk_name);
}

/*
* Set up mapping from pktcdvd device to CD-ROM device.
*/
Expand Down Expand Up @@ -2907,6 +2912,7 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev)
disk->fops = &pktcdvd_ops;
disk->flags = GENHD_FL_REMOVABLE;
strcpy(disk->disk_name, pd->name);
disk->nodename = pktcdvd_nodename;
disk->private_data = pd;
disk->queue = blk_alloc_queue(GFP_KERNEL);
if (!disk->queue)
Expand Down Expand Up @@ -3062,6 +3068,7 @@ static const struct file_operations pkt_ctl_fops = {
static struct miscdevice pkt_misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = DRIVER_NAME,
.name = "pktcdvd/control",
.fops = &pkt_ctl_fops
};

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/genhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ struct gendisk {
* disks that can't be partitioned. */

char disk_name[DISK_NAME_LEN]; /* name of major driver */

char *(*nodename)(struct gendisk *gd);
/* Array of pointers to partitions indexed by partno.
* Protected with matching bdev lock but stat and other
* non-critical accesses use RCU. Always access through
Expand Down

0 comments on commit ce7e89b

Please sign in to comment.