This source file includes following definitions.
- proc_net_register
- proc_net_unregister
- proc_scsi_register
- 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
9
10
11
12
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,
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,
39 PROC_CMDLINE
40 };
41
42 enum pid_directory_inos {
43 PROC_PID_INO = 2,
44 PROC_PID_MEM,
45 PROC_PID_CWD,
46 PROC_PID_ROOT,
47 PROC_PID_EXE,
48 PROC_PID_FD,
49 PROC_PID_ENVIRON,
50 PROC_PID_CMDLINE,
51 PROC_PID_STAT,
52 PROC_PID_STATM,
53 PROC_PID_MAPS
54 };
55
56 enum pid_subdirectory_inos {
57 PROC_PID_FD_DIR = 1
58 };
59
60 enum net_directory_inos {
61 PROC_NET_UNIX = 128,
62 PROC_NET_ARP,
63 PROC_NET_ROUTE,
64 PROC_NET_DEV,
65 PROC_NET_RAW,
66 PROC_NET_TCP,
67 PROC_NET_UDP,
68 PROC_NET_SNMP,
69 PROC_NET_RARP,
70 PROC_NET_IGMP,
71 PROC_NET_IPMR_VIF,
72 PROC_NET_IPMR_MFC,
73 PROC_NET_IPFWFWD,
74 PROC_NET_IPFWBLK,
75 PROC_NET_IPACCT,
76 PROC_NET_IPMSQHST,
77 PROC_NET_WAVELAN,
78 PROC_NET_IPX_INTERFACE,
79 PROC_NET_IPX_ROUTE,
80 PROC_NET_IPX,
81 PROC_NET_ATALK,
82 PROC_NET_AT_ROUTE,
83 PROC_NET_ATIF,
84 PROC_NET_AX25_ROUTE,
85 PROC_NET_AX25,
86 PROC_NET_AX25_CALLS,
87 PROC_NET_NR_NODES,
88 PROC_NET_NR_NEIGH,
89 PROC_NET_NR,
90 PROC_NET_SOCKSTAT,
91 PROC_NET_RTCACHE,
92 PROC_NET_AX25_BPQETHER,
93 PROC_NET_ALIAS_TYPES,
94 PROC_NET_ALIASES,
95 PROC_NET_LAST
96 };
97
98 enum scsi_directory_inos {
99 PROC_SCSI_SCSI = 256,
100 PROC_SCSI_EATA,
101 PROC_SCSI_EATA_PIO,
102 PROC_SCSI_AHA152X,
103 PROC_SCSI_AHA1542,
104 PROC_SCSI_AHA1740,
105 PROC_SCSI_AIC7XXX,
106 PROC_SCSI_BUSLOGIC,
107 PROC_SCSI_U14_34F,
108 PROC_SCSI_FDOMAIN,
109 PROC_SCSI_GENERIC_NCR5380,
110 PROC_SCSI_IN2000,
111 PROC_SCSI_PAS16,
112 PROC_SCSI_QLOGIC,
113 PROC_SCSI_SEAGATE,
114 PROC_SCSI_T128,
115 PROC_SCSI_NCR53C7xx,
116 PROC_SCSI_ULTRASTOR,
117 PROC_SCSI_7000FASST,
118 PROC_SCSI_EATA2X,
119 PROC_SCSI_SSC,
120 PROC_SCSI_SCSI_DEBUG,
121 PROC_SCSI_NOT_PRESENT,
122 PROC_SCSI_FILE,
123 PROC_SCSI_LAST = (PROC_SCSI_FILE + 16)
124 };
125
126 #define PROC_SUPER_MAGIC 0x9fa0
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143 struct proc_dir_entry {
144 unsigned short low_ino;
145 unsigned short namelen;
146 const char *name;
147 mode_t mode;
148 nlink_t nlink;
149 uid_t uid;
150 gid_t gid;
151 unsigned long size;
152 struct inode_operations * ops;
153 int (*get_info)(char *, char **, off_t, int, int);
154 void (*fill_inode)(struct inode *);
155 struct proc_dir_entry *next, *parent, *subdir;
156 };
157
158 extern struct proc_dir_entry proc_root;
159 extern struct proc_dir_entry proc_net;
160 extern struct proc_dir_entry proc_scsi;
161 extern struct proc_dir_entry proc_pid;
162 extern struct proc_dir_entry proc_pid_fd;
163
164 extern struct inode_operations proc_scsi_inode_operations;
165
166 extern void proc_root_init(void);
167 extern void proc_base_init(void);
168 extern void proc_net_init(void);
169
170 extern int proc_register(struct proc_dir_entry *, struct proc_dir_entry *);
171 extern int proc_unregister(struct proc_dir_entry *, int);
172
173 static inline int proc_net_register(struct proc_dir_entry * x)
174 {
175 return proc_register(&proc_net, x);
176 }
177
178 static inline int proc_net_unregister(int x)
179 {
180 return proc_unregister(&proc_net, x);
181 }
182
183 static inline int proc_scsi_register(struct proc_dir_entry *driver,
184 struct proc_dir_entry *x)
185 {
186 x->ops = &proc_scsi_inode_operations;
187 if(x->low_ino < PROC_SCSI_FILE){
188 return(proc_register(&proc_scsi, x));
189 }else{
190 return(proc_register(driver, x));
191 }
192 }
193
194 static inline int proc_scsi_unregister(struct proc_dir_entry *driver, int x)
195 {
196 extern void scsi_init_free(char *ptr, unsigned int size);
197
198 if(x <= PROC_SCSI_FILE)
199 return(proc_unregister(&proc_scsi, x));
200 else {
201 struct proc_dir_entry **p = &driver->subdir, *dp;
202 int ret;
203
204 while ((dp = *p) != NULL) {
205 if (dp->low_ino == x)
206 break;
207 p = &dp->next;
208 }
209 ret = proc_unregister(driver, x);
210 scsi_init_free((char *) dp, sizeof(struct proc_dir_entry) + 4);
211 return(ret);
212 }
213 }
214
215 extern struct super_block *proc_read_super(struct super_block *,void *,int);
216 extern struct inode * proc_get_inode(struct super_block *, int, struct proc_dir_entry *);
217 extern void proc_statfs(struct super_block *, struct statfs *, int);
218 extern void proc_read_inode(struct inode *);
219 extern void proc_write_inode(struct inode *);
220 extern int proc_match(int, const char *, struct proc_dir_entry *);
221
222
223
224
225
226
227
228
229 extern int proc_readdir(struct inode *, struct file *, void *, filldir_t);
230 extern int proc_lookup(struct inode *, const char *, int, struct inode **);
231
232 extern struct inode_operations proc_net_inode_operations;
233 extern struct inode_operations proc_netdir_inode_operations;
234 extern struct inode_operations proc_scsi_inode_operations;
235 extern struct inode_operations proc_mem_inode_operations;
236 extern struct inode_operations proc_array_inode_operations;
237 extern struct inode_operations proc_arraylong_inode_operations;
238 extern struct inode_operations proc_kcore_inode_operations;
239 extern struct inode_operations proc_profile_inode_operations;
240 extern struct inode_operations proc_kmsg_inode_operations;
241 extern struct inode_operations proc_link_inode_operations;
242 extern struct inode_operations proc_fd_inode_operations;
243
244 #endif