1 #ifndef _LINUX_PROC_FS_H
2 #define _LINUX_PROC_FS_H
4 #include <linux/config.h>
5 #include <linux/malloc.h>
8 * The proc filesystem constants/structures
12 * We always define these enumerators
15 enum root_directory_inos
{
26 PROC_SELF
, /* will change inode # */
40 PROC_PROFILE
, /* whether enabled or not */
54 PROC_MTRR
, /* whether enabled or not */
59 enum pid_directory_inos
{
78 enum pid_subdirectory_inos
{
79 PROC_PID_FD_DIR
= 0x8000, /* 0x8000-0xffff */
82 enum net_directory_inos
{
104 PROC_NET_IPX_INTERFACE
,
120 PROC_NET_AX25_BPQETHER
,
121 PROC_NET_IP_MASQ_APP
,
126 PROC_NET_STRIP_STATUS
,
127 PROC_NET_STRIP_TRACE
,
142 PROC_NET_DN_FW_CHAINS
,
143 PROC_NET_DN_FW_CHAIN_NAMES
,
146 PROC_NET_IPFW_CHAINS
,
147 PROC_NET_IPFW_CHAIN_NAMES
,
153 enum scsi_directory_inos
{
154 PROC_SCSI_SCSI
= 256,
169 PROC_SCSI_GENERIC_NCR5380
,
188 PROC_SCSI_NCR53C406A
,
212 PROC_SCSI_SCSI_DEBUG
,
213 PROC_SCSI_NOT_PRESENT
,
214 PROC_SCSI_FILE
, /* I'm assuming here that we */
215 PROC_SCSI_LAST
= (PROC_SCSI_FILE
+ 16) /* won't ever see more than */
216 }; /* 16 HBAs in one machine */
218 enum mca_directory_inos
{
219 PROC_MCA_MACHINE
= (PROC_SCSI_LAST
+1),
223 PROC_MCA_SLOT
, /* the 8 adapter slots */
224 PROC_MCA_LAST
= (PROC_MCA_SLOT
+ 8)
227 enum bus_directory_inos
{
228 PROC_BUS_PCI
= PROC_MCA_LAST
,
229 PROC_BUS_PCI_DEVICES
,
231 PROC_BUS_ZORRO_DEVICES
,
235 enum fs_directory_inos
{
236 PROC_FS_CODA
= PROC_BUS_LAST
,
240 enum fs_coda_directory_inos
{
241 PROC_VFS_STATS
= PROC_FS_LAST
,
243 PROC_PERMISSION_STATS
,
244 PROC_CACHE_INV_STATS
,
248 enum sysvipc_directory_inos
{
249 PROC_SYSVIPC_SHM
= PROC_CODA_FS_LAST
,
254 /* Finally, the dynamically allocatable proc entries are reserved: */
256 #define PROC_DYNAMIC_FIRST 4096
257 #define PROC_NDYNAMIC 4096
258 #define PROC_OPENPROM_FIRST (PROC_DYNAMIC_FIRST+PROC_NDYNAMIC)
259 #define PROC_OPENPROM PROC_OPENPROM_FIRST
260 #define PROC_NOPENPROM 4096
261 #define PROC_OPENPROMD_FIRST (PROC_OPENPROM_FIRST+PROC_NOPENPROM)
262 #define PROC_NOPENPROMD 4096
264 #define PROC_SUPER_MAGIC 0x9fa0
267 * This is not completely implemented yet. The idea is to
268 * create an in-memory tree (like the actual /proc filesystem
269 * tree) of these proc_dir_entries, so that we can dynamically
270 * add new files to /proc.
272 * The "next" pointer creates a linked list of one /proc directory,
273 * while parent/subdir create the directory structure (every
274 * /proc file has a parent, but "subdir" is NULL for all
275 * non-directory entries).
277 * "get_info" is called at "read", while "fill_inode" is used to
278 * fill in file type/protection/owner information specific to the
279 * particular /proc file.
281 struct proc_dir_entry
{
282 unsigned short low_ino
;
283 unsigned short namelen
;
290 struct inode_operations
* ops
;
291 int (*get_info
)(char *, char **, off_t
, int, int);
292 void (*fill_inode
)(struct inode
*, int);
293 struct proc_dir_entry
*next
, *parent
, *subdir
;
295 int (*read_proc
)(char *page
, char **start
, off_t off
,
296 int count
, int *eof
, void *data
);
297 int (*write_proc
)(struct file
*file
, const char *buffer
,
298 unsigned long count
, void *data
);
299 int (*readlink_proc
)(struct proc_dir_entry
*de
, char *page
);
300 unsigned int count
; /* use count */
301 int deleted
; /* delete flag */
304 typedef int (read_proc_t
)(char *page
, char **start
, off_t off
,
305 int count
, int *eof
, void *data
);
306 typedef int (write_proc_t
)(struct file
*file
, const char *buffer
,
307 unsigned long count
, void *data
);
309 extern int (* dispatch_scsi_info_ptr
) (int ino
, char *buffer
, char **start
,
310 off_t offset
, int length
, int inout
);
312 #ifdef CONFIG_PROC_FS
314 extern struct proc_dir_entry proc_root
;
315 extern struct proc_dir_entry proc_root_fs
;
316 extern struct proc_dir_entry
*proc_net
;
317 extern struct proc_dir_entry
*proc_scsi
;
318 extern struct proc_dir_entry proc_sys
;
319 extern struct proc_dir_entry proc_openprom
;
320 extern struct proc_dir_entry proc_pid
;
321 extern struct proc_dir_entry proc_pid_fd
;
322 extern struct proc_dir_entry proc_mca
;
323 extern struct proc_dir_entry
*proc_bus
;
324 extern struct proc_dir_entry
*proc_sysvipc
;
326 extern struct inode_operations proc_scsi_inode_operations
;
328 extern void proc_root_init(void);
329 extern void proc_base_init(void);
331 extern int proc_register(struct proc_dir_entry
*, struct proc_dir_entry
*);
332 extern int proc_unregister(struct proc_dir_entry
*, int);
334 static inline int proc_net_register(struct proc_dir_entry
* x
)
336 return proc_register(proc_net
, x
);
339 static inline int proc_net_unregister(int x
)
341 return proc_unregister(proc_net
, x
);
344 static inline int proc_scsi_register(struct proc_dir_entry
*driver
,
345 struct proc_dir_entry
*x
)
347 x
->ops
= &proc_scsi_inode_operations
;
348 if(x
->low_ino
< PROC_SCSI_FILE
){
349 return(proc_register(proc_scsi
, x
));
351 return(proc_register(driver
, x
));
355 static inline int proc_scsi_unregister(struct proc_dir_entry
*driver
, int x
)
357 extern void scsi_init_free(char *ptr
, unsigned int size
);
359 if(x
< PROC_SCSI_FILE
)
360 return(proc_unregister(proc_scsi
, x
));
362 struct proc_dir_entry
**p
= &driver
->subdir
, *dp
;
365 while ((dp
= *p
) != NULL
) {
366 if (dp
->low_ino
== x
)
370 ret
= proc_unregister(driver
, x
);
371 scsi_init_free((char *) dp
, sizeof(struct proc_dir_entry
) + 4);
376 extern struct dentry_operations proc_dentry_operations
;
377 extern struct super_block
*proc_read_super(struct super_block
*,void *,int);
378 extern int init_proc_fs(void);
379 extern struct inode
* proc_get_inode(struct super_block
*, int, struct proc_dir_entry
*);
380 extern int proc_statfs(struct super_block
*, struct statfs
*, int);
381 extern void proc_read_inode(struct inode
*);
382 extern void proc_write_inode(struct inode
*);
383 extern int proc_permission(struct inode
*, int);
385 extern int proc_match(int, const char *,struct proc_dir_entry
*);
388 * These are generic /proc routines that use the internal
389 * "struct proc_dir_entry" tree to traverse the filesystem.
391 * The /proc root directory has extended versions to take care
392 * of the /proc/<pid> subdirectories.
394 extern int proc_readdir(struct file
*, void *, filldir_t
);
395 extern struct dentry
*proc_lookup(struct inode
*, struct dentry
*);
397 struct openpromfs_dev
{
398 struct openpromfs_dev
*next
;
405 extern struct inode_operations
*
406 proc_openprom_register(int (*readdir
)(struct file
*, void *, filldir_t
),
407 struct dentry
* (*lookup
)(struct inode
*, struct dentry
*),
408 void (*use
)(struct inode
*, int),
409 struct openpromfs_dev
***);
410 extern void proc_openprom_deregister(void);
411 extern void (*proc_openprom_use
)(struct inode
*,int);
412 extern int proc_openprom_regdev(struct openpromfs_dev
*);
413 extern int proc_openprom_unregdev(struct openpromfs_dev
*);
415 extern struct inode_operations proc_dir_inode_operations
;
416 extern struct inode_operations proc_file_inode_operations
;
417 extern struct inode_operations proc_net_inode_operations
;
418 extern struct inode_operations proc_netdir_inode_operations
;
419 extern struct inode_operations proc_openprom_inode_operations
;
420 extern struct inode_operations proc_mem_inode_operations
;
421 extern struct inode_operations proc_sys_inode_operations
;
422 extern struct inode_operations proc_array_inode_operations
;
423 extern struct inode_operations proc_arraylong_inode_operations
;
424 extern struct inode_operations proc_kcore_inode_operations
;
425 extern struct inode_operations proc_profile_inode_operations
;
426 extern struct inode_operations proc_kmsg_inode_operations
;
427 extern struct inode_operations proc_link_inode_operations
;
428 extern struct inode_operations proc_fd_inode_operations
;
430 extern struct inode_operations proc_ringbuf_inode_operations
;
432 extern struct inode_operations proc_omirr_inode_operations
;
433 extern struct inode_operations proc_ppc_htab_inode_operations
;
434 extern struct inode_operations proc_sysvipc_inode_operations
;
439 struct proc_dir_entry
*create_proc_entry(const char *name
, mode_t mode
,
440 struct proc_dir_entry
*parent
);
441 void remove_proc_entry(const char *name
, struct proc_dir_entry
*parent
);
446 extern void proc_tty_init(void);
447 extern void proc_tty_register_driver(struct tty_driver
*driver
);
448 extern void proc_tty_unregister_driver(struct tty_driver
*driver
);
453 extern void proc_device_tree_init(void);
457 extern inline int proc_register(struct proc_dir_entry
*a
, struct proc_dir_entry
*b
) {};
458 extern inline int proc_unregister(struct proc_dir_entry
*a
, int b
) {};
459 extern inline int proc_net_register(struct proc_dir_entry
*a
) {};
460 extern inline int proc_net_unregister(int x
) {};
461 extern inline int proc_scsi_register(struct proc_dir_entry
*b
, struct proc_dir_entry
*c
) {};
462 extern inline int proc_scsi_unregister(struct proc_dir_entry
*a
, int x
);
464 extern inline struct proc_dir_entry
*create_proc_entry(const char *name
, mode_t mode
,
465 struct proc_dir_entry
*parent
)
470 extern inline void remove_proc_entry(const char *name
, struct proc_dir_entry
*parent
) {};
472 extern inline void proc_tty_register_driver(struct tty_driver
*driver
) {};
473 extern inline void proc_tty_unregister_driver(struct tty_driver
*driver
) {};
477 #endif /* _LINUX_PROC_FS_H */