Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e659ccf authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "seq_file: remove "%n" usage from seq_file users"

parents c6a5a54b fc42b063
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -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)
+5 −7
Original line number Diff line number Diff line
@@ -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, "");
	}

+6 −14
Original line number Diff line number Diff line
@@ -82,14 +82,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
@@ -267,7 +259,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) {
@@ -285,7 +276,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' : '-',
@@ -293,14 +285,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;
	}
@@ -332,7 +324,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);
			}
		}
@@ -340,7 +332,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');
+6 −13
Original line number Diff line number Diff line
@@ -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.
+7 −6
Original line number Diff line number Diff line
@@ -2530,16 +2530,17 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
		list_for_each_entry_rcu(fa, &li->falh, fa_list) {
			const struct fib_info *fi = fa->fa_info;
			unsigned int flags = fib_flag_trans(fa->fa_type, mask, fi);
			int len;

			if (fa->fa_type == RTN_BROADCAST
			    || fa->fa_type == RTN_MULTICAST)
				continue;

			seq_setwidth(seq, 127);

			if (fi)
				seq_printf(seq,
					 "%s\t%08X\t%08X\t%04X\t%d\t%u\t"
					 "%d\t%08X\t%d\t%u\t%u%n",
					 "%d\t%08X\t%d\t%u\t%u",
					 fi->fib_dev ? fi->fib_dev->name : "*",
					 prefix,
					 fi->fib_nh->nh_gw, flags, 0, 0,
@@ -2548,15 +2549,15 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
					 (fi->fib_advmss ?
					  fi->fib_advmss + 40 : 0),
					 fi->fib_window,
					 fi->fib_rtt >> 3, &len);
					 fi->fib_rtt >> 3);
			else
				seq_printf(seq,
					 "*\t%08X\t%08X\t%04X\t%d\t%u\t"
					 "%d\t%08X\t%d\t%u\t%u%n",
					 "%d\t%08X\t%d\t%u\t%u",
					 prefix, 0, flags, 0, 0, 0,
					 mask, 0, 0, 0, &len);
					 mask, 0, 0, 0);

			seq_printf(seq, "%*s\n", 127 - len, "");
			seq_pad(seq, '\n');
		}
	}

Loading