Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105994
b: refs/heads/master
c: d805dda
h: refs/heads/master
v: v3
  • Loading branch information
Abdel Benamrouche authored and Linus Torvalds committed Jul 25, 2008
1 parent 1717edf commit b6775d7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 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: abe19b7b822a8fdbe3dbfd6e066d0698b4eefb06
refs/heads/master: d805dda412346225a50af2d399d958a4bc676c38
28 changes: 22 additions & 6 deletions trunk/fs/partitions/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,18 @@ static ssize_t whole_disk_show(struct device *dev,
static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH,
whole_disk_show, NULL);

void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags)
int add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags)
{
struct hd_struct *p;
int err;

p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return;
return -ENOMEM;

if (!init_part_stats(p)) {
kfree(p);
return;
err = -ENOMEM;
goto out0;
}
p->start_sect = start;
p->nr_sects = len;
Expand All @@ -378,15 +378,31 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,

/* delay uevent until 'holders' subdir is created */
p->dev.uevent_suppress = 1;
device_add(&p->dev);
err = device_add(&p->dev);
if (err)
goto out1;
partition_sysfs_add_subdir(p);
p->dev.uevent_suppress = 0;
if (flags & ADDPART_FLAG_WHOLEDISK)
if (flags & ADDPART_FLAG_WHOLEDISK) {
err = device_create_file(&p->dev, &dev_attr_whole_disk);
if (err)
goto out2;
}

/* suppress uevent if the disk supresses it */
if (!disk->dev.uevent_suppress)
kobject_uevent(&p->dev.kobj, KOBJ_ADD);

return 0;

out2:
device_del(&p->dev);
out1:
put_device(&p->dev);
free_part_stats(p);
out0:
kfree(p);
return err;
}

/* Not exported, helper to add_disk(). */
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 @@ -541,7 +541,7 @@ extern dev_t blk_lookup_devt(const char *name, int part);
extern char *disk_name (struct gendisk *hd, int part, char *buf);

extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
extern void add_partition(struct gendisk *, int, sector_t, sector_t, int);
extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int);
extern void delete_partition(struct gendisk *, int);
extern void printk_all_partitions(void);

Expand Down

0 comments on commit b6775d7

Please sign in to comment.