Blame view
fs/proc/devices.c
1.13 KB
b24413180 License cleanup: ... |
1 |
// SPDX-License-Identifier: GPL-2.0 |
fe2510426 proc: move /proc/... |
2 3 4 5 6 7 8 9 |
#include <linux/fs.h> #include <linux/init.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> static int devinfo_show(struct seq_file *f, void *v) { int i = *(loff_t *) v; |
8a932f73e char_dev: order /... |
10 |
if (i < CHRDEV_MAJOR_MAX) { |
fe2510426 proc: move /proc/... |
11 |
if (i == 0) |
9d6de12f7 proc: use seq_put... |
12 13 |
seq_puts(f, "Character devices: "); |
fe2510426 proc: move /proc/... |
14 15 16 17 |
chrdev_show(f, i); } #ifdef CONFIG_BLOCK else { |
8a932f73e char_dev: order /... |
18 |
i -= CHRDEV_MAJOR_MAX; |
fe2510426 proc: move /proc/... |
19 |
if (i == 0) |
9d6de12f7 proc: use seq_put... |
20 21 22 |
seq_puts(f, " Block devices: "); |
fe2510426 proc: move /proc/... |
23 24 25 26 27 28 29 30 |
blkdev_show(f, i); } #endif return 0; } static void *devinfo_start(struct seq_file *f, loff_t *pos) { |
133d55cdb block: order /pro... |
31 |
if (*pos < (BLKDEV_MAJOR_MAX + CHRDEV_MAJOR_MAX)) |
fe2510426 proc: move /proc/... |
32 33 34 35 36 37 38 |
return pos; return NULL; } static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos) { (*pos)++; |
133d55cdb block: order /pro... |
39 |
if (*pos >= (BLKDEV_MAJOR_MAX + CHRDEV_MAJOR_MAX)) |
fe2510426 proc: move /proc/... |
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
return NULL; return pos; } static void devinfo_stop(struct seq_file *f, void *v) { /* Nothing to do */ } static const struct seq_operations devinfo_ops = { .start = devinfo_start, .next = devinfo_next, .stop = devinfo_stop, .show = devinfo_show }; |
fe2510426 proc: move /proc/... |
55 56 |
static int __init proc_devices_init(void) { |
fddda2b7b proc: introduce p... |
57 |
proc_create_seq("devices", 0, NULL, &devinfo_ops); |
fe2510426 proc: move /proc/... |
58 59 |
return 0; } |
abaf3787a fs/proc: don't us... |
60 |
fs_initcall(proc_devices_init); |