annotate toys/other/swapoff.c @ 1322:b91284c2e569 draft

Make "losetup /dev/loop0 filename" work. Sigh. Implement the complex cases and you screw up the simple cases you already tested...
author Rob Landley <rob@landley.net>
date Thu, 29 May 2014 06:29:12 -0500
parents 786841fdb1e0
children 57f2a26fa92c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 656
diff changeset
1 /* swapoff.c - Disable region for swapping
482
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
2 *
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
3 * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
4
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
5 USE_SWAPOFF(NEWTOY(swapoff, "<1>1", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
6
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
7 config SWAPOFF
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 656
diff changeset
8 bool "swapoff"
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 656
diff changeset
9 default y
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 656
diff changeset
10 help
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 656
diff changeset
11 usage: swapoff swapregion
482
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
12
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 656
diff changeset
13 Disable swapping on a given swapregion.
482
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
14 */
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
15
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
16 #include "toys.h"
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
17
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
18 void swapoff_main(void)
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
19 {
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 656
diff changeset
20 if (swapoff(toys.optargs[0])) perror_exit("failed to remove swaparea");
482
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
21 }