Commit e3769795 authored by Arnau Bago Castro's avatar Arnau Bago Castro
Browse files

norn and dloom modified

parent 0ad1779a
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -45,10 +45,15 @@ char buff[10] = "hola";
__attribute__((constructor)) static void init(void);
__attribute__((destructor)) static void finit(void); 

struct task{
	pid_t pid;
	uint64_t taskId;
	const char *filePath;

/* I/O task descriptor */
struct norns_iotd {
    int ni_tid;           /* task identifier */
    int ni_ibid;          /* source backend identifier */
    const char* ni_ipath; /* path to data source */
    int ni_obid;          /* destination backend identifier */
    const char* ni_opath; /* path to data destination */
    int ni_type;          /* operation to be performed */
};


@@ -95,10 +100,9 @@ int push_job(){
	 * return -1 on error
	 */
	
	struct task t;
	t.pid = 1234;
	t.taskId = 4321;
	t.filePath = "/tmp/something";
	struct norns_iotd t;
	t.ni_tid = 1234;
	t.ni_ibid = 4321;

	if (write(sock, &t, sizeof(t)) < 0){
        perror("writing on stream socket");
+11 −7
Original line number Diff line number Diff line
@@ -55,10 +55,13 @@ const int MAX_CLIENTS_SUPPORTED = 20;
ev_periodic every_few_seconds;

extern "C" {
	struct foo {
		pid_t pid;
		uint64_t taskId;
		const char* filePath;
	struct norns_iotd {
	    int ni_tid;           /* task identifier */
	    int ni_ibid;          /* source backend identifier */
	    const char* ni_ipath; /* path to data source */
	    int ni_obid;          /* destination backend identifier */
	    const char* ni_opath; /* path to data destination */
	    int ni_type;          /* operation to be performed */
	};
}

@@ -321,7 +324,7 @@ static void read_cb(struct ev_loop *loop, struct ev_io *watcher, int revents){
	(void)revents;
	(void)loop;

	foo t;
	norns_iotd t;
	ssize_t read;

	if(EV_ERROR & revents)
@@ -347,11 +350,12 @@ static void read_cb(struct ev_loop *loop, struct ev_io *watcher, int revents){
    	return;
    } else {
    	log_message(LOG_FILE, "we have received this message: ");
    	log_message(LOG_FILE, (std::to_string(t.taskId)).c_str());
    	log_message(LOG_FILE, (std::to_string(t.ni_tid)).c_str());
    }
    
}


inline static sock_ev_client client_new(int fd){
	sock_ev_client client;
	client.fd = fd;