mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Signed-off-by: Kees Cook <[email protected]> Cc: Joe Perches <[email protected]> Cc: David Miller <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
839cc2a94c
commit
652586df95
10 changed files with 73 additions and 97 deletions
|
|
@ -29,7 +29,6 @@ static int show_console_dev(struct seq_file *m, void *v)
|
|||
char flags[ARRAY_SIZE(con_flags) + 1];
|
||||
struct console *con = v;
|
||||
unsigned int a;
|
||||
int len;
|
||||
dev_t dev = 0;
|
||||
|
||||
if (con->device) {
|
||||
|
|
@ -47,11 +46,10 @@ static int show_console_dev(struct seq_file *m, void *v)
|
|||
con_flags[a].name : ' ';
|
||||
flags[a] = 0;
|
||||
|
||||
seq_printf(m, "%s%d%n", con->name, con->index, &len);
|
||||
len = 21 - len;
|
||||
if (len < 1)
|
||||
len = 1;
|
||||
seq_printf(m, "%*c%c%c%c (%s)", len, ' ', con->read ? 'R' : '-',
|
||||
seq_setwidth(m, 21 - 1);
|
||||
seq_printf(m, "%s%d", con->name, con->index);
|
||||
seq_pad(m, ' ');
|
||||
seq_printf(m, "%c%c%c (%s)", con->read ? 'R' : '-',
|
||||
con->write ? 'W' : '-', con->unblank ? 'U' : '-',
|
||||
flags);
|
||||
if (dev)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
|
|||
unsigned long ino = 0;
|
||||
struct file *file;
|
||||
dev_t dev = 0;
|
||||
int flags, len;
|
||||
int flags;
|
||||
|
||||
flags = region->vm_flags;
|
||||
file = region->vm_file;
|
||||
|
|
@ -50,8 +50,9 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
|
|||
ino = inode->i_ino;
|
||||
}
|
||||
|
||||
seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
|
||||
seq_printf(m,
|
||||
"%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
|
||||
"%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
|
||||
region->vm_start,
|
||||
region->vm_end,
|
||||
flags & VM_READ ? 'r' : '-',
|
||||
|
|
@ -59,13 +60,10 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
|
|||
flags & VM_EXEC ? 'x' : '-',
|
||||
flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
|
||||
((loff_t)region->vm_pgoff) << PAGE_SHIFT,
|
||||
MAJOR(dev), MINOR(dev), ino, &len);
|
||||
MAJOR(dev), MINOR(dev), ino);
|
||||
|
||||
if (file) {
|
||||
len = 25 + sizeof(void *) * 6 - len;
|
||||
if (len < 1)
|
||||
len = 1;
|
||||
seq_printf(m, "%*c", len, ' ');
|
||||
seq_pad(m, ' ');
|
||||
seq_path(m, &file->f_path, "");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,14 +84,6 @@ unsigned long task_statm(struct mm_struct *mm,
|
|||
return mm->total_vm;
|
||||
}
|
||||
|
||||
static void pad_len_spaces(struct seq_file *m, int len)
|
||||
{
|
||||
len = 25 + sizeof(void*) * 6 - len;
|
||||
if (len < 1)
|
||||
len = 1;
|
||||
seq_printf(m, "%*c", len, ' ');
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NUMA
|
||||
/*
|
||||
* These functions are for numa_maps but called in generic **maps seq_file
|
||||
|
|
@ -269,7 +261,6 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
|
|||
unsigned long long pgoff = 0;
|
||||
unsigned long start, end;
|
||||
dev_t dev = 0;
|
||||
int len;
|
||||
const char *name = NULL;
|
||||
|
||||
if (file) {
|
||||
|
|
@ -287,7 +278,8 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
|
|||
if (stack_guard_page_end(vma, end))
|
||||
end -= PAGE_SIZE;
|
||||
|
||||
seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
|
||||
seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
|
||||
seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
|
||||
start,
|
||||
end,
|
||||
flags & VM_READ ? 'r' : '-',
|
||||
|
|
@ -295,14 +287,14 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
|
|||
flags & VM_EXEC ? 'x' : '-',
|
||||
flags & VM_MAYSHARE ? 's' : 'p',
|
||||
pgoff,
|
||||
MAJOR(dev), MINOR(dev), ino, &len);
|
||||
MAJOR(dev), MINOR(dev), ino);
|
||||
|
||||
/*
|
||||
* Print the dentry name for named mappings, and a
|
||||
* special [heap] marker for the heap:
|
||||
*/
|
||||
if (file) {
|
||||
pad_len_spaces(m, len);
|
||||
seq_pad(m, ' ');
|
||||
seq_path(m, &file->f_path, "\n");
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -334,7 +326,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
|
|||
name = "[stack]";
|
||||
} else {
|
||||
/* Thread stack in /proc/PID/maps */
|
||||
pad_len_spaces(m, len);
|
||||
seq_pad(m, ' ');
|
||||
seq_printf(m, "[stack:%d]", tid);
|
||||
}
|
||||
}
|
||||
|
|
@ -342,7 +334,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
|
|||
|
||||
done:
|
||||
if (name) {
|
||||
pad_len_spaces(m, len);
|
||||
seq_pad(m, ' ');
|
||||
seq_puts(m, name);
|
||||
}
|
||||
seq_putc(m, '\n');
|
||||
|
|
|
|||
|
|
@ -123,14 +123,6 @@ unsigned long task_statm(struct mm_struct *mm,
|
|||
return size;
|
||||
}
|
||||
|
||||
static void pad_len_spaces(struct seq_file *m, int len)
|
||||
{
|
||||
len = 25 + sizeof(void*) * 6 - len;
|
||||
if (len < 1)
|
||||
len = 1;
|
||||
seq_printf(m, "%*c", len, ' ');
|
||||
}
|
||||
|
||||
/*
|
||||
* display a single VMA to a sequenced file
|
||||
*/
|
||||
|
|
@ -142,7 +134,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
|
|||
unsigned long ino = 0;
|
||||
struct file *file;
|
||||
dev_t dev = 0;
|
||||
int flags, len;
|
||||
int flags;
|
||||
unsigned long long pgoff = 0;
|
||||
|
||||
flags = vma->vm_flags;
|
||||
|
|
@ -155,8 +147,9 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
|
|||
pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
|
||||
}
|
||||
|
||||
seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
|
||||
seq_printf(m,
|
||||
"%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
|
||||
"%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
|
||||
vma->vm_start,
|
||||
vma->vm_end,
|
||||
flags & VM_READ ? 'r' : '-',
|
||||
|
|
@ -164,16 +157,16 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
|
|||
flags & VM_EXEC ? 'x' : '-',
|
||||
flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
|
||||
pgoff,
|
||||
MAJOR(dev), MINOR(dev), ino, &len);
|
||||
MAJOR(dev), MINOR(dev), ino);
|
||||
|
||||
if (file) {
|
||||
pad_len_spaces(m, len);
|
||||
seq_pad(m, ' ');
|
||||
seq_path(m, &file->f_path, "");
|
||||
} else if (mm) {
|
||||
pid_t tid = vm_is_stack(priv->task, vma, is_pid);
|
||||
|
||||
if (tid != 0) {
|
||||
pad_len_spaces(m, len);
|
||||
seq_pad(m, ' ');
|
||||
/*
|
||||
* Thread stack in /proc/PID/task/TID/maps or
|
||||
* the main process stack.
|
||||
|
|
|
|||
Loading…
Reference in a new issue