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

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