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

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