mm/swapfile.c/get_swaparea_info - a cosmetic change
PATCH 1/1 mm/swapfile.c/get_swaparea_info - a cosmetic change
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).
swapfile.c renamed from swapfile.c.orig +9 -13
@@ -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);
Hi!
Quoted 4 lines
The header line of
/proc/swapsdoes 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
Signature · 2 lines
"I do not steal MS software. It is not worth it."
-- Pavel Kankovsky