Hash :
e1de726c
Author :
Date :
2012-03-12T22:55:40
Migrate ODB files to new error handling This migrates odb.c, odb_loose.c, odb_pack.c and pack.c to the new style of error handling. Also got the unix and win32 versions of map.c. There are some minor changes to other files but no others were completely converted. This also contains an update to filebuf so that a zeroed out filebuf will not think that the fd (== 0) is actually open (and inadvertently call close() on fd 0 if cleaned up). Lastly, this was built and tested on win32 and contains a bunch of fixes for the win32 build which was pretty broken.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
/*
* Copyright (C) 2009-2012 the libgit2 contributors
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_map_h__
#define INCLUDE_map_h__
#include "common.h"
/* p_mmap() prot values */
#define GIT_PROT_NONE 0x0
#define GIT_PROT_READ 0x1
#define GIT_PROT_WRITE 0x2
#define GIT_PROT_EXEC 0x4
/* git__mmmap() flags values */
#define GIT_MAP_FILE 0
#define GIT_MAP_SHARED 1
#define GIT_MAP_PRIVATE 2
#define GIT_MAP_TYPE 0xf
#define GIT_MAP_FIXED 0x10
typedef struct { /* memory mapped buffer */
void *data; /* data bytes */
size_t len; /* data length */
#ifdef GIT_WIN32
HANDLE fmh; /* file mapping handle */
#endif
} git_map;
extern int validate_map_args(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset);
extern int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset);
extern int p_munmap(git_map *map);
#endif /* INCLUDE_map_h__ */