#include #include #include int my_read(char *, char **, off_t, int, int) ; /* * proc root can do almost nothing.. */ static struct inode_operations proc_root_inode_operations = { &proc_root_operations, /* default base directory file-ops */ NULL, /* create */ proc_root_lookup, /* lookup */ NULL, /* link */ NULL, /* unlink */ NULL, /* symlink */ NULL, /* mkdir */ NULL, /* rmdir */ NULL, /* mknod */ NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ NULL, /* readpage */ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ NULL /* permission */ }; /* * This is the root "inode" in the /proc tree.. */ struct proc_dir_entry proc_root = { PROC_ROOT_INO, 5, "/proc", S_IFDIR | S_IRUGO | S_IXUGO, 2, 0, 0, 0, &proc_root_inode_operations, NULL, NULL, NULL, &proc_root, NULL }; struct proc_dir_entry my_mod_proc_file = { 0, 12, "timer_module", S_IFREG | S_IRUGO, 1, 0, 0, 0, NULL, my_read, NULL}; int int_module() { /* proc_root is the root of /proc */ return proc_register(&proc_root, &my_mod_proc_file); } void cleanup_module() { proc_unregister(&proc_root, my_mod_proc_file.low_ino); }