Browse Source

Remove warnings. Default port to 1234.

Conditionally link winsock lib (only windows).
Linux cachu bufer drop disabled.
pull/1/head
gkostka 11 years ago
parent
commit
096ac0cfd2
  1. 2
      blockdev/filedev/ext4_filedev.c
  2. 7
      fs_test/fs_test.cmake
  3. 3
      fs_test/lwext4_client.c
  4. 27
      fs_test/lwext4_server.c

2
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**************************************/

7
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)
if(WIN32)
target_link_libraries(lwext4_client ws2_32)
endif(WIN32)

3
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;
}

27
fs_test/lwext4_server.c

@ -1,8 +1,8 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
@ -19,10 +19,12 @@
#include <sys/types.h>
#endif
#include <ext4.h>
#include <ext4_filedev.h>
#include <io_raw.h>
#include <ext4.h>
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;
}

Loading…
Cancel
Save