1c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#ifndef _LINUX_PROC_FS_H 2c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define _LINUX_PROC_FS_H 3c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 4c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#include <linux/slab.h> 5c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#include <linux/fs.h> 6c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#include <linux/spinlock.h> 7c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#include <asm/atomic.h> 8c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 9c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 10c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * The proc filesystem constants/structures 11c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 12c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 13c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 14c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * Offset of the first process in the /proc root directory.. 15c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 16c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define FIRST_PROCESS_ENTRY 256 17c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 18c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 19c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 20c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * We always define these enumerators 21c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 22c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 23c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruenum { 24c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru PROC_ROOT_INO = 1, 25c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru}; 26c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 27c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define PROC_SUPER_MAGIC 0x9fa0 28c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 29c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 30c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * This is not completely implemented yet. The idea is to 31c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * create an in-memory tree (like the actual /proc filesystem 32c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * tree) of these proc_dir_entries, so that we can dynamically 33c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * add new files to /proc. 34c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * 35c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * The "next" pointer creates a linked list of one /proc directory, 36c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * while parent/subdir create the directory structure (every 37c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * /proc file has a parent, but "subdir" is NULL for all 38c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * non-directory entries). 39c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * 40c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * "get_info" is called at "read", while "owner" is used to protect module 41c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * from unloading while proc_dir_entry is in use 42c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 43c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 44c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querutypedef int (read_proc_t)(char *page, char **start, off_t off, 45c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru int count, int *eof, void *data); 46c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querutypedef int (write_proc_t)(struct file *file, const char __user *buffer, 47c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru unsigned long count, void *data); 48c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querutypedef int (get_info_t)(char *, char **, off_t, int); 49c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 50c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct proc_dir_entry { 51c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru unsigned int low_ino; 52c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru unsigned short namelen; 53c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru const char *name; 54c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru mode_t mode; 55c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru nlink_t nlink; 56c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru uid_t uid; 57c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru gid_t gid; 58c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru loff_t size; 59c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct inode_operations * proc_iops; 60c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru const struct file_operations * proc_fops; 61c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru get_info_t *get_info; 62c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct module *owner; 63c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct proc_dir_entry *next, *parent, *subdir; 64c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru void *data; 65c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru read_proc_t *read_proc; 66c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru write_proc_t *write_proc; 67c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru atomic_t count; /* use count */ 68c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru int deleted; /* delete flag */ 69c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru void *set; 70c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru}; 71c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 72c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct kcore_list { 73c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct kcore_list *next; 74c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru unsigned long addr; 75c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru size_t size; 76c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru}; 77c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 78c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct vmcore { 79c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct list_head list; 80c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru unsigned long long paddr; 81c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru unsigned long long size; 82c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru loff_t offset; 83c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru}; 84c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 85c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#ifdef CONFIG_PROC_FS 86c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 87c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry proc_root; 88c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry *proc_root_fs; 89c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry *proc_net; 90c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry *proc_net_stat; 91c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry *proc_bus; 92c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry *proc_root_driver; 93c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry *proc_root_kcore; 94c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 95c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern spinlock_t proc_subdir_lock; 96c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 97c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void proc_root_init(void); 98c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void proc_misc_init(void); 99c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 100c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct mm_struct; 101c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 102c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruvoid proc_flush_task(struct task_struct *task); 103c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); 104c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruint proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); 105c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruunsigned long task_vsize(struct mm_struct *); 106c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruint task_statm(struct mm_struct *, int *, int *, int *, int *); 107c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruchar *task_mem(struct mm_struct *, char *); 108c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 109c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 110c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct proc_dir_entry *parent); 111c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); 112c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 113c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct vfsmount *proc_mnt; 114c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int proc_fill_super(struct super_block *,void *,int); 115c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct inode *proc_get_inode(struct super_block *, unsigned int, struct proc_dir_entry *); 116c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 117c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int proc_match(int, const char *,struct proc_dir_entry *); 118c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 119c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 120c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * These are generic /proc routines that use the internal 121c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * "struct proc_dir_entry" tree to traverse the filesystem. 122c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * 123c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * The /proc root directory has extended versions to take care 124c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * of the /proc/<pid> subdirectories. 125c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 126c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int proc_readdir(struct file *, void *, filldir_t); 127c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); 128c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 129c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern const struct file_operations proc_kcore_operations; 130c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern const struct file_operations proc_kmsg_operations; 131c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern const struct file_operations ppc_htab_operations; 132c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 133c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 134c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * proc_tty.c 135c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 136c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct tty_driver; 137c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void proc_tty_init(void); 138c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void proc_tty_register_driver(struct tty_driver *driver); 139c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void proc_tty_unregister_driver(struct tty_driver *driver); 140c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 141c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 142c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * proc_devtree.c 143c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 144c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#ifdef CONFIG_PROC_DEVICETREE 145c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct device_node; 146c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct property; 147c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void proc_device_tree_init(void); 148c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); 149c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); 150c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void proc_device_tree_remove_prop(struct proc_dir_entry *pde, 151c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct property *prop); 152c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void proc_device_tree_update_prop(struct proc_dir_entry *pde, 153c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct property *newprop, 154c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct property *oldprop); 155c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#endif /* CONFIG_PROC_DEVICETREE */ 156c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 157c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry *proc_symlink(const char *, 158c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct proc_dir_entry *, const char *); 159c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); 160c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, 161c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct proc_dir_entry *parent); 162c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 163c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline struct proc_dir_entry *create_proc_read_entry(const char *name, 164c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru mode_t mode, struct proc_dir_entry *base, 165c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru read_proc_t *read_proc, void * data) 166c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru{ 167c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct proc_dir_entry *res=create_proc_entry(name,mode,base); 168c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru if (res) { 169c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru res->read_proc=read_proc; 170c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru res->data=data; 171c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru } 172c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru return res; 173c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru} 174c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 175c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline struct proc_dir_entry *create_proc_info_entry(const char *name, 176c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru mode_t mode, struct proc_dir_entry *base, get_info_t *get_info) 177c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru{ 178c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct proc_dir_entry *res=create_proc_entry(name,mode,base); 179c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru if (res) res->get_info=get_info; 180c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru return res; 181c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru} 182c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 183c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline struct proc_dir_entry *proc_net_create(const char *name, 184c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru mode_t mode, get_info_t *get_info) 185c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru{ 186c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru return create_proc_info_entry(name,mode,proc_net,get_info); 187c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru} 188c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 189c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline struct proc_dir_entry *proc_net_fops_create(const char *name, 190c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru mode_t mode, const struct file_operations *fops) 191c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru{ 192c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net); 193c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru if (res) 194c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru res->proc_fops = fops; 195c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru return res; 196c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru} 197c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 198c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline void proc_net_remove(const char *name) 199c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru{ 200c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru remove_proc_entry(name,proc_net); 201c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru} 202c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 203c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#else 204c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 205c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define proc_root_driver NULL 206c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define proc_net NULL 207c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define proc_bus NULL 208c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 209c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define proc_net_fops_create(name, mode, fops) ({ (void)(mode), NULL; }) 210c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define proc_net_create(name, mode, info) ({ (void)(mode), NULL; }) 211c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline void proc_net_remove(const char *name) {} 212c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 213c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline void proc_flush_task(struct task_struct *task) { } 214c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 215c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline struct proc_dir_entry *create_proc_entry(const char *name, 216c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru mode_t mode, struct proc_dir_entry *parent) { return NULL; } 217c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 218c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define remove_proc_entry(name, parent) do {} while (0) 219c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 220c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline struct proc_dir_entry *proc_symlink(const char *name, 221c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct proc_dir_entry *parent,const char *dest) {return NULL;} 222c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline struct proc_dir_entry *proc_mkdir(const char *name, 223c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct proc_dir_entry *parent) {return NULL;} 224c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 225c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline struct proc_dir_entry *create_proc_read_entry(const char *name, 226c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru mode_t mode, struct proc_dir_entry *base, 227c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru read_proc_t *read_proc, void * data) { return NULL; } 228c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline struct proc_dir_entry *create_proc_info_entry(const char *name, 229c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru mode_t mode, struct proc_dir_entry *base, get_info_t *get_info) 230c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru { return NULL; } 231c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 232c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct tty_driver; 233c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline void proc_tty_register_driver(struct tty_driver *driver) {}; 234c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; 235c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 236c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct proc_dir_entry proc_root; 237c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 238c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#endif /* CONFIG_PROC_FS */ 239c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 240c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#if !defined(CONFIG_PROC_KCORE) 241c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline void kclist_add(struct kcore_list *new, void *addr, size_t size) 242c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru{ 243c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru} 244c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#else 245c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern void kclist_add(struct kcore_list *, void *, size_t); 246c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#endif 247c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 248c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct proc_inode { 249c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct pid *pid; 250c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru int fd; 251c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru union { 252c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **); 253c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru int (*proc_read)(struct task_struct *task, char *page); 254c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru } op; 255c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct proc_dir_entry *pde; 256c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct inode vfs_inode; 257c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru}; 258c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 259c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline struct proc_inode *PROC_I(const struct inode *inode) 260c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru{ 261c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru return container_of(inode, struct proc_inode, vfs_inode); 262c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru} 263c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 264c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline struct proc_dir_entry *PDE(const struct inode *inode) 265c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru{ 266c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru return PROC_I(inode)->pde; 267c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru} 268c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 269c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct proc_maps_private { 270c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct pid *pid; 271c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct task_struct *task; 272c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct vm_area_struct *tail_vma; 273c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru}; 274c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 275c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#endif /* _LINUX_PROC_FS_H */ 276