| // SPDX-License-Identifier: GPL-2.0 |
| #include <linux/proc_fs.h> |
| #include <linux/seq_file.h> |
| static int devinfo_show(struct seq_file *f, void *v) |
| if (i < CHRDEV_MAJOR_MAX) { |
| seq_puts(f, "Character devices:\n"); |
| seq_puts(f, "\nBlock devices:\n"); |
| static void *devinfo_start(struct seq_file *f, loff_t *pos) |
| if (*pos < (BLKDEV_MAJOR_MAX + CHRDEV_MAJOR_MAX)) |
| static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos) |
| if (*pos >= (BLKDEV_MAJOR_MAX + CHRDEV_MAJOR_MAX)) |
| static void devinfo_stop(struct seq_file *f, void *v) |
| static const struct seq_operations devinfo_ops = { |
| static int __init proc_devices_init(void) |
| proc_create_seq("devices", 0, NULL, &devinfo_ops); |
| fs_initcall(proc_devices_init); |