patch-2.3.25 linux/include/linux/proc_fs.h
Next file: linux/include/linux/sem.h
Previous file: linux/include/linux/pci_ids.h
Back to the patch index
Back to the overall index
- Lines: 384
- Date:
Mon Nov 1 13:38:26 1999
- Orig file:
v2.3.24/linux/include/linux/proc_fs.h
- Orig date:
Fri Oct 22 13:21:55 1999
diff -u --recursive --new-file v2.3.24/linux/include/linux/proc_fs.h linux/include/linux/proc_fs.h
@@ -12,51 +12,8 @@
* We always define these enumerators
*/
-enum root_directory_inos {
+enum {
PROC_ROOT_INO = 1,
- PROC_LOADAVG,
- PROC_UPTIME,
- PROC_MEMINFO,
- PROC_KMSG,
- PROC_VERSION,
- PROC_CPUINFO,
- PROC_PCI,
- PROC_MCA,
- PROC_NUBUS,
- PROC_MAC_VIA,
- PROC_SELF, /* will change inode # */
- PROC_NET,
- PROC_SCSI,
- PROC_MALLOC,
- PROC_KCORE,
- PROC_MODULES,
- PROC_STAT,
- PROC_DEVICES,
- PROC_PARTITIONS,
- PROC_INTERRUPTS,
- PROC_FILESYSTEMS,
- PROC_KSYMS,
- PROC_DMA,
- PROC_IOPORTS,
- PROC_MEMORY,
- PROC_PROFILE, /* whether enabled or not */
- PROC_CMDLINE,
- PROC_SYS,
- PROC_MTAB,
- PROC_SWAP,
- PROC_MD,
- PROC_RTC,
- PROC_LOCKS,
- PROC_HARDWARE,
- PROC_SLABINFO,
- PROC_PARPORT,
- PROC_PPC_HTAB,
- PROC_STRAM,
- PROC_SOUND,
- PROC_MTRR, /* whether enabled or not */
- PROC_FS,
- PROC_SYSVIPC,
- PROC_DRIVER,
};
enum pid_directory_inos {
@@ -83,73 +40,6 @@
};
enum net_directory_inos {
- PROC_NET_UNIX = 128,
- PROC_NET_ARP,
- PROC_NET_ROUTE,
- PROC_NET_DEV,
- PROC_NET_RAW,
- PROC_NET_RAW6,
- PROC_NET_TCP,
- PROC_NET_TCP6,
- PROC_NET_UDP,
- PROC_NET_UDP6,
- PROC_NET_SNMP,
- PROC_NET_RARP,
- PROC_NET_IGMP,
- PROC_NET_IPMR_VIF,
- PROC_NET_IPMR_MFC,
- PROC_NET_IPFWFWD,
- PROC_NET_IPFWIN,
- PROC_NET_IPFWOUT,
- PROC_NET_IPACCT,
- PROC_NET_IPMSQHST,
- PROC_NET_WIRELESS,
- PROC_NET_IPX_INTERFACE,
- PROC_NET_IPX_ROUTE,
- PROC_NET_IPX,
- PROC_NET_ATALK,
- PROC_NET_AT_ROUTE,
- PROC_NET_ATIF,
- PROC_NET_AX25_ROUTE,
- PROC_NET_AX25,
- PROC_NET_AX25_CALLS,
- PROC_NET_BMAC,
- PROC_NET_NR_NODES,
- PROC_NET_NR_NEIGH,
- PROC_NET_NR,
- PROC_NET_SOCKSTAT,
- PROC_NET_SOCKSTAT6,
- PROC_NET_RTCACHE,
- PROC_NET_AX25_BPQETHER,
- PROC_NET_IP_MASQ_APP,
- PROC_NET_RT6,
- PROC_NET_SNMP6,
- PROC_NET_RT6_STATS,
- PROC_NET_NDISC,
- PROC_NET_STRIP_STATUS,
- PROC_NET_STRIP_TRACE,
- PROC_NET_Z8530,
- PROC_NET_RS_NODES,
- PROC_NET_RS_NEIGH,
- PROC_NET_RS_ROUTES,
- PROC_NET_RS,
- PROC_NET_CL2LLC,
- PROC_NET_X25_ROUTES,
- PROC_NET_X25,
- PROC_NET_TR_RIF,
- PROC_NET_DN_DEV,
- PROC_NET_DN_ADJ,
- PROC_NET_DN_ROUTE,
- PROC_NET_DN_CACHE,
- PROC_NET_DN_SKT,
- PROC_NET_DN_FW_CHAINS,
- PROC_NET_DN_FW_CHAIN_NAMES,
- PROC_NET_DN_RAW,
- PROC_NET_NETSTAT,
- PROC_NET_IPFW_CHAINS,
- PROC_NET_IPFW_CHAIN_NAMES,
- PROC_NET_AT_AARP,
- PROC_NET_BRIDGE,
PROC_NET_LAST
};
@@ -231,36 +121,6 @@
PROC_MCA_LAST = (PROC_MCA_SLOT + 8)
};
-enum bus_directory_inos {
- PROC_BUS_PCI = PROC_MCA_LAST,
- PROC_BUS_PCI_DEVICES,
- PROC_BUS_ZORRO,
- PROC_BUS_ZORRO_DEVICES,
- PROC_BUS_ECARD_DEVICES,
- PROC_BUS_NUBUS,
- PROC_BUS_NUBUS_DEVICES,
- PROC_BUS_LAST
-};
-
-enum fs_directory_inos {
- PROC_FS_CODA = PROC_BUS_LAST,
- PROC_FS_LAST
-};
-
-enum fs_coda_directory_inos {
- PROC_VFS_STATS = PROC_FS_LAST,
- PROC_UPCALL_STATS,
- PROC_PERMISSION_STATS,
- PROC_CACHE_INV_STATS,
- PROC_CODA_FS_LAST
-};
-
-enum sysvipc_directory_inos {
- PROC_SYSVIPC_SHM = PROC_CODA_FS_LAST,
- PROC_SYSVIPC_SEM,
- PROC_SYSVIPC_MSG
-};
-
/* Finally, the dynamically allocatable proc entries are reserved: */
#define PROC_DYNAMIC_FIRST 4096
@@ -288,6 +148,13 @@
* fill in file type/protection/owner information specific to the
* particular /proc file.
*/
+
+typedef int (read_proc_t)(char *page, char **start, off_t off,
+ int count, int *eof, void *data);
+typedef int (write_proc_t)(struct file *file, const char *buffer,
+ unsigned long count, void *data);
+typedef int (get_info_t)(char *, char **, off_t, int, int);
+
struct proc_dir_entry {
unsigned short low_ino;
unsigned short namelen;
@@ -298,74 +165,50 @@
gid_t gid;
unsigned long size;
struct inode_operations * ops;
- int (*get_info)(char *, char **, off_t, int, int);
+ get_info_t *get_info;
void (*fill_inode)(struct inode *, int);
struct proc_dir_entry *next, *parent, *subdir;
void *data;
- int (*read_proc)(char *page, char **start, off_t off,
- int count, int *eof, void *data);
- int (*write_proc)(struct file *file, const char *buffer,
- unsigned long count, void *data);
+ read_proc_t *read_proc;
+ write_proc_t *write_proc;
int (*readlink_proc)(struct proc_dir_entry *de, char *page);
unsigned int count; /* use count */
int deleted; /* delete flag */
};
-typedef int (read_proc_t)(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-typedef int (write_proc_t)(struct file *file, const char *buffer,
- unsigned long count, void *data);
-
extern int (* dispatch_scsi_info_ptr) (int ino, char *buffer, char **start,
off_t offset, int length, int inout);
#ifdef CONFIG_PROC_FS
extern struct proc_dir_entry proc_root;
-extern struct proc_dir_entry proc_root_fs;
+extern struct proc_dir_entry *proc_root_fs;
extern struct proc_dir_entry *proc_net;
extern struct proc_dir_entry *proc_scsi;
extern struct proc_dir_entry proc_sys;
extern struct proc_dir_entry proc_openprom;
extern struct proc_dir_entry proc_pid;
extern struct proc_dir_entry proc_pid_fd;
-extern struct proc_dir_entry proc_mca;
+extern struct proc_dir_entry *proc_mca;
extern struct proc_dir_entry *proc_bus;
extern struct proc_dir_entry *proc_sysvipc;
-extern struct proc_dir_entry proc_root_driver;
+extern struct proc_dir_entry *proc_root_driver;
extern struct inode_operations proc_scsi_inode_operations;
extern void proc_root_init(void);
extern void proc_base_init(void);
+extern void proc_misc_init(void);
extern int proc_register(struct proc_dir_entry *, struct proc_dir_entry *);
extern int proc_unregister(struct proc_dir_entry *, int);
-/*
- * generic.c
- */
extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
- struct proc_dir_entry *parent);
+ struct proc_dir_entry *parent);
extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
-
-/*
- * inlined /proc helper functions
- */
-
-static inline int proc_net_register(struct proc_dir_entry * x)
-{
- return proc_register(proc_net, x);
-}
-
-static inline int proc_net_unregister(int x)
-{
- return proc_unregister(proc_net, x);
-}
-
-static inline int proc_scsi_register(struct proc_dir_entry *driver,
+extern inline int proc_scsi_register(struct proc_dir_entry *driver,
struct proc_dir_entry *x)
{
x->ops = &proc_scsi_inode_operations;
@@ -376,7 +219,7 @@
}
}
-static inline int proc_scsi_unregister(struct proc_dir_entry *driver, int x)
+extern inline int proc_scsi_unregister(struct proc_dir_entry *driver, int x)
{
extern void scsi_init_free(char *ptr, unsigned int size);
@@ -406,7 +249,7 @@
{
struct proc_dir_entry *p;
- p = proc_root_driver.subdir;
+ p = proc_root_driver->subdir;
while (p != NULL) {
if (strcmp (p->name, module_name) == 0)
return p;
@@ -422,7 +265,7 @@
*/
extern inline int proc_driver_unregister(const char *module_name)
{
- remove_proc_entry (module_name, &proc_root_driver);
+ remove_proc_entry (module_name, proc_root_driver);
return 0;
}
@@ -434,7 +277,7 @@
{
struct proc_dir_entry *p;
- p = create_proc_entry (module_name, S_IFDIR, &proc_root_driver);
+ p = create_proc_entry (module_name, S_IFDIR, proc_root_driver);
return (p == NULL) ? -1 : 0;
}
@@ -483,7 +326,6 @@
extern struct inode_operations proc_dir_inode_operations;
extern struct inode_operations proc_file_inode_operations;
-extern struct inode_operations proc_net_inode_operations;
extern struct inode_operations proc_netdir_inode_operations;
extern struct inode_operations proc_openprom_inode_operations;
extern struct inode_operations proc_mem_inode_operations;
@@ -514,22 +356,71 @@
*/
extern void proc_device_tree_init(void);
+extern inline struct proc_dir_entry *create_proc_read_entry(const char *name,
+ mode_t mode, struct proc_dir_entry *base,
+ read_proc_t *read_proc, void * data)
+{
+ struct proc_dir_entry *res=create_proc_entry(name,mode,base);
+ if (res) {
+ res->read_proc=read_proc;
+ res->data=data;
+ }
+ return res;
+}
+
+extern inline struct proc_dir_entry *create_proc_info_entry(const char *name,
+ mode_t mode, struct proc_dir_entry *base, get_info_t *get_info)
+{
+ struct proc_dir_entry *res=create_proc_entry(name,mode,base);
+ if (res) res->get_info=get_info;
+ return res;
+}
+
+extern inline struct proc_dir_entry *proc_net_create(const char *name,
+ mode_t mode, get_info_t *get_info)
+{
+ return create_proc_info_entry(name,mode,proc_net,get_info);
+}
+
+extern inline void proc_net_remove(const char *name)
+{
+ remove_proc_entry(name,proc_net);
+}
+
+extern inline int proc_net_register(struct proc_dir_entry * x)
+{
+ return proc_register(proc_net, x);
+}
+
+extern inline int proc_net_unregister(int x)
+{
+ return proc_unregister(proc_net, x);
+}
+
#else
extern inline int proc_register(struct proc_dir_entry *a, struct proc_dir_entry *b) { return 0; }
extern inline int proc_unregister(struct proc_dir_entry *a, int b) { return 0; }
-extern inline int proc_net_register(struct proc_dir_entry *a) { return 0; }
+extern inline struct proc_dir_entry *proc_net_create(const char *name, mode_t mode,
+ get_info_t *get_info) {return NULL;}
+extern inline void proc_net_remove(const char *name) {}
+extern inline int proc_net_register(struct proc_dir_entry * x) { return 0; }
extern inline int proc_net_unregister(int x) { return 0; }
extern inline int proc_scsi_register(struct proc_dir_entry *b, struct proc_dir_entry *c) { return 0; }
extern inline int proc_scsi_unregister(struct proc_dir_entry *a, int x) { return 0; }
-extern inline struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
- struct proc_dir_entry *parent)
-{
- return NULL;
-}
+extern inline struct proc_dir_entry *create_proc_entry(const char *name,
+ mode_t mode, struct proc_dir_entry *parent) { return NULL; }
extern inline void remove_proc_entry(const char *name, struct proc_dir_entry *parent) {};
+
+extern inline struct proc_dir_entry *create_proc_read_entry(const char *name,
+ mode_t mode, struct proc_dir_entry *base,
+ int (*read_proc)(char *, char **, off_t, int, int *, void *),
+ void * data) { return NULL; }
+extern inline struct proc_dir_entry *create_proc_info_entry(const char *name,
+ mode_t mode, struct proc_dir_entry *base, get_info_t *get_info)
+ { return NULL; }
extern inline void proc_tty_register_driver(struct tty_driver *driver) {};
extern inline void proc_tty_unregister_driver(struct tty_driver *driver) {};
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)