diff --git a/blockdev/filedev/ext4_filedev.c b/blockdev/filedev/ext4_filedev.c index ea3ba7c..aa63600 100644 --- a/blockdev/filedev/ext4_filedev.c +++ b/blockdev/filedev/ext4_filedev.c @@ -45,7 +45,7 @@ static const char *fname = "ext2"; /**@brief Image file descriptor.*/ static FILE *dev_file; -#define DROP_LINUXCACHE_BUFFERS 1 +#define DROP_LINUXCACHE_BUFFERS 0 /**********************BLOCKDEV INTERFACE**************************************/ diff --git a/fs_test/fs_test.cmake b/fs_test/fs_test.cmake index affbe89..8bd946b 100644 --- a/fs_test/fs_test.cmake +++ b/fs_test/fs_test.cmake @@ -7,8 +7,11 @@ aux_source_directory(blockdev/filedev_win BLOCKDEV_SRC) add_executable(lwext4_server fs_test/lwext4_server.c ${BLOCKDEV_SRC}) target_link_libraries(lwext4_server lwext4) +if(WIN32) target_link_libraries(lwext4_server ws2_32) - +endif(WIN32) add_executable(lwext4_client fs_test/lwext4_client.c ${BLOCKDEV_SRC}) target_link_libraries(lwext4_client lwext4) -target_link_libraries(lwext4_client ws2_32) \ No newline at end of file +if(WIN32) +target_link_libraries(lwext4_client ws2_32) +endif(WIN32) \ No newline at end of file diff --git a/fs_test/lwext4_client.c b/fs_test/lwext4_client.c index ae77961..f1a6855 100644 --- a/fs_test/lwext4_client.c +++ b/fs_test/lwext4_client.c @@ -27,7 +27,7 @@ static void winsock_fini(void); static char *server_addr = "127.0.0.1"; /**@brief Default connection port.*/ -static int connection_port = 8888; +static int connection_port = 1234; /**@brief Call op*/ static char *op_code; @@ -142,7 +142,6 @@ int main(int argc, char *argv[]) if(rc) printf("\t%s\n",op_code); - closesocket(sockfd); return rc; } diff --git a/fs_test/lwext4_server.c b/fs_test/lwext4_server.c index deb9bd6..fefce29 100644 --- a/fs_test/lwext4_server.c +++ b/fs_test/lwext4_server.c @@ -1,8 +1,8 @@ +#include #include #include #include -#include #include #include #include @@ -19,10 +19,12 @@ #include #endif -#include + #include #include +#include + static int winsock_init(void); static void winsock_fini(void); static char* entry_to_str(uint8_t type); @@ -35,7 +37,7 @@ static char* entry_to_str(uint8_t type); /**@brief Default connection port*/ -static int connection_port = 8888; +static int connection_port = 1234; /**@brief Default filesystem filename.*/ static char *ext4_fname = "ext2"; @@ -205,7 +207,7 @@ static int exec_op_code(char *opcode) clock_t t = get_ms(); r = op_call[i].lwext4_call(opcode); - printf("rc: %d, time: %ums\n", r, get_ms() - t); + printf("rc: %d, time: %ums\n", r, (unsigned int)(get_ms() - t)); break; } @@ -322,7 +324,6 @@ int main(int argc, char *argv[]) close(connfd); } - closesocket(listenfd); winsock_fini(); return 0; } @@ -786,7 +787,7 @@ int _multi_fcreate(char *p) int i; ext4_file fd; - if(sscanf(p, "%s %s %d", &path, prefix, &cnt) != 3){ + if(sscanf(p, "%s %s %d", path, prefix, &cnt) != 3){ printf("Param list error\n"); return -1; } @@ -813,7 +814,7 @@ int _multi_fwrite(char *p) int i, d, wb; ext4_file fd; - if(sscanf(p, "%s %s %d %d", &path, prefix, &cnt, &ll) != 4){ + if(sscanf(p, "%s %s %d %d", path, prefix, &cnt, &ll) != 4){ printf("Param list error\n"); return -1; } @@ -856,7 +857,7 @@ int _multi_fread(char *p) int i, d, rb; ext4_file fd; - if(sscanf(p, "%s %s %d %d", &path, prefix, &cnt, &ll) != 4){ + if(sscanf(p, "%s %s %d %d", path, prefix, &cnt, &ll) != 4){ printf("Param list error\n"); return -1; } @@ -902,7 +903,7 @@ int _multi_fremove(char *p) char prefix[32]; int cnt, i, rc; - if(sscanf(p, "%s %s %d", &path, prefix, &cnt) != 3){ + if(sscanf(p, "%s %s %d", path, prefix, &cnt) != 3){ printf("Param list error\n"); return -1; } @@ -924,7 +925,7 @@ int _multi_dcreate(char *p) char prefix[32]; int cnt, i, rc; - if(sscanf(p, "%s %s %d", &path, prefix, &cnt) != 3){ + if(sscanf(p, "%s %s %d", path, prefix, &cnt) != 3){ printf("Param list error\n"); return -1; } @@ -946,7 +947,7 @@ int _multi_dremove(char *p) char prefix[32]; int cnt, i, rc; - if(sscanf(p, "%s %s %d", &path, prefix, &cnt) != 3){ + if(sscanf(p, "%s %s %d", path, prefix, &cnt) != 3){ printf("Param list error\n"); return -1; } @@ -967,7 +968,7 @@ int _stats_save(char *p) { char path[256]; - if(sscanf(p, "%s", &path) != 1){ + if(sscanf(p, "%s", path) != 1){ printf("Param list error\n"); return -1; } @@ -982,7 +983,7 @@ int _stats_check(char *p) struct ext4_mount_stats actual_stats; - if(sscanf(p, "%s", &path) != 1){ + if(sscanf(p, "%s", path) != 1){ printf("Param list error\n"); return -1; }