diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2013-11-14 17:31:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 19:32:20 -0500 |
commit | 652586df95e5d76b37d07a11839126dcfede1621 (patch) | |
tree | e3a668265cade256302830ea3ff8b3699ab2977e /fs/proc/task_nommu.c | |
parent | 839cc2a94cc3665bafe32203c2f095f4dd470a80 (diff) |
seq_file: remove "%n" usage from seq_file users
All seq_printf() users are using "%n" for calculating padding size,
convert them to use seq_setwidth() / seq_pad() pair.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Joe Perches <joe@perches.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/task_nommu.c')
-rw-r--r-- | fs/proc/task_nommu.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 56123a6f462e..678455d2d683 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c | |||
@@ -123,14 +123,6 @@ unsigned long task_statm(struct mm_struct *mm, | |||
123 | return size; | 123 | return size; |
124 | } | 124 | } |
125 | 125 | ||
126 | static void pad_len_spaces(struct seq_file *m, int len) | ||
127 | { | ||
128 | len = 25 + sizeof(void*) * 6 - len; | ||
129 | if (len < 1) | ||
130 | len = 1; | ||
131 | seq_printf(m, "%*c", len, ' '); | ||
132 | } | ||
133 | |||
134 | /* | 126 | /* |
135 | * display a single VMA to a sequenced file | 127 | * display a single VMA to a sequenced file |
136 | */ | 128 | */ |
@@ -142,7 +134,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma, | |||
142 | unsigned long ino = 0; | 134 | unsigned long ino = 0; |
143 | struct file *file; | 135 | struct file *file; |
144 | dev_t dev = 0; | 136 | dev_t dev = 0; |
145 | int flags, len; | 137 | int flags; |
146 | unsigned long long pgoff = 0; | 138 | unsigned long long pgoff = 0; |
147 | 139 | ||
148 | flags = vma->vm_flags; | 140 | flags = vma->vm_flags; |
@@ -155,8 +147,9 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma, | |||
155 | pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT; | 147 | pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT; |
156 | } | 148 | } |
157 | 149 | ||
150 | seq_setwidth(m, 25 + sizeof(void *) * 6 - 1); | ||
158 | seq_printf(m, | 151 | seq_printf(m, |
159 | "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n", | 152 | "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ", |
160 | vma->vm_start, | 153 | vma->vm_start, |
161 | vma->vm_end, | 154 | vma->vm_end, |
162 | flags & VM_READ ? 'r' : '-', | 155 | flags & VM_READ ? 'r' : '-', |
@@ -164,16 +157,16 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma, | |||
164 | flags & VM_EXEC ? 'x' : '-', | 157 | flags & VM_EXEC ? 'x' : '-', |
165 | flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p', | 158 | flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p', |
166 | pgoff, | 159 | pgoff, |
167 | MAJOR(dev), MINOR(dev), ino, &len); | 160 | MAJOR(dev), MINOR(dev), ino); |
168 | 161 | ||
169 | if (file) { | 162 | if (file) { |
170 | pad_len_spaces(m, len); | 163 | seq_pad(m, ' '); |
171 | seq_path(m, &file->f_path, ""); | 164 | seq_path(m, &file->f_path, ""); |
172 | } else if (mm) { | 165 | } else if (mm) { |
173 | pid_t tid = vm_is_stack(priv->task, vma, is_pid); | 166 | pid_t tid = vm_is_stack(priv->task, vma, is_pid); |
174 | 167 | ||
175 | if (tid != 0) { | 168 | if (tid != 0) { |
176 | pad_len_spaces(m, len); | 169 | seq_pad(m, ' '); |
177 | /* | 170 | /* |
178 | * Thread stack in /proc/PID/task/TID/maps or | 171 | * Thread stack in /proc/PID/task/TID/maps or |
179 | * the main process stack. | 172 | * the main process stack. |