diff options
author | James Morris <jmorris@namei.org> | 2009-03-23 19:52:46 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-03-23 19:52:46 -0400 |
commit | 703a3cd72817e99201cef84a8a7aecc60b2b3581 (patch) | |
tree | 3e943755178ff410694722bb031f523136fbc432 /block/genhd.c | |
parent | df7f54c012b92ec93d56b68547351dcdf8a163d3 (diff) | |
parent | 8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff) |
Merge branch 'master' into next
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c index 397960cf26a..a9ec910974c 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -256,6 +256,22 @@ void blkdev_show(struct seq_file *seqf, off_t offset) | |||
256 | } | 256 | } |
257 | #endif /* CONFIG_PROC_FS */ | 257 | #endif /* CONFIG_PROC_FS */ |
258 | 258 | ||
259 | /** | ||
260 | * register_blkdev - register a new block device | ||
261 | * | ||
262 | * @major: the requested major device number [1..255]. If @major=0, try to | ||
263 | * allocate any unused major number. | ||
264 | * @name: the name of the new block device as a zero terminated string | ||
265 | * | ||
266 | * The @name must be unique within the system. | ||
267 | * | ||
268 | * The return value depends on the @major input parameter. | ||
269 | * - if a major device number was requested in range [1..255] then the | ||
270 | * function returns zero on success, or a negative error code | ||
271 | * - if any unused major number was requested with @major=0 parameter | ||
272 | * then the return value is the allocated major number in range | ||
273 | * [1..255] or a negative error code otherwise | ||
274 | */ | ||
259 | int register_blkdev(unsigned int major, const char *name) | 275 | int register_blkdev(unsigned int major, const char *name) |
260 | { | 276 | { |
261 | struct blk_major_name **n, *p; | 277 | struct blk_major_name **n, *p; |
@@ -1087,6 +1103,14 @@ dev_t blk_lookup_devt(const char *name, int partno) | |||
1087 | if (strcmp(dev_name(dev), name)) | 1103 | if (strcmp(dev_name(dev), name)) |
1088 | continue; | 1104 | continue; |
1089 | 1105 | ||
1106 | if (partno < disk->minors) { | ||
1107 | /* We need to return the right devno, even | ||
1108 | * if the partition doesn't exist yet. | ||
1109 | */ | ||
1110 | devt = MKDEV(MAJOR(dev->devt), | ||
1111 | MINOR(dev->devt) + partno); | ||
1112 | break; | ||
1113 | } | ||
1090 | part = disk_get_part(disk, partno); | 1114 | part = disk_get_part(disk, partno); |
1091 | if (part) { | 1115 | if (part) { |
1092 | devt = part_devt(part); | 1116 | devt = part_devt(part); |