Blame view

fs/proc/internal.h 4.76 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
  /* internal.h: internal procfs definitions
   *
   * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
   * Written by David Howells (dhowells@redhat.com)
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
   * as published by the Free Software Foundation; either version
   * 2 of the License, or (at your option) any later version.
   */
  
  #include <linux/proc_fs.h>
c74c120a2   Alexey Dobriyan   proc: remove proc...
13
  extern struct proc_dir_entry proc_root;
05565b65a   Andrew Morton   [PATCH] proc: fix...
14
  #ifdef CONFIG_PROC_SYSCTL
77b14db50   Eric W. Biederman   [PATCH] sysctl: r...
15
  extern int proc_sys_init(void);
05565b65a   Andrew Morton   [PATCH] proc: fix...
16
17
18
  #else
  static inline void proc_sys_init(void) { }
  #endif
457c4cbc5   Eric W. Biederman   [NET]: Make /proc...
19
20
21
22
23
  #ifdef CONFIG_NET
  extern int proc_net_init(void);
  #else
  static inline int proc_net_init(void) { return 0; }
  #endif
77b14db50   Eric W. Biederman   [PATCH] sysctl: r...
24

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
25
26
27
28
  struct vmalloc_info {
  	unsigned long	used;
  	unsigned long	largest_chunk;
  };
831830b5a   Al Viro   restrict reading ...
29
  extern struct mm_struct *mm_for_maps(struct task_struct *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
30
31
32
33
34
35
36
37
38
39
40
  #ifdef CONFIG_MMU
  #define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
  extern void get_vmalloc_info(struct vmalloc_info *vmi);
  #else
  
  #define VMALLOC_TOTAL 0UL
  #define get_vmalloc_info(vmi)			\
  do {						\
  	(vmi)->used = 0;			\
  	(vmi)->largest_chunk = 0;		\
  } while(0)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41
  #endif
ee992744e   Eric W. Biederman   proc: rewrite do_...
42
43
44
45
  extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns,
  				struct pid *pid, struct task_struct *task);
  extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
  				struct pid *pid, struct task_struct *task);
df5f8314c   Eric W. Biederman   proc: seqfile con...
46
47
  extern int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
  				struct pid *pid, struct task_struct *task);
a56d3fc74   Eric W. Biederman   seqfile convert p...
48
49
  extern int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
  				struct pid *pid, struct task_struct *task);
85863e475   Matt Mackall   maps4: add /proc/...
50
  extern loff_t mem_lseek(struct file *file, loff_t offset, int orig);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
51

00977a59b   Arjan van de Ven   [PATCH] mark stru...
52
53
54
  extern const struct file_operations proc_maps_operations;
  extern const struct file_operations proc_numa_maps_operations;
  extern const struct file_operations proc_smaps_operations;
f248dcb34   Matt Mackall   maps4: move clear...
55
  extern const struct file_operations proc_clear_refs_operations;
85863e475   Matt Mackall   maps4: add /proc/...
56
  extern const struct file_operations proc_pagemap_operations;
e9720acd7   Pavel Emelyanov   [NET]: Make /proc...
57
58
  extern const struct file_operations proc_net_operations;
  extern const struct inode_operations proc_net_inode_operations;
99f895518   Eric W. Biederman   [PATCH] proc: don...
59

f2beb7983   Stephen Wilson   proc: make struct...
60
61
62
63
64
65
66
  struct proc_maps_private {
  	struct pid *pid;
  	struct task_struct *task;
  #ifdef CONFIG_MMU
  	struct vm_area_struct *tail_vma;
  #endif
  };
5bcd7ff9e   Alexey Dobriyan   proc: proc_init_i...
67
  void proc_init_inodecache(void);
fee781e6c   Adrian Bunk   [PATCH] fs/proc/:...
68

13b41b094   Eric W. Biederman   [PATCH] proc: Use...
69
  static inline struct pid *proc_pid(struct inode *inode)
