On Fri, Jul 29, 2011 at 01:15:59AM +0200, Robert Millan wrote: > Please consider this patch, it implements Linux-like /proc/swaps for > linprocfs. > > E.g. > > $ cat /proc/swaps > Filename Type Size Used > Priority > /dev/zvol/dimoni/swap unknown 2097152 0 -1 > > -- > Robert Millan
The patch is too hackish, IMHO. I would prefer to have an exported kernel function that fills xswdev by index, used both by vm_swap_info and linprocfs. For the device name, you would use sw_vp->v_rdev->si_name, see, for instance, the following fragment in the swapoff_all(): if (vn_isdisk(sp->sw_vp, NULL)) devname = sp->sw_vp->v_rdev->si_name; else devname = "[file]"; This could be another function that returns swap information by index.
pgpWfXDOOYNOR.pgp
Description: PGP signature