aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/proc_fs.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2011-07-27 14:47:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-27 15:50:45 -0400
commit09570f914914d2beb0db29c5a9c7344934f2fa8c (patch)
treea93900db5e607887aca3ef2cecc2426abe007d87 /include/linux/proc_fs.h
parent5fd00b031530cc476240f654c078c930f1dcd6ea (diff)
proc: make struct proc_dir_entry::name a terminal array rather than a pointer
Since __proc_create() appends the name it is given to the end of the PDE structure that it allocates, there isn't a need to store a name pointer. Instead we can just replace the name pointer with a terminal char array of _unspecified_ length. The compiler will simply append the string to statically defined variables of PDE type overlapping any hole at the end of the structure and, unlike specifying an explicitly _zero_ length array, won't give a warning if you try to statically initialise it with a string of more than zero length. Also, whilst we're at it: (1) Move namelen to end just prior to name and reduce it to a single byte (name shouldn't be longer than NAME_MAX). (2) Move pde_unload_lock two places further on so that if it's four bytes in size on a 64-bit machine, it won't cause an unused hole in the PDE struct. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/proc_fs.h')
-rw-r--r--include/linux/proc_fs.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 650af6deaf8f..643b96c7a94f 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -50,8 +50,6 @@ typedef int (write_proc_t)(struct file *file, const char __user *buffer,
50 50
51struct proc_dir_entry { 51struct proc_dir_entry {
52 unsigned int low_ino; 52 unsigned int low_ino;
53 unsigned int namelen;
54 const char *name;
55 mode_t mode; 53 mode_t mode;
56 nlink_t nlink; 54 nlink_t nlink;
57 uid_t uid; 55 uid_t uid;
@@ -73,9 +71,11 @@ struct proc_dir_entry {
73 write_proc_t *write_proc; 71 write_proc_t *write_proc;
74 atomic_t count; /* use count */ 72 atomic_t count; /* use count */
75 int pde_users; /* number of callers into module in progress */ 73 int pde_users; /* number of callers into module in progress */
76 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
77 struct completion *pde_unload_completion; 74 struct completion *pde_unload_completion;
78 struct list_head pde_openers; /* who did ->open, but not ->release */ 75 struct list_head pde_openers; /* who did ->open, but not ->release */
76 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
77 u8 namelen;
78 char name[];
79}; 79};
80 80
81enum kcore_type { 81enum kcore_type {