Loading .gitlab-ci.yml +1 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ test:ubuntu:latest: - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_status]" - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_status]" - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_send_command]" - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_remove_local_posix_files]" after_script: - pwd - if [[ -e tests.log ]]; Loading include/norns/norns.h +5 −4 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ typedef struct { /* Task types */ #define NORNS_IOTASK_COPY 0x1 #define NORNS_IOTASK_MOVE 0x2 #define NORNS_IOTASK_REMOVE 0x3 /* I/O task status descriptor */ typedef struct { Loading @@ -79,8 +80,8 @@ typedef struct { void norns_iotask_init(norns_iotask_t* task, norns_op_t operation, norns_resource_t* src, norns_resource_t* dst) __THROW; norns_iotask_t NORNS_IOTASK(norns_op_t operation, norns_resource_t src, norns_resource_t dst) __THROW; norns_iotask_t NORNS_IOTASK(norns_op_t operation, norns_resource_t src, ...) __THROW; /* Submit an asynchronous I/O task */ norns_error_t norns_submit(norns_iotask_t* task) __THROW; Loading include/norns/norns_resources.h +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ extern "C" { /* Resource types */ #define NORNS_PROCESS_MEMORY 0x0100000 /* Memory buffer */ #define NORNS_POSIX_PATH 0x0200000 /* POSIX path */ #define NORNS_NULL_RESOURCE 0x1000000 /* Access types */ #define R_LOCAL 0x0000010 /* Local resource (default) */ Loading lib/communication.c +3 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,9 @@ send_submit_request(norns_iotask_t* task) { // XXX add missing checks: e.g. validate src resource if(task->t_id != 0 || (task->t_op != NORNS_IOTASK_COPY && task->t_op != NORNS_IOTASK_MOVE )) { task->t_op != NORNS_IOTASK_MOVE && task->t_op != NORNS_IOTASK_REMOVE)) { ERR("Invalid fields detected in norns_iotask_t"); return NORNS_EBADARGS; } Loading lib/libnorns.c +21 −4 Original line number Diff line number Diff line Loading @@ -149,10 +149,19 @@ libnorns_reload_config_file(void) { /* Public API */ norns_iotask_t NORNS_IOTASK(norns_op_t optype, norns_resource_t src, norns_resource_t dst) { NORNS_IOTASK(norns_op_t optype, norns_resource_t src, ...) { norns_iotask_t task; if(optype == NORNS_IOTASK_REMOVE) { norns_iotask_init(&task, optype, &src, NULL); return task; } va_list ap; va_start(ap, src); norns_resource_t dst = va_arg(ap, norns_resource_t); norns_iotask_init(&task, optype, &src, &dst); va_end(ap); return task; } Loading @@ -165,15 +174,23 @@ norns_iotask_init(norns_iotask_t* task, norns_op_t optype, return; } if(src == NULL || dst == NULL) { memset(task, 0, sizeof(*task)); if(src == NULL) { return; } task->t_id = 0; task->t_op = optype; task->t_src = *src; if(dst != NULL) { task->t_dst = *dst; return; } // dst is NULL, set r_flags so that we are aware of it later task->t_dst.r_flags = NORNS_NULL_RESOURCE; } norns_error_t Loading Loading
.gitlab-ci.yml +1 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ test:ubuntu:latest: - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_status]" - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_status]" - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_send_command]" - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_remove_local_posix_files]" after_script: - pwd - if [[ -e tests.log ]]; Loading
include/norns/norns.h +5 −4 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ typedef struct { /* Task types */ #define NORNS_IOTASK_COPY 0x1 #define NORNS_IOTASK_MOVE 0x2 #define NORNS_IOTASK_REMOVE 0x3 /* I/O task status descriptor */ typedef struct { Loading @@ -79,8 +80,8 @@ typedef struct { void norns_iotask_init(norns_iotask_t* task, norns_op_t operation, norns_resource_t* src, norns_resource_t* dst) __THROW; norns_iotask_t NORNS_IOTASK(norns_op_t operation, norns_resource_t src, norns_resource_t dst) __THROW; norns_iotask_t NORNS_IOTASK(norns_op_t operation, norns_resource_t src, ...) __THROW; /* Submit an asynchronous I/O task */ norns_error_t norns_submit(norns_iotask_t* task) __THROW; Loading
include/norns/norns_resources.h +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ extern "C" { /* Resource types */ #define NORNS_PROCESS_MEMORY 0x0100000 /* Memory buffer */ #define NORNS_POSIX_PATH 0x0200000 /* POSIX path */ #define NORNS_NULL_RESOURCE 0x1000000 /* Access types */ #define R_LOCAL 0x0000010 /* Local resource (default) */ Loading
lib/communication.c +3 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,9 @@ send_submit_request(norns_iotask_t* task) { // XXX add missing checks: e.g. validate src resource if(task->t_id != 0 || (task->t_op != NORNS_IOTASK_COPY && task->t_op != NORNS_IOTASK_MOVE )) { task->t_op != NORNS_IOTASK_MOVE && task->t_op != NORNS_IOTASK_REMOVE)) { ERR("Invalid fields detected in norns_iotask_t"); return NORNS_EBADARGS; } Loading
lib/libnorns.c +21 −4 Original line number Diff line number Diff line Loading @@ -149,10 +149,19 @@ libnorns_reload_config_file(void) { /* Public API */ norns_iotask_t NORNS_IOTASK(norns_op_t optype, norns_resource_t src, norns_resource_t dst) { NORNS_IOTASK(norns_op_t optype, norns_resource_t src, ...) { norns_iotask_t task; if(optype == NORNS_IOTASK_REMOVE) { norns_iotask_init(&task, optype, &src, NULL); return task; } va_list ap; va_start(ap, src); norns_resource_t dst = va_arg(ap, norns_resource_t); norns_iotask_init(&task, optype, &src, &dst); va_end(ap); return task; } Loading @@ -165,15 +174,23 @@ norns_iotask_init(norns_iotask_t* task, norns_op_t optype, return; } if(src == NULL || dst == NULL) { memset(task, 0, sizeof(*task)); if(src == NULL) { return; } task->t_id = 0; task->t_op = optype; task->t_src = *src; if(dst != NULL) { task->t_dst = *dst; return; } // dst is NULL, set r_flags so that we are aware of it later task->t_dst.r_flags = NORNS_NULL_RESOURCE; } norns_error_t Loading