[PATCH] Linux-like /proc/swaps for linprocfs

Kostik Belousov kostikbel at gmail.com
Thu Jul 28 23:35:47 UTC 2011


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20110728/6a6f262a/attachment.pgp


More information about the freebsd-emulation mailing list