proc_fs.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * The proc filesystem constants/structures
  3. */
  4. #ifndef _LINUX_PROC_FS_H
  5. #define _LINUX_PROC_FS_H
  6. #include <linux/types.h>
  7. #include <linux/fs.h>
  8. struct proc_dir_entry;
  9. #ifdef CONFIG_PROC_FS
  10. extern void proc_root_init(void);
  11. extern void proc_flush_task(struct task_struct *);
  12. extern struct proc_dir_entry *proc_symlink(const char *,
  13. struct proc_dir_entry *, const char *);
  14. extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *);
  15. extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t,
  16. struct proc_dir_entry *, void *);
  17. extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t,
  18. struct proc_dir_entry *);
  19. extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
  20. struct proc_dir_entry *,
  21. const struct file_operations *,
  22. void *);
  23. static inline struct proc_dir_entry *proc_create(
  24. const char *name, umode_t mode, struct proc_dir_entry *parent,
  25. const struct file_operations *proc_fops)
  26. {
  27. return proc_create_data(name, mode, parent, proc_fops, NULL);
  28. }
  29. extern void proc_set_size(struct proc_dir_entry *, loff_t);
  30. extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
  31. extern void *PDE_DATA(const struct inode *);
  32. extern void *proc_get_parent_data(const struct inode *);
  33. extern void proc_remove(struct proc_dir_entry *);
  34. extern void remove_proc_entry(const char *, struct proc_dir_entry *);
  35. extern int remove_proc_subtree(const char *, struct proc_dir_entry *);
  36. #else /* CONFIG_PROC_FS */
  37. static inline void proc_root_init(void)
  38. {
  39. }
  40. static inline void proc_flush_task(struct task_struct *task)
  41. {
  42. }
  43. static inline struct proc_dir_entry *proc_symlink(const char *name,
  44. struct proc_dir_entry *parent,const char *dest) { return NULL;}
  45. static inline struct proc_dir_entry *proc_mkdir(const char *name,
  46. struct proc_dir_entry *parent) {return NULL;}
  47. static inline struct proc_dir_entry *proc_mkdir_data(const char *name,
  48. umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; }
  49. static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
  50. umode_t mode, struct proc_dir_entry *parent) { return NULL; }
  51. #define proc_create(name, mode, parent, proc_fops) ({NULL;})
  52. #define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;})
  53. static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {}
  54. static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {}
  55. static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;}
  56. static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; }
  57. static inline void proc_remove(struct proc_dir_entry *de) {}
  58. #define remove_proc_entry(name, parent) do {} while (0)
  59. static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; }
  60. #endif /* CONFIG_PROC_FS */
  61. struct net;
  62. static inline struct proc_dir_entry *proc_net_mkdir(
  63. struct net *net, const char *name, struct proc_dir_entry *parent)
  64. {
  65. return proc_mkdir_data(name, 0, parent, net);
  66. }
  67. #endif /* _LINUX_PROC_FS_H */