summaryrefslogtreecommitdiffstats
path: root/mapfile.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-01-10 19:13:39 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-01-10 19:13:39 -0800
commit73ed83f26619d2a4741b863d2d8a1bd297f71c1b (patch)
tree7d0e3dbdc2a6ebdba09c9d542777ce18f98c1492 /mapfile.c
parentad9787145ca5fb117def53d2697e1f9e7b618f6b (diff)
downloadwraplinux-73ed83f26619d2a4741b863d2d8a1bd297f71c1b.tar.gz
wraplinux-73ed83f26619d2a4741b863d2d8a1bd297f71c1b.tar.xz
wraplinux-73ed83f26619d2a4741b863d2d8a1bd297f71c1b.zip
Go to Linux kernel indentation style throughout
Diffstat (limited to 'mapfile.c')
-rw-r--r--mapfile.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/mapfile.c b/mapfile.c
index 0f26ca6..370175e 100644
--- a/mapfile.c
+++ b/mapfile.c
@@ -27,26 +27,28 @@
void *mapfile(int fd, size_t *len, int writable)
{
- struct stat st;
- void *ptr;
+ struct stat st;
+ void *ptr;
- if (fstat(fd, &st))
- return NULL;
+ if (fstat(fd, &st))
+ return NULL;
- *len = st.st_size;
+ *len = st.st_size;
- if (writable)
- ptr = mmap(NULL, st.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
- else
- ptr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+ if (writable)
+ ptr =
+ mmap(NULL, st.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
+ fd, 0);
+ else
+ ptr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
- return (ptr == MAP_FAILED) ? NULL : ptr;
+ return (ptr == MAP_FAILED) ? NULL : ptr;
}
void unmapfile(int fd, void *ptr, size_t len)
{
- if (ptr)
- munmap(ptr, len);
- if (fd >= 0)
- close(fd);
+ if (ptr)
+ munmap(ptr, len);
+ if (fd >= 0)
+ close(fd);
}