Commit 2aeadb9c by Chris Young

Actually do the mmap... unsurprisingly, this makes the indexer work on SFS

On RAM: the .idx and .pack files become links to a .lock and the original download respectively.
Assume some feature (such as record locking) supported by SFS but not JXFS or RAM: is required.
parent 90490113
...@@ -363,11 +363,11 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz ...@@ -363,11 +363,11 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
if (error < 0) { if (error < 0) {
idx->off = entry_start; idx->off = entry_start;
error = store_delta(idx); error = store_delta(idx);
if (error == GIT_EBUFS) if (error == GIT_EBUFS)
return 0; return 0;
if (error < 0) if (error < 0)
return error; return error;
continue; continue;
} }
......
...@@ -158,6 +158,7 @@ static git_mwindow *new_window( ...@@ -158,6 +158,7 @@ static git_mwindow *new_window(
git_mwindow *w; git_mwindow *w;
w = git__malloc(sizeof(*w)); w = git__malloc(sizeof(*w));
if (w == NULL) if (w == NULL)
return NULL; return NULL;
......
...@@ -215,7 +215,7 @@ static int packfile_unpack_header1( ...@@ -215,7 +215,7 @@ static int packfile_unpack_header1(
unsigned shift; unsigned shift;
unsigned long size, c; unsigned long size, c;
unsigned long used = 0; unsigned long used = 0;
printf("[pack 218] buf = %lx, used = %ld, len = %ld\n", buf, used, len);
c = buf[used++]; c = buf[used++];
*type = (c >> 4) & 7; *type = (c >> 4) & 7;
size = c & 15; size = c & 15;
...@@ -261,7 +261,7 @@ int git_packfile_unpack_header( ...@@ -261,7 +261,7 @@ int git_packfile_unpack_header(
base = git_mwindow_open(mwf, w_curs, *curpos, 20, &left); base = git_mwindow_open(mwf, w_curs, *curpos, 20, &left);
if (base == NULL) if (base == NULL)
return GIT_EBUFS; return GIT_EBUFS;
printf("[pack 264] base = %lx, mwf = %lx\n", base, mwf);
ret = packfile_unpack_header1(&used, size_p, type_p, base, left); ret = packfile_unpack_header1(&used, size_p, type_p, base, left);
git_mwindow_close(w_curs); git_mwindow_close(w_curs);
if (ret == GIT_EBUFS) if (ret == GIT_EBUFS)
......
...@@ -39,12 +39,12 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs ...@@ -39,12 +39,12 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
#else #else
if ((prot & GIT_PROT_WRITE) && ((flags & GIT_MAP_TYPE) == GIT_MAP_SHARED)) { if ((prot & GIT_PROT_WRITE) && ((flags & GIT_MAP_TYPE) == GIT_MAP_SHARED)) {
printf("Trying to map shared-writeable file!!!\n"); printf("Trying to map shared-writeable file!!!\n");
}
if(out->data = malloc(len)) { if(out->data = malloc(len)) {
lseek(fd, offset, SEEK_SET); lseek(fd, offset, SEEK_SET);
p_read(fd, out->data, len); p_read(fd, out->data, len);
} }
}
#endif #endif
if (!out->data || out->data == MAP_FAILED) { if (!out->data || out->data == MAP_FAILED) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment