[Toybox] New toys: swapon and swapoff

Elie De Brauwer eliedebrauwer at gmail.com
Sat Feb 18 06:38:09 PST 2012


Hi all,

In attach you can find initial implementations of swapon and swapoff, 
swapon supports passing the priority, there is however no support for -a.

Toybox only swapping snippet:
edb at lapedb:~/toybox$ dd if=/dev/zero of=swapfile bs=10M count=3
3+0 records in
3+0 records out
31457280 bytes (31 MB) copied, 0.02503 s, 1.3 GB/s
edb at lapedb:~/toybox$ ./toybox mkswap swapfile
Swapspace size: 30716k
edb at lapedb:~/toybox$ sudo ./toybox swapon swapfile
edb at lapedb:~/toybox$ cat /proc/swaps
Filename			Type		Size	Used Priority
/dev/sda2                       partition	9445508	0	-1
/home/edb/toybox/swapfile      file		30716	0	-2
edb at lapedb:~/toybox$ sudo ./toybox swapoff swapfile
edb at lapedb:~/toybox$ cat /proc/swaps
Filename			Type		Size	Used Priority
/dev/sda2                       partition	9445508	0	-1
edb at lapedb:~/toybox$

my 2 cents
E.

-- 
Elie De Brauwer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: swapon_swapoff.patch
Type: text/x-patch
Size: 2070 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20120218/52da61ca/attachment-0006.bin>


More information about the Toybox mailing list