diff options
author | Rob Landley <rob@landley.net> | 2012-11-13 17:14:08 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-11-13 17:14:08 -0600 |
commit | 7aa651a6a4496d848f86de9b1e6b3a003256a01f (patch) | |
tree | 6995fb4b7cc2e90a6706b0239ebaf95d9dbab530 /toys/other/mkswap.c | |
parent | 571b0706cce45716126776d0ad0f6ac65f4586e3 (diff) | |
download | toybox-7aa651a6a4496d848f86de9b1e6b3a003256a01f.tar.gz |
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.
The actual code should be the same afterward, this is just cosmetic refactoring.
Diffstat (limited to 'toys/other/mkswap.c')
-rw-r--r-- | toys/other/mkswap.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/toys/other/mkswap.c b/toys/other/mkswap.c index 1e96c196..ff864244 100644 --- a/toys/other/mkswap.c +++ b/toys/other/mkswap.c @@ -1,40 +1,38 @@ -/* vi: set sw=4 ts=4: - * - * mkswap.c - Format swap device. +/* mkswap.c - Format swap device. * * Copyright 2009 Rob Landley <rob@landley.net> USE_MKSWAP(NEWTOY(mkswap, "<1>1", TOYFLAG_SBIN)) config MKSWAP - bool "mkswap" - default y - help - usage: mkswap DEVICE + bool "mkswap" + default y + help + usage: mkswap DEVICE - Sets up a Linux swap area on a device or file. + Sets up a Linux swap area on a device or file. */ #include "toys.h" void mkswap_main(void) { - int fd = xopen(*toys.optargs, O_RDWR), pagesize = sysconf(_SC_PAGE_SIZE); - off_t len = fdlength(fd); - unsigned int pages = (len/pagesize)-1, *swap = (unsigned int *)toybuf; + int fd = xopen(*toys.optargs, O_RDWR), pagesize = sysconf(_SC_PAGE_SIZE); + off_t len = fdlength(fd); + unsigned int pages = (len/pagesize)-1, *swap = (unsigned int *)toybuf; - // Write header. Note that older kernel versions checked signature - // on disk (not in cache) during swapon, so sync after writing. + // Write header. Note that older kernel versions checked signature + // on disk (not in cache) during swapon, so sync after writing. - swap[0] = 1; - swap[1] = pages; - xlseek(fd, 1024, SEEK_SET); - xwrite(fd, swap, 129*sizeof(unsigned int)); - xlseek(fd, pagesize-10, SEEK_SET); - xwrite(fd, "SWAPSPACE2", 10); - fsync(fd); + swap[0] = 1; + swap[1] = pages; + xlseek(fd, 1024, SEEK_SET); + xwrite(fd, swap, 129*sizeof(unsigned int)); + xlseek(fd, pagesize-10, SEEK_SET); + xwrite(fd, "SWAPSPACE2", 10); + fsync(fd); - if (CFG_TOYBOX_FREE) close(fd); + if (CFG_TOYBOX_FREE) close(fd); - printf("Swapspace size: %luk\n", pages*(unsigned long)(pagesize/1024)); + printf("Swapspace size: %luk\n", pages*(unsigned long)(pagesize/1024)); } |