Merge pull request #7 from cozis/claude/fix-as-011CUw81oePGJUvH3eAuvBjP
Claude
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
CFLAGS = -Wall -Wextra -ggdb -fsanitize=address,undefined
|
CFLAGS = -Wall -Wextra -ggdb
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
LFLAGS = -lws2_32
|
LFLAGS = -lws2_32
|
||||||
|
|||||||
+8
-6
@@ -219,8 +219,10 @@ alloc_operation(TinyDFS *tdfs, OperationType type, int off, void *ptr, int len)
|
|||||||
if (tdfs->num_operations == MAX_OPERATIONS)
|
if (tdfs->num_operations == MAX_OPERATIONS)
|
||||||
return -1;
|
return -1;
|
||||||
Operation *o = tdfs->operations;
|
Operation *o = tdfs->operations;
|
||||||
while (o->type != OPERATION_TYPE_FREE)
|
while (o - tdfs->operations < MAX_OPERATIONS && o->type != OPERATION_TYPE_FREE)
|
||||||
o++;
|
o++;
|
||||||
|
if (o - tdfs->operations >= MAX_OPERATIONS)
|
||||||
|
return -1;
|
||||||
o->type = type;
|
o->type = type;
|
||||||
o->ptr = ptr;
|
o->ptr = ptr;
|
||||||
o->off = off;
|
o->off = off;
|
||||||
@@ -418,7 +420,7 @@ int tinydfs_submit_create(TinyDFS *tdfs, char *path, int path_len,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return opidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tinydfs_submit_delete(TinyDFS *tdfs, char *path, int path_len)
|
int tinydfs_submit_delete(TinyDFS *tdfs, char *path, int path_len)
|
||||||
@@ -444,7 +446,7 @@ int tinydfs_submit_delete(TinyDFS *tdfs, char *path, int path_len)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return opidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tinydfs_submit_list(TinyDFS *tdfs, char *path, int path_len)
|
int tinydfs_submit_list(TinyDFS *tdfs, char *path, int path_len)
|
||||||
@@ -471,7 +473,7 @@ int tinydfs_submit_list(TinyDFS *tdfs, char *path, int path_len)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return opidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int send_read_message(TinyDFS *tdfs, int opidx, int tag, string path, uint32_t offset, uint32_t length)
|
static int send_read_message(TinyDFS *tdfs, int opidx, int tag, string path, uint32_t offset, uint32_t length)
|
||||||
@@ -504,7 +506,7 @@ int tinydfs_submit_read(TinyDFS *tdfs, char *path, int path_len, int off, void *
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return opidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tinydfs_submit_write(TinyDFS *tdfs, char *path, int path_len, int off, void *src, int len)
|
int tinydfs_submit_write(TinyDFS *tdfs, char *path, int path_len, int off, void *src, int len)
|
||||||
@@ -522,7 +524,7 @@ int tinydfs_submit_write(TinyDFS *tdfs, char *path, int path_len, int off, void
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return opidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tinydfs_result_free(TinyDFS_Result *result)
|
void tinydfs_result_free(TinyDFS_Result *result)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "TinyDFS.h"
|
#include "TinyDFS.h"
|
||||||
|
|
||||||
#define MAX_PENDING_OPERATION 128
|
#define MAX_PENDING_OPERATION 8
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PENDING_OPERATION_CREATE,
|
PENDING_OPERATION_CREATE,
|
||||||
|
|||||||
Reference in New Issue
Block a user