aboutsummaryrefslogtreecommitdiff
path: root/swapoff.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-10-18 21:22:59 +0000
committerEric Andersen <andersen@codepoet.org>1999-10-18 21:22:59 +0000
commit8759006b55c617811a207cc4e99792996c8b97fb (patch)
treeae74dfbfd1ea2d85e54673de631471ab40fc277a /swapoff.c
parent7f04b5e3208882eaeabb8c11d64c9b6e90d3e253 (diff)
downloadbusybox-8759006b55c617811a207cc4e99792996c8b97fb.tar.gz
More fixes
Diffstat (limited to 'swapoff.c')
-rw-r--r--swapoff.c52
1 files changed, 0 insertions, 52 deletions
diff --git a/swapoff.c b/swapoff.c
deleted file mode 100644
index 29b9daedd..000000000
--- a/swapoff.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <sys/swap.h>
-#include <string.h>
-#include <errno.h>
-#include <mntent.h>
-#include "internal.h"
-
-const char swapoff_usage[] = "swapoff block-device\n"
-"\n"
-"\tStop swapping virtual memory pages on the given device.\n";
-
-extern int
-swapoff_fn(const struct FileInfo * i)
-{
- struct mntent entries[100];
- int count = 0;
- FILE * swapsTable = setmntent("/proc/swaps", "r");
- struct mntent * m;
-
- if (!(swapoff(i->source))) {
- if ( swapsTable == 0 ) {
- fprintf(stderr, "/etc/swaps: %s\n", strerror(errno));
- return 1;
- }
- while ( (m = getmntent(swapsTable)) != 0 ) {
- entries[count].mnt_fsname = strdup(m->mnt_fsname);
- entries[count].mnt_dir = strdup(m->mnt_dir);
- entries[count].mnt_type = strdup(m->mnt_type);
- entries[count].mnt_opts = strdup(m->mnt_opts);
- entries[count].mnt_freq = m->mnt_freq;
- entries[count].mnt_passno = m->mnt_passno;
- count++;
- }
- endmntent(swapsTable);
- if ( (swapsTable = setmntent("/etc/swaps", "w")) ) {
- int id;
- for ( id = 0; id < count; id++ ) {
- int result =
- (strcmp(entries[id].mnt_fsname, i->source)==0
- ||strcmp(entries[id].mnt_dir, i->source)==0);
- if ( result )
- continue;
- else
- addmntent(swapsTable, &entries[id]);
- }
- endmntent(swapsTable);
- }
- else if ( errno != EROFS )
- fprintf(stderr, "/etc/swaps: %s\n", strerror(errno));
- return (0);
- }
- return (-1);
-}