Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 2924
b: refs/heads/master
c: ac20427
h: refs/heads/master
v: v3
  • Loading branch information
Neil Horman authored and Linus Torvalds committed Jun 23, 2005
1 parent f42a4c4 commit b53c28e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 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: 3bc1ee3e8f1c05c0f64a479c6d56eb34a6190599
refs/heads/master: ac20427ef6aa63da663bdc88b71d16f7394f5e23
12 changes: 10 additions & 2 deletions trunk/drivers/block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static inline int major_to_index(int major)

#ifdef CONFIG_PROC_FS
/* get block device names in somewhat random order */
int get_blkdev_list(char *p)
int get_blkdev_list(char *p, int used)
{
struct blk_major_name *n;
int i, len;
Expand All @@ -49,10 +49,18 @@ int get_blkdev_list(char *p)

down(&block_subsys_sem);
for (i = 0; i < ARRAY_SIZE(major_names); i++) {
for (n = major_names[i]; n; n = n->next)
for (n = major_names[i]; n; n = n->next) {
/*
* If the curent string plus the 5 extra characters
* in the line would run us off the page, then we're done
*/
if ((len + used + strlen(n->name) + 5) >= PAGE_SIZE)
goto page_full;
len += sprintf(p+len, "%3d %s\n",
n->major, n->name);
}
}
page_full:
up(&block_subsys_sem);

return len;
Expand Down
13 changes: 12 additions & 1 deletion trunk/fs/char_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,21 @@ int get_chrdev_list(char *page)

down(&chrdevs_lock);
for (i = 0; i < ARRAY_SIZE(chrdevs) ; i++) {
for (cd = chrdevs[i]; cd; cd = cd->next)
for (cd = chrdevs[i]; cd; cd = cd->next) {
/*
* if the current name, plus the 5 extra characters
* in the device line for this entry
* would run us off the page, we're done
*/
if ((len+strlen(cd->name) + 5) >= PAGE_SIZE)
goto page_full;


len += sprintf(page+len, "%3d %s\n",
cd->major, cd->name);
}
}
page_full:
up(&chrdevs_lock);

return len;
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/proc/proc_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ static int devices_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int len = get_chrdev_list(page);
len += get_blkdev_list(page+len);
len += get_blkdev_list(page+len, len);
return proc_calc_metrics(page, start, off, count, eof, len);
}

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 @@ -224,7 +224,7 @@ static inline void free_disk_stats(struct gendisk *disk)
extern void disk_round_stats(struct gendisk *disk);

/* drivers/block/genhd.c */
extern int get_blkdev_list(char *);
extern int get_blkdev_list(char *, int);
extern void add_disk(struct gendisk *disk);
extern void del_gendisk(struct gendisk *gp);
extern void unlink_gendisk(struct gendisk *gp);
Expand Down

0 comments on commit b53c28e

Please sign in to comment.