cregit-Linux how code gets into the kernel

Release 4.17 fs/proc/devices.c

Directory: fs/proc
// SPDX-License-Identifier: GPL-2.0
#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; if (i < CHRDEV_MAJOR_MAX) { if (i == 0) seq_puts(f, "Character devices:\n"); chrdev_show(f, i); } #ifdef CONFIG_BLOCK else { i -= CHRDEV_MAJOR_MAX; if (i == 0) seq_puts(f, "\nBlock devices:\n"); blkdev_show(f, i); } #endif return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Alexey Dobriyan8697.73%266.67%
Logan Gunthorpe22.27%133.33%
Total88100.00%3100.00%


static void *devinfo_start(struct seq_file *f, loff_t *pos) { if (*pos < (BLKDEV_MAJOR_MAX + CHRDEV_MAJOR_MAX)) return pos; return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Alexey Dobriyan3193.94%133.33%
Logan Gunthorpe26.06%266.67%
Total33100.00%3100.00%


static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos) { (*pos)++; if (*pos >= (BLKDEV_MAJOR_MAX + CHRDEV_MAJOR_MAX)) return NULL; return pos; }

Contributors

PersonTokensPropCommitsCommitProp
Alexey Dobriyan4195.35%133.33%
Logan Gunthorpe24.65%266.67%
Total43100.00%3100.00%


static void devinfo_stop(struct seq_file *f, void *v) { /* Nothing to do */ }

Contributors

PersonTokensPropCommitsCommitProp
Alexey Dobriyan16100.00%1100.00%
Total16100.00%1100.00%

static const struct seq_operations devinfo_ops = { .start = devinfo_start, .next = devinfo_next, .stop = devinfo_stop, .show = devinfo_show };
static int devinfo_open(struct inode *inode, struct file *filp) { return seq_open(filp, &devinfo_ops); }

Contributors

PersonTokensPropCommitsCommitProp
Alexey Dobriyan25100.00%1100.00%
Total25100.00%1100.00%

static const struct file_operations proc_devinfo_operations = { .open = devinfo_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, };
static int __init proc_devices_init(void) { proc_create("devices", 0, NULL, &proc_devinfo_operations); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Alexey Dobriyan24100.00%1100.00%
Total24100.00%1100.00%

fs_initcall(proc_devices_init);

Overall Contributors

PersonTokensPropCommitsCommitProp
Alexey Dobriyan29597.36%233.33%
Logan Gunthorpe61.98%233.33%
Paul Gortmaker10.33%116.67%
Greg Kroah-Hartman10.33%116.67%
Total303100.00%6100.00%
Directory: fs/proc
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.