[PATCH] Simplify proc/devices and fix early termination regression

Make baby-simple the code for /proc/devices.  Based on the proven design
for /proc/interrupts.

This also fixes the early-termination regression 2.6.16 introduced, as
demonstrated by:

    # dd if=/proc/devices bs=1
    Character devices:
      1 mem
    27+0 records in
    27+0 records out

This should also work (but is untested) when /proc/devices >4096 bytes,
which I believe is what the original 2.6.16 rewrite fixed.

[akpm@osdl.org: cleanups, simplifications]
Signed-off-by: Joe Korty <joe.korty@ccur.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Joe Korty 2006-03-31 02:30:32 -08:00 committed by Linus Torvalds
parent a2c348fe01
commit 68eef3b479
4 changed files with 79 additions and 323 deletions

View file

@ -1413,6 +1413,7 @@ extern void bd_release_from_disk(struct block_device *, struct gendisk *);
#endif
/* fs/char_dev.c */
#define CHRDEV_MAJOR_HASH_SIZE 255
extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
extern int register_chrdev_region(dev_t, unsigned, const char *);
extern int register_chrdev(unsigned int, const char *,
@ -1420,25 +1421,17 @@ extern int register_chrdev(unsigned int, const char *,
extern int unregister_chrdev(unsigned int, const char *);
extern void unregister_chrdev_region(dev_t, unsigned);
extern int chrdev_open(struct inode *, struct file *);
extern int get_chrdev_list(char *);
extern void *acquire_chrdev_list(void);
extern int count_chrdev_list(void);
extern void *get_next_chrdev(void *);
extern int get_chrdev_info(void *, int *, char **);
extern void release_chrdev_list(void *);
extern void chrdev_show(struct seq_file *,off_t);
/* fs/block_dev.c */
#define BLKDEV_MAJOR_HASH_SIZE 255
#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
extern const char *__bdevname(dev_t, char *buffer);
extern const char *bdevname(struct block_device *bdev, char *buffer);
extern struct block_device *lookup_bdev(const char *);
extern struct block_device *open_bdev_excl(const char *, int, void *);
extern void close_bdev_excl(struct block_device *);
extern void *acquire_blkdev_list(void);
extern int count_blkdev_list(void);
extern void *get_next_blkdev(void *);
extern int get_blkdev_info(void *, int *, char **);
extern void release_blkdev_list(void *);
extern void blkdev_show(struct seq_file *,off_t);
extern void init_special_inode(struct inode *, umode_t, dev_t);