All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/swapfile.c/get_swaparea_info - a cosmetic change
@ 2001-11-30 21:32 Denis Zaitsev
  2001-12-03 22:34 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Zaitsev @ 2001-11-30 21:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: torvalds

The header line of /proc/swaps does not match the consequence ones in
case of devfs' names.  These names are too long in comparison with the
<Filename> header's part.  So, I've added one tab into the header and
made the path's part of other lines to be of length 40-1 vs. 32-1.

Also, I've changed three calls for sprintf with one...

Linus, please, apply this cosmetic patch (it is against 2.4.16).


--- mm/swapfile.c.orig	Sat Dec  1 02:10:17 2001
+++ mm/swapfile.c	Wed Nov 28 22:05:00 2001
@@ -804,25 +804,17 @@ int get_swaparea_info(char *buf)
 {
 	char * page = (char *) __get_free_page(GFP_KERNEL);
 	struct swap_info_struct *ptr = swap_info;
-	int i, j, len = 0, usedswap;
+	int i, len;
 
 	if (!page)
 		return -ENOMEM;
 
-	len += sprintf(buf, "Filename\t\t\tType\t\tSize\tUsed\tPriority\n");
+	len = sprintf(buf, "Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");
 	for (i = 0 ; i < nr_swapfiles ; i++, ptr++) {
 		if ((ptr->flags & SWP_USED) && ptr->swap_map) {
 			char * path = d_path(ptr->swap_file, ptr->swap_vfsmnt,
 						page, PAGE_SIZE);
-
-			len += sprintf(buf + len, "%-31s ", path);
-
-			if (!ptr->swap_device)
-				len += sprintf(buf + len, "file\t\t");
-			else
-				len += sprintf(buf + len, "partition\t");
-
-			usedswap = 0;
+			int j, usedswap = 0;
 			for (j = 0; j < ptr->max; ++j)
 				switch (ptr->swap_map[j]) {
 					case SWAP_MAP_BAD:
@@ -831,8 +823,12 @@ int get_swaparea_info(char *buf)
 					default:
 						usedswap++;
 				}
-			len += sprintf(buf + len, "%d\t%d\t%d\n", ptr->pages << (PAGE_SHIFT - 10), 
-				usedswap << (PAGE_SHIFT - 10), ptr->prio);
+			len += sprintf(buf + len, "%-39s %s\t%d\t%d\t%d\n",
+				       path,
+				       ptr->swap_device ? "partition" : "file\t",
+				       ptr->pages << (PAGE_SHIFT - 10),
+				       usedswap << (PAGE_SHIFT - 10),
+				       ptr->prio);
 		}
 	}
 	free_page((unsigned long) page);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/swapfile.c/get_swaparea_info - a cosmetic change
  2001-11-30 21:32 [PATCH] mm/swapfile.c/get_swaparea_info - a cosmetic change Denis Zaitsev
@ 2001-12-03 22:34 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2001-12-03 22:34 UTC (permalink / raw)
  To: Denis Zaitsev; +Cc: linux-kernel, torvalds

Hi!

> The header line of /proc/swaps does not match the consequence ones in
> case of devfs' names.  These names are too long in comparison with the
> <Filename> header's part.  So, I've added one tab into the header and
> made the path's part of other lines to be of length 40-1 vs. 32-1.

This is unneccessary interface change in stable series. Don't do
this. At least not in 2.4.X.

								Pavel
-- 
"I do not steal MS software. It is not worth it."
                                -- Pavel Kankovsky

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-12-04  0:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-30 21:32 [PATCH] mm/swapfile.c/get_swaparea_info - a cosmetic change Denis Zaitsev
2001-12-03 22:34 ` Pavel Machek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.