aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-09-03 03:01:09 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:05 -0400
commitcf771cb5a7b716f3f9e532fd42a1e3a0a75adec5 (patch)
treec16cf6adc4d2e51eaee77088ecf126b721f8f3c7 /fs/partitions
parent310a2c1012934f590192377f65940cad4aa72b15 (diff)
block: make variable and argument names more consistent
In hd_struct, @partno is used to denote partition number and a number of other places use @part to denote hd_struct. Functions use @part and @index instead. This causes confusion and makes it difficult to use consistent variable names for hd_struct. Always use @partno if a variable represents partition number. Also, print out functions use @f or @part for seq_file argument. Use @seqf uniformly instead. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs/partitions')
-rw-r--r--fs/partitions/check.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 16f98d824608..b86aab1b0df6 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -120,22 +120,22 @@ static int (*check_part[])(struct parsed_partitions *, struct block_device *) =
120 * a pointer to that same buffer (for convenience). 120 * a pointer to that same buffer (for convenience).
121 */ 121 */
122 122
123char *disk_name(struct gendisk *hd, int part, char *buf) 123char *disk_name(struct gendisk *hd, int partno, char *buf)
124{ 124{
125 if (!part) 125 if (!partno)
126 snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name); 126 snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name);
127 else if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) 127 else if (isdigit(hd->disk_name[strlen(hd->disk_name)-1]))
128 snprintf(buf, BDEVNAME_SIZE, "%sp%d", hd->disk_name, part); 128 snprintf(buf, BDEVNAME_SIZE, "%sp%d", hd->disk_name, partno);
129 else 129 else
130 snprintf(buf, BDEVNAME_SIZE, "%s%d", hd->disk_name, part); 130 snprintf(buf, BDEVNAME_SIZE, "%s%d", hd->disk_name, partno);
131 131
132 return buf; 132 return buf;
133} 133}
134 134
135const char *bdevname(struct block_device *bdev, char *buf) 135const char *bdevname(struct block_device *bdev, char *buf)
136{ 136{
137 int part = MINOR(bdev->bd_dev) - bdev->bd_disk->first_minor; 137 int partno = MINOR(bdev->bd_dev) - bdev->bd_disk->first_minor;
138 return disk_name(bdev->bd_disk, part, buf); 138 return disk_name(bdev->bd_disk, partno, buf);
139} 139}
140 140
141EXPORT_SYMBOL(bdevname); 141EXPORT_SYMBOL(bdevname);
@@ -310,13 +310,13 @@ static inline void disk_sysfs_add_subdirs(struct gendisk *disk)
310 kobject_put(k); 310 kobject_put(k);
311} 311}
312 312
313void delete_partition(struct gendisk *disk, int part) 313void delete_partition(struct gendisk *disk, int partno)
314{ 314{
315 struct hd_struct *p = disk->part[part-1]; 315 struct hd_struct *p = disk->part[partno - 1];
316 316
317 if (!p) 317 if (!p)
318 return; 318 return;
319 disk->part[part-1] = NULL; 319 disk->part[partno - 1] = NULL;
320 p->start_sect = 0; 320 p->start_sect = 0;
321 p->nr_sects = 0; 321 p->nr_sects = 0;
322 part_stat_set_all(p, 0); 322 part_stat_set_all(p, 0);
@@ -333,12 +333,13 @@ static ssize_t whole_disk_show(struct device *dev,
333static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH, 333static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH,
334 whole_disk_show, NULL); 334 whole_disk_show, NULL);
335 335
336int add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags) 336int add_partition(struct gendisk *disk, int partno,
337 sector_t start, sector_t len, int flags)
337{ 338{
338 struct hd_struct *p; 339 struct hd_struct *p;
339 int err; 340 int err;
340 341
341 if (disk->part[part - 1]) 342 if (disk->part[partno - 1])
342 return -EBUSY; 343 return -EBUSY;
343 344
344 p = kzalloc(sizeof(*p), GFP_KERNEL); 345 p = kzalloc(sizeof(*p), GFP_KERNEL);
@@ -351,18 +352,18 @@ int add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,
351 } 352 }
352 p->start_sect = start; 353 p->start_sect = start;
353 p->nr_sects = len; 354 p->nr_sects = len;
354 p->partno = part; 355 p->partno = partno;
355 p->policy = disk->policy; 356 p->policy = disk->policy;
356 357
357 if (isdigit(disk->dev.bus_id[strlen(disk->dev.bus_id)-1])) 358 if (isdigit(disk->dev.bus_id[strlen(disk->dev.bus_id)-1]))
358 snprintf(p->dev.bus_id, BUS_ID_SIZE, 359 snprintf(p->dev.bus_id, BUS_ID_SIZE,
359 "%sp%d", disk->dev.bus_id, part); 360 "%sp%d", disk->dev.bus_id, partno);
360 else 361 else
361 snprintf(p->dev.bus_id, BUS_ID_SIZE, 362 snprintf(p->dev.bus_id, BUS_ID_SIZE,
362 "%s%d", disk->dev.bus_id, part); 363 "%s%d", disk->dev.bus_id, partno);
363 364
364 device_initialize(&p->dev); 365 device_initialize(&p->dev);
365 p->dev.devt = MKDEV(disk->major, disk->first_minor + part); 366 p->dev.devt = MKDEV(disk->major, disk->first_minor + partno);
366 p->dev.class = &block_class; 367 p->dev.class = &block_class;
367 p->dev.type = &part_type; 368 p->dev.type = &part_type;
368 p->dev.parent = &disk->dev; 369 p->dev.parent = &disk->dev;
@@ -386,7 +387,7 @@ int add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,
386 } 387 }
387 388
388 /* everything is up and running, commence */ 389 /* everything is up and running, commence */
389 disk->part[part - 1] = p; 390 disk->part[partno - 1] = p;
390 391
391 /* suppress uevent if the disk supresses it */ 392 /* suppress uevent if the disk supresses it */
392 if (!disk->dev.uevent_suppress) 393 if (!disk->dev.uevent_suppress)