diff options
author | David Howells <dhowells@redhat.com> | 2011-07-27 14:47:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-27 15:50:45 -0400 |
commit | 09570f914914d2beb0db29c5a9c7344934f2fa8c (patch) | |
tree | a93900db5e607887aca3ef2cecc2426abe007d87 /fs/proc/root.c | |
parent | 5fd00b031530cc476240f654c078c930f1dcd6ea (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 'fs/proc/root.c')
-rw-r--r-- | fs/proc/root.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/proc/root.c b/fs/proc/root.c index d6c3b416529b..9a8a2b77b874 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -186,13 +186,13 @@ static const struct inode_operations proc_root_inode_operations = { | |||
186 | struct proc_dir_entry proc_root = { | 186 | struct proc_dir_entry proc_root = { |
187 | .low_ino = PROC_ROOT_INO, | 187 | .low_ino = PROC_ROOT_INO, |
188 | .namelen = 5, | 188 | .namelen = 5, |
189 | .name = "/proc", | ||
190 | .mode = S_IFDIR | S_IRUGO | S_IXUGO, | 189 | .mode = S_IFDIR | S_IRUGO | S_IXUGO, |
191 | .nlink = 2, | 190 | .nlink = 2, |
192 | .count = ATOMIC_INIT(1), | 191 | .count = ATOMIC_INIT(1), |
193 | .proc_iops = &proc_root_inode_operations, | 192 | .proc_iops = &proc_root_inode_operations, |
194 | .proc_fops = &proc_root_operations, | 193 | .proc_fops = &proc_root_operations, |
195 | .parent = &proc_root, | 194 | .parent = &proc_root, |
195 | .name = "/proc", | ||
196 | }; | 196 | }; |
197 | 197 | ||
198 | int pid_ns_prepare_proc(struct pid_namespace *ns) | 198 | int pid_ns_prepare_proc(struct pid_namespace *ns) |