Verified Commit 27e9830e authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Refactor ADM_storage_resources_t

parent 97b0dddd
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -264,9 +264,28 @@ ADM_return_t
ADM_storage_destroy(ADM_storage_t storage);

/** Information about resources assigned to a storage tier */
typedef struct {
    // TODO: empty for now
} ADM_storage_resources_t;
typedef struct adm_storage_resources* ADM_storage_resources_t;

/**
 * Create an ADM_STORAGE_RESOURCES from information about storage resources.
 *
 * @remark ADM_STORAGE_RESOURCES need to be freed by calling
 * ADM_storage_resources_destroy().
 *
 * @return A valid ADM_STORAGE_RESOURCES, or NULL in case of failure
 */
ADM_storage_resources_t
ADM_storage_resources_create();

/**
 * Destroy a ADM_STORAGE_RESOURCES created by ADM_storage_resources_create().
 *
 * @param[in] res A valid ADM_STORAGE
 * @return ADM_SUCCESS or corresponding ADM error code
 */
ADM_return_t
ADM_storage_resources_destroy(ADM_storage_resources_t res);


typedef int ADM_transfer_priority_t;

+33 −0
Original line number Diff line number Diff line
@@ -82,6 +82,10 @@ struct adm_storage {
    };
};

struct adm_storage_resources {
    // TODO: empty for now
};

struct adm_adhoc_context {
    /** The adhoc storage system execution mode */
    ADM_adhoc_mode_t c_mode;
@@ -364,6 +368,35 @@ ADM_storage_destroy(ADM_storage_t storage) {
    return ret;
}

ADM_storage_resources_t
ADM_storage_resources_create() {

    struct adm_storage_resources* adm_storage_resources =
            (struct adm_storage_resources*) malloc(
                    sizeof(*adm_storage_resources));

    if(!adm_storage_resources) {
        LOGGER_ERROR("Could not allocate ADM_storage_resources_t");
        return NULL;
    }

    return adm_storage_resources;
}

ADM_return_t
ADM_storage_resources_destroy(ADM_storage_resources_t res) {

    ADM_return_t ret = ADM_SUCCESS;

    if(!res) {
        LOGGER_ERROR("Invalid ADM_storage_resources_t")
        return ADM_EBADARGS;
    }

    free(res);
    return ret;
}

ADM_adhoc_context_t
ADM_adhoc_context_create(ADM_adhoc_mode_t exec_mode,
                         ADM_adhoc_access_t access_type, uint32_t nodes,