root/include/linux/proc_fs.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. proc_net_register
  2. proc_net_unregister
  3. proc_scsi_register
  4. proc_scsi_unregister

   1 #ifndef _LINUX_PROC_FS_H
   2 #define _LINUX_PROC_FS_H
   3 
   4 #include <linux/fs.h>
   5 #include <linux/malloc.h>
   6 
   7 /*
   8  * The proc filesystem constants/structures
   9  */
  10 
  11 /*
  12  * We always define these enumerators
  13  */
  14 
  15 enum root_directory_inos {
  16         PROC_ROOT_INO = 1,
  17         PROC_LOADAVG,
  18         PROC_UPTIME,
  19         PROC_MEMINFO,
  20         PROC_KMSG,
  21         PROC_VERSION,
  22         PROC_CPUINFO,
  23         PROC_PCI,
  24         PROC_SELF,      /* will change inode # */
  25         PROC_NET,
  26         PROC_SCSI,
  27         PROC_MALLOC,
  28         PROC_KCORE,
  29         PROC_MODULES,
  30         PROC_STAT,
  31         PROC_DEVICES,
  32         PROC_INTERRUPTS,
  33         PROC_FILESYSTEMS,
  34         PROC_KSYMS,
  35         PROC_DMA,       
  36         PROC_IOPORTS,
  37         PROC_APM,
  38         PROC_PROFILE, /* whether enabled or not */
  39         PROC_CMDLINE,
  40         PROC_SYS
  41 };
  42 
  43 enum pid_directory_inos {
  44         PROC_PID_INO = 2,
  45         PROC_PID_MEM,
  46         PROC_PID_CWD,
  47         PROC_PID_ROOT,
  48         PROC_PID_EXE,
  49         PROC_PID_FD,
  50         PROC_PID_ENVIRON,
  51         PROC_PID_CMDLINE,
  52         PROC_PID_STAT,
  53         PROC_PID_STATM,
  54         PROC_PID_MAPS
  55 };
  56 
  57 enum pid_subdirectory_inos {
  58         PROC_PID_FD_DIR = 1
  59 };
  60 
  61 enum net_directory_inos {
  62         PROC_NET_UNIX = 128,
  63         PROC_NET_ARP,
  64         PROC_NET_ROUTE,
  65         PROC_NET_DEV,
  66         PROC_NET_RAW,
  67         PROC_NET_TCP,
  68         PROC_NET_UDP,
  69         PROC_NET_SNMP,
  70         PROC_NET_RARP,
  71         PROC_NET_IGMP,
  72         PROC_NET_IPMR_VIF,
  73         PROC_NET_IPMR_MFC,
  74         PROC_NET_IPFWFWD,
  75         PROC_NET_IPFWBLK,
  76         PROC_NET_IPACCT,
  77         PROC_NET_IPMSQHST,
  78         PROC_NET_WAVELAN,
  79         PROC_NET_IPX_INTERFACE,
  80         PROC_NET_IPX_ROUTE,
  81         PROC_NET_IPX,
  82         PROC_NET_ATALK,
  83         PROC_NET_AT_ROUTE,
  84         PROC_NET_ATIF,
  85         PROC_NET_AX25_ROUTE,
  86         PROC_NET_AX25,
  87         PROC_NET_AX25_CALLS,
  88         PROC_NET_NR_NODES,
  89         PROC_NET_NR_NEIGH,
  90         PROC_NET_NR,
  91         PROC_NET_SOCKSTAT,
  92         PROC_NET_RTCACHE,
  93         PROC_NET_AX25_BPQETHER,
  94         PROC_NET_ALIAS_TYPES,
  95         PROC_NET_ALIASES,
  96         PROC_NET_LAST
  97 };
  98 
  99 enum scsi_directory_inos {
 100         PROC_SCSI_SCSI = 256,
 101         PROC_SCSI_EATA,
 102         PROC_SCSI_EATA_PIO,
 103         PROC_SCSI_AHA152X,
 104         PROC_SCSI_AHA1542,
 105         PROC_SCSI_AHA1740,
 106         PROC_SCSI_AIC7XXX,
 107         PROC_SCSI_BUSLOGIC,
 108         PROC_SCSI_U14_34F,
 109         PROC_SCSI_FDOMAIN,
 110         PROC_SCSI_GENERIC_NCR5380,
 111         PROC_SCSI_IN2000,
 112         PROC_SCSI_PAS16,
 113         PROC_SCSI_QLOGIC,
 114         PROC_SCSI_SEAGATE,
 115         PROC_SCSI_T128,
 116         PROC_SCSI_NCR53C7xx,
 117         PROC_SCSI_ULTRASTOR,
 118         PROC_SCSI_7000FASST,
 119         PROC_SCSI_EATA2X,
 120         PROC_SCSI_SSC,
 121         PROC_SCSI_SCSI_DEBUG,   
 122         PROC_SCSI_NOT_PRESENT,
 123         PROC_SCSI_FILE,                        /* I'm asuming here that we */
 124         PROC_SCSI_LAST = (PROC_SCSI_FILE + 16) /* won't ever see more than */
 125 };                                             /* 16 HBAs in one machine   */
 126 
 127 /* Finally, the dynamically allocatable proc entries are reserved: */
 128 
 129 #define PROC_DYNAMIC_FIRST 4096
 130 #define PROC_NDYNAMIC      4096
 131 
 132 #define PROC_SUPER_MAGIC 0x9fa0
 133 
 134 /*
 135  * This is not completely implemented yet. The idea is to
 136  * create a in-memory tree (like the actual /proc filesystem
 137  * tree) of these proc_dir_entries, so that we can dynamically
 138  * add new files to /proc.
 139  *
 140  * The "next" pointer creates a linked list of one /proc directory,
 141  * while parent/subdir create the directory structure (every
 142  * /proc file has a parent, but "subdir" is NULL for all
 143  * non-directory entries).
 144  *
 145  * "get_info" is called at "read", while "fill_inode" is used to
 146  * fill in file type/protection/owner information specific to the
 147  * particular /proc file.
 148  */
 149 struct proc_dir_entry {
 150         unsigned short low_ino;
 151         unsigned short namelen;
 152         const char *name;
 153         mode_t mode;
 154         nlink_t nlink;
 155         uid_t uid;
 156         gid_t gid;
 157         unsigned long size;
 158         struct inode_operations * ops;
 159         int (*get_info)(char *, char **, off_t, int, int);
 160         void (*fill_inode)(struct inode *);
 161         struct proc_dir_entry *next, *parent, *subdir;
 162         void *data;
 163 };
 164 
 165 extern struct proc_dir_entry proc_root;
 166 extern struct proc_dir_entry proc_net;
 167 extern struct proc_dir_entry proc_scsi;
 168 extern struct proc_dir_entry proc_sys;
 169 extern struct proc_dir_entry proc_pid;
 170 extern struct proc_dir_entry proc_pid_fd;
 171 
 172 extern struct inode_operations proc_scsi_inode_operations;
 173 
 174 extern void proc_root_init(void);
 175 extern void proc_base_init(void);
 176 extern void proc_net_init(void);
 177 
 178 extern int proc_register(struct proc_dir_entry *, struct proc_dir_entry *);
 179 extern int proc_register_dynamic(struct proc_dir_entry *, 
 180                                  struct proc_dir_entry *);
 181 extern int proc_unregister(struct proc_dir_entry *, int);
 182 
 183 static inline int proc_net_register(struct proc_dir_entry * x)
     /* [previous][next][first][last][top][bottom][index][help] */
 184 {
 185         return proc_register(&proc_net, x);
 186 }
 187 
 188 static inline int proc_net_unregister(int x)
     /* [previous][next][first][last][top][bottom][index][help] */
 189 {
 190         return proc_unregister(&proc_net, x);
 191 }
 192 
 193 static inline int proc_scsi_register(struct proc_dir_entry *driver, 
     /* [previous][next][first][last][top][bottom][index][help] */
 194                                      struct proc_dir_entry *x)
 195 {
 196     x->ops = &proc_scsi_inode_operations;
 197     if(x->low_ino < PROC_SCSI_FILE){
 198         return(proc_register(&proc_scsi, x));
 199     }else{
 200         return(proc_register(driver, x));
 201     }
 202 }
 203 
 204 static inline int proc_scsi_unregister(struct proc_dir_entry *driver, int x)
     /* [previous][next][first][last][top][bottom][index][help] */
 205 {
 206     extern void scsi_init_free(char *ptr, unsigned int size);
 207 
 208     if(x <= PROC_SCSI_FILE)
 209         return(proc_unregister(&proc_scsi, x));
 210     else {
 211         struct proc_dir_entry **p = &driver->subdir, *dp;
 212         int ret;
 213 
 214         while ((dp = *p) != NULL) {
 215                 if (dp->low_ino == x) 
 216                     break;
 217                 p = &dp->next;
 218         }
 219         ret = proc_unregister(driver, x);
 220         scsi_init_free((char *) dp, sizeof(struct proc_dir_entry) + 4);
 221         return(ret);
 222     }
 223 }
 224 
 225 extern struct super_block *proc_read_super(struct super_block *,void *,int);
 226 extern struct inode * proc_get_inode(struct super_block *, int, struct proc_dir_entry *);
 227 extern void proc_statfs(struct super_block *, struct statfs *, int);
 228 extern void proc_read_inode(struct inode *);
 229 extern void proc_write_inode(struct inode *);
 230 extern int proc_match(int, const char *, struct proc_dir_entry *);
 231 
 232 /*
 233  * These are generic /proc routines that use the internal
 234  * "struct proc_dir_entry" tree to traverse the filesystem.
 235  *
 236  * The /proc root directory has extended versions to take care
 237  * of the /proc/<pid> subdirectories.
 238  */
 239 extern int proc_readdir(struct inode *, struct file *, void *, filldir_t);
 240 extern int proc_lookup(struct inode *, const char *, int, struct inode **);
 241 
 242 extern struct inode_operations proc_dir_inode_operations;
 243 extern struct inode_operations proc_net_inode_operations;
 244 extern struct inode_operations proc_netdir_inode_operations;
 245 extern struct inode_operations proc_scsi_inode_operations;
 246 extern struct inode_operations proc_mem_inode_operations;
 247 extern struct inode_operations proc_sys_inode_operations;
 248 extern struct inode_operations proc_array_inode_operations;
 249 extern struct inode_operations proc_arraylong_inode_operations;
 250 extern struct inode_operations proc_kcore_inode_operations;
 251 extern struct inode_operations proc_profile_inode_operations;
 252 extern struct inode_operations proc_kmsg_inode_operations;
 253 extern struct inode_operations proc_link_inode_operations;
 254 extern struct inode_operations proc_fd_inode_operations;
 255 
 256 #endif

/* [previous][next][first][last][top][bottom][index][help] */