Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions server/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CC=gcc

LIBS = -lpthread
LIBS = -lpthread -lftl $(shell pkg-config --libs glib-2.0)
CFLAGS = $(shell pkg-config --cflags glib-2.0) -I/usr/local/include/ftl

SERVER_OBJS=usocket_srv.o
CLIENT_OBJS=usocket_cli.o
Expand All @@ -11,7 +12,7 @@ CLIENT_TARGET=usocket_cli
all: server client

server: $(SERVER_OBJS)
$(CC) -o $(SERVER_TARGET) $(SERVER_OBJS) $(LIBS)
$(CC) $(CFLAGS) -o $(SERVER_TARGET) $(SERVER_OBJS) $(LIBS)

client: $(CLIENT_OBJS)
$(CC) -o $(CLIENT_TARGET) $(CLIENT_OBJS)
Expand Down
2 changes: 1 addition & 1 deletion server/usocket_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ typedef unsigned short u16;
#define READ 0
#define WRITE 1

char *servip = "192.168.112.4";
char *servip = "127.0.0.1";

typedef struct {
unsigned int op;
Expand Down
21 changes: 11 additions & 10 deletions server/usocket_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
#include <signal.h>
#include <pthread.h>

#define ALLOW_FTL 0
#define ALLOW_FTL 1

#if ALLOW_FTL
#include "include/module.h"
#include "include/flash.h"
#include "include/page.h"
#include "include/device.h"
#include "module.h"
#include "flash.h"
#include "page.h"
#include "device.h"
#endif

#define SERV_DEBUG 0
#define SERV_DEBUG 1

typedef unsigned long long u64;
typedef unsigned short u16;
Expand Down Expand Up @@ -49,8 +49,9 @@ int recv_packet(int client_fd, packet_t *packet)
int len;

len = recv(client_fd, packet, sizeof(packet_t), MSG_WAITALL);
if (len != sizeof(packet_t))
perror("recv failed");
if (len != sizeof(packet_t)) {
perror("recv packet failed");
}

#if SERV_DEBUG
printf("recv packet op(%d) offset(%lu) size(%llu) tag(%u)\n",
Expand Down Expand Up @@ -139,7 +140,7 @@ void *handle_packet(void *data)
goto out;
}

fd = open("/mnt/nvme/data_file", O_CREAT | O_RDWR);
fd = open("data_file", O_CREAT | O_RDWR);
if (fd < 0) {
perror("open error");
free(buffer);
Expand Down Expand Up @@ -245,7 +246,7 @@ int main()

#if ALLOW_FTL
module_init(PAGE_FTL_MODULE, &flash, RAMDISK_MODULE);
flash->f_op->open(flash, NULL);
flash->f_op->open(flash, NULL, O_CREAT | O_RDWR);
#endif

init_server();
Expand Down