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

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