diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-07-04 13:43:34 +0400 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-07-05 04:04:03 +0400 |
commit | f79026b4912bcd2336667f4c1663c06e233f0b32 (patch) | |
tree | 645b776032e924b587fad986aa3f3dc08c98d4c5 /src/unix | |
parent | 678e9e045becdc5d75f2ce2259ed01c3531ee181 (diff) |
fileops: Cleanup
Cleaned up the structure of the whole OS-abstraction layer.
fileops.c now contains a set of utility methods for file management used
by the library. These are abstractions on top of the original POSIX
calls.
There's a new file called `posix.c` that contains
emulations/reimplementations of all the POSIX calls the library uses.
These are prefixed with `p_`. There's a specific posix file for each
platform (win32 and unix).
All the path-related methods have been moved from `utils.c` to `path.c`
and have their own prefix.
Diffstat (limited to 'src/unix')
-rw-r--r-- | src/unix/map.c | 4 | ||||
-rw-r--r-- | src/unix/posix.h | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/unix/map.c b/src/unix/map.c index 1f50bcf2e..5192c8e4c 100644 --- a/src/unix/map.c +++ b/src/unix/map.c @@ -6,7 +6,7 @@ #include <sys/mman.h> #include <errno.h> -int git__mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset) +int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset) { int mprot = 0; int mflag = 0; @@ -48,7 +48,7 @@ int git__mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t o return GIT_SUCCESS; } -int git__munmap(git_map *map) +int p_munmap(git_map *map) { assert(map != NULL); diff --git a/src/unix/posix.h b/src/unix/posix.h new file mode 100644 index 000000000..ab98c451d --- /dev/null +++ b/src/unix/posix.h @@ -0,0 +1,14 @@ +#ifndef INCLUDE_posix__w32_h__ +#define INCLUDE_posix__w32_h__ + +#include "common.h" + +#define p_lstat(p,b) lstat(p,b) +#define p_readlink(a, b, c) readlink(a, b, c) +#define p_link(o,n) link(o, n) +#define p_unlink(p) unlink(p) +#define p_mkdir(p,m) mkdir(p, m) +#define p_fsync(fd) fsync(fd) +#define p_realpath(p, r) realpath(p, r) + +#endif |