Commit 2c0145c6 authored by Patrick Mochel's avatar Patrick Mochel

sysfs: fix up block and partition sysfs callbacks.

Remove @count and @off parameters from all show() and store() methods for
sysfs attribute files.
parent 82cd7fff
...@@ -276,17 +276,17 @@ subsys_initcall(device_init); ...@@ -276,17 +276,17 @@ subsys_initcall(device_init);
struct disk_attribute { struct disk_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct gendisk *, char *, size_t, loff_t); ssize_t (*show)(struct gendisk *, char *);
}; };
static ssize_t disk_attr_show(struct kobject * kobj, struct attribute * attr, static ssize_t disk_attr_show(struct kobject * kobj, struct attribute * attr,
char * page, size_t count, loff_t off) char * page)
{ {
struct gendisk * disk = to_disk(kobj); struct gendisk * disk = to_disk(kobj);
struct disk_attribute * disk_attr = container_of(attr,struct disk_attribute,attr); struct disk_attribute * disk_attr = container_of(attr,struct disk_attribute,attr);
ssize_t ret = 0; ssize_t ret = 0;
if (disk_attr->show) if (disk_attr->show)
ret = disk_attr->show(disk,page,count,off); ret = disk_attr->show(disk,page);
return ret; return ret;
} }
...@@ -294,21 +294,18 @@ static struct sysfs_ops disk_sysfs_ops = { ...@@ -294,21 +294,18 @@ static struct sysfs_ops disk_sysfs_ops = {
.show = &disk_attr_show, .show = &disk_attr_show,
}; };
static ssize_t disk_dev_read(struct gendisk * disk, static ssize_t disk_dev_read(struct gendisk * disk, char *page)
char *page, size_t count, loff_t off)
{ {
dev_t base = MKDEV(disk->major, disk->first_minor); dev_t base = MKDEV(disk->major, disk->first_minor);
return off ? 0 : sprintf(page, "%04x\n",base); return sprintf(page, "%04x\n",base);
} }
static ssize_t disk_range_read(struct gendisk * disk, static ssize_t disk_range_read(struct gendisk * disk, char *page)
char *page, size_t count, loff_t off)
{ {
return off ? 0 : sprintf(page, "%d\n",disk->minors); return sprintf(page, "%d\n",disk->minors);
} }
static ssize_t disk_size_read(struct gendisk * disk, static ssize_t disk_size_read(struct gendisk * disk, char *page)
char *page, size_t count, loff_t off)
{ {
return off ? 0 : sprintf(page, "%llu\n",(unsigned long long)get_capacity(disk)); return sprintf(page, "%llu\n",(unsigned long long)get_capacity(disk));
} }
static inline unsigned jiffies_to_msec(unsigned jif) static inline unsigned jiffies_to_msec(unsigned jif)
...@@ -321,11 +318,10 @@ static inline unsigned jiffies_to_msec(unsigned jif) ...@@ -321,11 +318,10 @@ static inline unsigned jiffies_to_msec(unsigned jif)
return (jif / HZ) * 1000 + (jif % HZ) * 1000 / HZ; return (jif / HZ) * 1000 + (jif % HZ) * 1000 / HZ;
#endif #endif
} }
static ssize_t disk_stat_read(struct gendisk * disk, static ssize_t disk_stat_read(struct gendisk * disk, char *page)
char *page, size_t count, loff_t off)
{ {
disk_round_stats(disk); disk_round_stats(disk);
return off ? 0 : sprintf(page, return sprintf(page,
"%8u %8u %8llu %8u " "%8u %8u %8llu %8u "
"%8u %8u %8llu %8u " "%8u %8u %8llu %8u "
"%8u %8u %8u" "%8u %8u %8u"
......
...@@ -274,17 +274,17 @@ static void devfs_remove_partitions(struct gendisk *dev) ...@@ -274,17 +274,17 @@ static void devfs_remove_partitions(struct gendisk *dev)
struct part_attribute { struct part_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct hd_struct *,char *,size_t,loff_t); ssize_t (*show)(struct hd_struct *,char *);
}; };
static ssize_t part_attr_show(struct kobject * kobj, struct attribute * attr, static ssize_t
char * page, size_t count, loff_t off) part_attr_show(struct kobject * kobj, struct attribute * attr, char * page)
{ {
struct hd_struct * p = container_of(kobj,struct hd_struct,kobj); struct hd_struct * p = container_of(kobj,struct hd_struct,kobj);
struct part_attribute * part_attr = container_of(attr,struct part_attribute,attr); struct part_attribute * part_attr = container_of(attr,struct part_attribute,attr);
ssize_t ret = 0; ssize_t ret = 0;
if (part_attr->show) if (part_attr->show)
ret = part_attr->show(p,page,count,off); ret = part_attr->show(p,page);
return ret; return ret;
} }
...@@ -292,30 +292,26 @@ static struct sysfs_ops part_sysfs_ops = { ...@@ -292,30 +292,26 @@ static struct sysfs_ops part_sysfs_ops = {
.show = part_attr_show, .show = part_attr_show,
}; };
static ssize_t part_dev_read(struct hd_struct * p, static ssize_t part_dev_read(struct hd_struct * p, char *page)
char *page, size_t count, loff_t off)
{ {
struct gendisk *disk = container_of(p->kobj.parent,struct gendisk,kobj); struct gendisk *disk = container_of(p->kobj.parent,struct gendisk,kobj);
int part = p - disk->part + 1; int part = p - disk->part + 1;
dev_t base = MKDEV(disk->major, disk->first_minor); dev_t base = MKDEV(disk->major, disk->first_minor);
return off ? 0 : sprintf(page, "%04x\n",base + part); return sprintf(page, "%04x\n",base + part);
} }
static ssize_t part_start_read(struct hd_struct * p, static ssize_t part_start_read(struct hd_struct * p, char *page)
char *page, size_t count, loff_t off)
{ {
return off ? 0 : sprintf(page, "%llu\n",(unsigned long long)p->start_sect); return sprintf(page, "%llu\n",(unsigned long long)p->start_sect);
} }
static ssize_t part_size_read(struct hd_struct * p, static ssize_t part_size_read(struct hd_struct * p, char *page)
char *page, size_t count, loff_t off)
{ {
return off ? 0 : sprintf(page, "%llu\n",(unsigned long long)p->nr_sects); return sprintf(page, "%llu\n",(unsigned long long)p->nr_sects);
} }
static ssize_t part_stat_read(struct hd_struct * p, static ssize_t part_stat_read(struct hd_struct * p, char *page)
char *page, size_t count, loff_t off)
{ {
return off ? 0 : sprintf(page, "%8u %8llu %8u %8llu\n", return sprintf(page, "%8u %8llu %8u %8llu\n",
p->reads, (unsigned long long)p->read_sectors, p->reads, (unsigned long long)p->read_sectors,
p->writes, (unsigned long long)p->write_sectors); p->writes, (unsigned long long)p->write_sectors);
} }
static struct part_attribute part_attr_dev = { static struct part_attribute part_attr_dev = {
.attr = {.name = "dev", .mode = S_IRUGO }, .attr = {.name = "dev", .mode = S_IRUGO },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment