diff options
Diffstat (limited to 'fs/partitions/check.c')
-rw-r--r-- | fs/partitions/check.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 77e178f13162..9c06c5434ec4 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -192,6 +192,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev) | |||
192 | struct part_attribute { | 192 | struct part_attribute { |
193 | struct attribute attr; | 193 | struct attribute attr; |
194 | ssize_t (*show)(struct hd_struct *,char *); | 194 | ssize_t (*show)(struct hd_struct *,char *); |
195 | ssize_t (*store)(struct hd_struct *,const char *, size_t); | ||
195 | }; | 196 | }; |
196 | 197 | ||
197 | static ssize_t | 198 | static ssize_t |
@@ -201,14 +202,33 @@ part_attr_show(struct kobject * kobj, struct attribute * attr, char * page) | |||
201 | struct part_attribute * part_attr = container_of(attr,struct part_attribute,attr); | 202 | struct part_attribute * part_attr = container_of(attr,struct part_attribute,attr); |
202 | ssize_t ret = 0; | 203 | ssize_t ret = 0; |
203 | if (part_attr->show) | 204 | if (part_attr->show) |
204 | ret = part_attr->show(p,page); | 205 | ret = part_attr->show(p, page); |
206 | return ret; | ||
207 | } | ||
208 | static ssize_t | ||
209 | part_attr_store(struct kobject * kobj, struct attribute * attr, | ||
210 | const char *page, size_t count) | ||
211 | { | ||
212 | struct hd_struct * p = container_of(kobj,struct hd_struct,kobj); | ||
213 | struct part_attribute * part_attr = container_of(attr,struct part_attribute,attr); | ||
214 | ssize_t ret = 0; | ||
215 | |||
216 | if (part_attr->store) | ||
217 | ret = part_attr->store(p, page, count); | ||
205 | return ret; | 218 | return ret; |
206 | } | 219 | } |
207 | 220 | ||
208 | static struct sysfs_ops part_sysfs_ops = { | 221 | static struct sysfs_ops part_sysfs_ops = { |
209 | .show = part_attr_show, | 222 | .show = part_attr_show, |
223 | .store = part_attr_store, | ||
210 | }; | 224 | }; |
211 | 225 | ||
226 | static ssize_t part_uevent_store(struct hd_struct * p, | ||
227 | const char *page, size_t count) | ||
228 | { | ||
229 | kobject_hotplug(&p->kobj, KOBJ_ADD); | ||
230 | return count; | ||
231 | } | ||
212 | static ssize_t part_dev_read(struct hd_struct * p, char *page) | 232 | static ssize_t part_dev_read(struct hd_struct * p, char *page) |
213 | { | 233 | { |
214 | struct gendisk *disk = container_of(p->kobj.parent,struct gendisk,kobj); | 234 | struct gendisk *disk = container_of(p->kobj.parent,struct gendisk,kobj); |
@@ -229,6 +249,10 @@ static ssize_t part_stat_read(struct hd_struct * p, char *page) | |||
229 | p->reads, (unsigned long long)p->read_sectors, | 249 | p->reads, (unsigned long long)p->read_sectors, |
230 | p->writes, (unsigned long long)p->write_sectors); | 250 | p->writes, (unsigned long long)p->write_sectors); |
231 | } | 251 | } |
252 | static struct part_attribute part_attr_uevent = { | ||
253 | .attr = {.name = "uevent", .mode = S_IWUSR }, | ||
254 | .store = part_uevent_store | ||
255 | }; | ||
232 | static struct part_attribute part_attr_dev = { | 256 | static struct part_attribute part_attr_dev = { |
233 | .attr = {.name = "dev", .mode = S_IRUGO }, | 257 | .attr = {.name = "dev", .mode = S_IRUGO }, |
234 | .show = part_dev_read | 258 | .show = part_dev_read |
@@ -247,6 +271,7 @@ static struct part_attribute part_attr_stat = { | |||
247 | }; | 271 | }; |
248 | 272 | ||
249 | static struct attribute * default_attrs[] = { | 273 | static struct attribute * default_attrs[] = { |
274 | &part_attr_uevent.attr, | ||
250 | &part_attr_dev.attr, | 275 | &part_attr_dev.attr, |
251 | &part_attr_start.attr, | 276 | &part_attr_start.attr, |
252 | &part_attr_size.attr, | 277 | &part_attr_size.attr, |
@@ -430,7 +455,7 @@ void del_gendisk(struct gendisk *disk) | |||
430 | disk->flags &= ~GENHD_FL_UP; | 455 | disk->flags &= ~GENHD_FL_UP; |
431 | unlink_gendisk(disk); | 456 | unlink_gendisk(disk); |
432 | disk_stat_set_all(disk, 0); | 457 | disk_stat_set_all(disk, 0); |
433 | disk->stamp = disk->stamp_idle = 0; | 458 | disk->stamp = 0; |
434 | 459 | ||
435 | devfs_remove_disk(disk); | 460 | devfs_remove_disk(disk); |
436 | 461 | ||