| * Mini swapon/swapoff implementation for busybox |
| * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
| * Licensed under the GPL version 2, see the file LICENSE in this tarball. |
| static int swap_enable_disable(char *device) |
| if (st.st_blocks * (off_t)512 < st.st_size) |
| bb_error_msg("warning: swap file has holes"); |
| if (applet_name[5] == 'n') |
| status = swapon(device, 0); |
| status = swapoff(device); |
| bb_simple_perror_msg(device); |
| static int do_em_all(void) |
| f = setmntent("/etc/fstab", "r"); |
| bb_perror_msg_and_die("/etc/fstab"); |
| while ((m = getmntent(f)) != NULL) |
| if (strcmp(m->mnt_type, MNTTYPE_SWAP) == 0) |
| err += swap_enable_disable(m->mnt_fsname); |
| int swap_on_off_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| int swap_on_off_main(int argc, char **argv) |
| ret = getopt32(argv, "a"); |
| ret += swap_enable_disable(*argv); |