99f895518   Eric W. Biederman   [PATCH] proc: don...
70
  {
13b41b094   Eric W. Biederman   [PATCH] proc: Use...
71
  	return PROC_I(inode)->pid;
99f895518   Eric W. Biederman   [PATCH] proc: don...
72
73
74
  }
  
  static inline struct task_struct *get_proc_task(struct inode *inode)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
  {
13b41b094   Eric W. Biederman   [PATCH] proc: Use...
76
  	return get_pid_task(proc_pid(inode), PIDTYPE_PID);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
77
  }
aed7a6c47   Eric W. Biederman   [PATCH] proc: Rep...
78
  static inline int proc_fd(struct inode *inode)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
79
  {
aed7a6c47   Eric W. Biederman   [PATCH] proc: Rep...
80
  	return PROC_I(inode)->fd;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
81
  }
e9720acd7   Pavel Emelyanov   [NET]: Make /proc...
82
83
84
85
86
  
  struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *ino,
  		struct dentry *dentry);
  int proc_readdir_de(struct proc_dir_entry *de, struct file *filp, void *dirent,
  		filldir_t filldir);
881adb853   Alexey Dobriyan   proc: always do -...
87
88
89
90
91
92
93
  
  struct pde_opener {
  	struct inode *inode;
  	struct file *file;
  	int (*release)(struct inode *, struct file *);
  	struct list_head lh;
  };
3dec7f59c   Alexey Dobriyan   proc 1/2: do PDE ...
94
  void pde_users_dec(struct proc_dir_entry *pde);
3174c21b7   Al Viro   Move junk from pr...
95
96
97
98
99
100
  
  extern spinlock_t proc_subdir_lock;
  
  struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *);
  int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
  unsigned long task_vsize(struct mm_struct *);
a2ade7b6c   Alexey Dobriyan   proc: use unsigne...
101
102
  unsigned long task_statm(struct mm_struct *,
  	unsigned long *, unsigned long *, unsigned long *, unsigned long *);
3174c21b7   Al Viro   Move junk from pr...
103
  void task_mem(struct seq_file *, struct mm_struct *);
135d5655d   Alexey Dobriyan   proc: rename de_g...
104
105
106
107
108
109
  static inline struct proc_dir_entry *pde_get(struct proc_dir_entry *pde)
  {
  	atomic_inc(&pde->count);
  	return pde;
  }
  void pde_put(struct proc_dir_entry *pde);
3174c21b7   Al Viro   Move junk from pr...
110

3174c21b7   Al Viro   Move junk from pr...
111
  int proc_fill_super(struct super_block *);
6d1b6e4ef   Alexey Dobriyan   proc: ->low_ino c...
112
  struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *);
97412950b   Vasiliy Kulikov   procfs: parse mou...
113
  int proc_remount(struct super_block *sb, int *flags, char *data);
3174c21b7   Al Viro   Move junk from pr...
114
115
116
117
118
119
120
121
122
123
  
  /*
   * These are generic /proc routines that use the internal
   * "struct proc_dir_entry" tree to traverse the filesystem.
   *
   * The /proc root directory has extended versions to take care
   * of the /proc/<pid> subdirectories.
   */
  int proc_readdir(struct file *, void *, filldir_t);
  struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *);
6b4e306aa   Eric W. Biederman   ns: proc files fo...
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
  
  
  
  /* Lookups */
  typedef struct dentry *instantiate_t(struct inode *, struct dentry *,
  				struct task_struct *, const void *);
  int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
  	const char *name, int len,
  	instantiate_t instantiate, struct task_struct *task, const void *ptr);
  int pid_revalidate(struct dentry *dentry, struct nameidata *nd);
  struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task);
  extern const struct dentry_operations pid_dentry_operations;
  int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);
  int proc_setattr(struct dentry *dentry, struct iattr *attr);
  
  extern const struct inode_operations proc_ns_dir_inode_operations;
  extern const struct file_operations proc_ns_dir_operations;