Commit f056c93d authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Define NORNS_IOTASK_REMOVE and basic transferor

This commit defines the NORNS_IOTASK_REMOVE subtype and also implements
the basic mechanism so that a task of this type can be executed.
parent de383d42
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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 {
+2 −1
Original line number Diff line number Diff line
@@ -63,7 +63,8 @@ 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)) {
        return NORNS_EBADARGS;
    }

+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ norns::iotask_type decode_iotask_type(::google::protobuf::uint32 type) {
            return iotask_type::copy;
        case NORNS_IOTASK_MOVE:
            return iotask_type::move;
        case NORNS_IOTASK_REMOVE:
            return iotask_type::remove;
        default:
            return iotask_type::unknown;
    }
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ using iotask_id = norns_tid_t;
enum class iotask_type {
    copy,
    move,
    remove,
    noop,
    unknown
};
+5 −0
Original line number Diff line number Diff line
@@ -103,6 +103,11 @@ task_manager::create_task(iotask_type type, const auth::credentials& auth,
                    io::task<iotask_type::move>(
                        std::move(task_info_ptr), std::move(tx_ptr)), register_completion);
                break;
            case iotask_type::remove:
                m_runners.submit_with_epilog_and_forget(
                    io::task<iotask_type::remove>(
                        std::move(task_info_ptr), std::move(tx_ptr)), register_completion);
                break;
            default:
                m_runners.submit_and_forget(
                    io::task<iotask_type::unknown>(
Loading