Listing 5. The proc_dir_entry Structure
struct proc_dir_entry burp_proc_root = {
0, /* low_ino: the inode -- dynamic */
4, "root", /* len of name and name */
S_IFBLK | 0600, /* mode: block device, r/w by owner */
1, 0, 0, /* nlinks, owner (root), group (root) */
0, &blkdev_inode_operations, /* size (unused), inode ops */
NULL, /* get_info: unused */
burp_root_fill_ino, /* fill_inode: tell your major/minor */
/* nothing more */
};
struct proc_dir_entry burp_proc_insmod = {
0, /* low_ino: the inode -- dynamic */
6, "insmod", /* len of name and name */
S_IFREG | S_IWUGO, /* mode: REGular, Write UserGroupOther */
1, 0, 0, /* nlinks, owner (root), group (root) */
0, &burp_insmod_iops, /* size - unused; inode ops */
};
struct proc_dir_entry burp_proc_jiffies = {
0, /* low_ino: the inode -- dynamic */
7, "jiffies", /* len of name and name */
S_IFREG | S_IRUGO, /* mode: regular, read by anyone */
1, 0, 0, /* nlinks, owner (root), group (root) */
11, NULL, /* size is 11; inode ops unused */
burp_read_jiffies, /* use "get_info" instead */
};
Copyright © 1994 - 2019 Linux Journal. All rights reserved.