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

Merge branch...

Merge branch 'amiranda/106-adm_adhoc_resources_t-should-be-an-explicit-argument-of-adm_register_adhoc_storage-rather-than' into 'main'

Resolve "`ADM_adhoc_resources_t` should be an explicit argument of `ADM_register_adhoc_storage()` rather than a parameter of `adhoc_ctx`"

This MR modifies the API calls `ADM_register_adhoc_storage()` so that
the storage resources required for the adhoc instance are passed as 
an explicit argument rather than as part of the adhoc's execution 
context.

Following this line, it also modifies `ADM_update_adhoc_storage()` in 
so that the adhoc resources can be modified dynamically, rather than
the execution context which is left as a static property.

Closes #106

See merge request !84
parents 0a272ea1 1b55c623
Loading
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -64,15 +64,15 @@ main(int argc, char* argv[]) {
    assert(adhoc_resources);

    ADM_adhoc_context_t ctx = ADM_adhoc_context_create(
            ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, adhoc_resources,
            100, false);
            ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 100, false);
    assert(ctx);

    const char* name = "adhoc_storage_42";

    ADM_adhoc_storage_t adhoc_storage;
    ADM_return_t ret = ADM_register_adhoc_storage(
            server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage);
    ADM_return_t ret =
            ADM_register_adhoc_storage(server, name, ADM_ADHOC_STORAGE_GEKKOFS,
                                       ctx, adhoc_resources, &adhoc_storage);

    if(ret != ADM_SUCCESS) {
        fprintf(stderr,
+4 −4
Original line number Diff line number Diff line
@@ -60,15 +60,15 @@ main(int argc, char* argv[]) {
    assert(adhoc_resources);

    ADM_adhoc_context_t ctx = ADM_adhoc_context_create(
            ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, adhoc_resources,
            100, false);
            ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 100, false);
    assert(ctx);

    const char* name = "adhoc_storage_42";

    ADM_adhoc_storage_t adhoc_storage;
    ADM_return_t ret = ADM_register_adhoc_storage(
            server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage);
    ADM_return_t ret =
            ADM_register_adhoc_storage(server, name, ADM_ADHOC_STORAGE_GEKKOFS,
                                       ctx, adhoc_resources, &adhoc_storage);

    if(ret != ADM_SUCCESS) {
        fprintf(stderr,
+4 −4
Original line number Diff line number Diff line
@@ -65,15 +65,15 @@ main(int argc, char* argv[]) {
    assert(adhoc_resources);

    ADM_adhoc_context_t ctx = ADM_adhoc_context_create(
            ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, adhoc_resources,
            100, false);
            ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 100, false);
    assert(ctx);

    const char* name = "adhoc_storage_42";

    ADM_adhoc_storage_t adhoc_storage;
    ADM_return_t ret = ADM_register_adhoc_storage(
            server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage);
    ADM_return_t ret =
            ADM_register_adhoc_storage(server, name, ADM_ADHOC_STORAGE_GEKKOFS,
                                       ctx, adhoc_resources, &adhoc_storage);

    if(ret != ADM_SUCCESS) {
        fprintf(stderr,
+5 −7
Original line number Diff line number Diff line
@@ -77,8 +77,7 @@ main(int argc, char* argv[]) {

    // 3. the adhoc storage execution context
    adhoc_ctx = ADM_adhoc_context_create(ADM_ADHOC_MODE_SEPARATE_NEW,
                                         ADM_ADHOC_ACCESS_RDWR, adhoc_resources,
                                         100, false);
                                         ADM_ADHOC_ACCESS_RDWR, 100, false);

    if(adhoc_ctx == NULL) {
        fprintf(stderr, "Fatal error preparing adhoc context\n");
@@ -96,9 +95,9 @@ main(int argc, char* argv[]) {
    }

    // 2. Register the adhoc storage
    if(ADM_register_adhoc_storage(server, adhoc_name,
                                  ADM_ADHOC_STORAGE_DATACLAY, adhoc_ctx,
                                  &adhoc_storage) != ADM_SUCCESS) {
    if(ADM_register_adhoc_storage(
               server, adhoc_name, ADM_ADHOC_STORAGE_DATACLAY, adhoc_ctx,
               adhoc_resources, &adhoc_storage) != ADM_SUCCESS) {
        fprintf(stderr, "ADM_register_adhoc_storage() failed: %s\n",
                ADM_strerror(ret));
        goto cleanup;
@@ -110,8 +109,7 @@ main(int argc, char* argv[]) {
    // storage system

    new_adhoc_ctx = ADM_adhoc_context_create(ADM_ADHOC_MODE_SEPARATE_NEW,
                                             ADM_ADHOC_ACCESS_RDWR,
                                             adhoc_resources, 200, false);
                                             ADM_ADHOC_ACCESS_RDWR, 200, false);

    if(new_adhoc_ctx == NULL) {
        fprintf(stderr, "Fatal error preparing new adhoc context\n");
+4 −4
Original line number Diff line number Diff line
@@ -61,15 +61,15 @@ main(int argc, char* argv[]) {
    assert(adhoc_resources);

    ADM_adhoc_context_t ctx = ADM_adhoc_context_create(
            ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, adhoc_resources,
            100, false);
            ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 100, false);
    assert(ctx);

    const char* name = "adhoc_storage_42";

    ADM_adhoc_storage_t adhoc_storage;
    ADM_return_t ret = ADM_register_adhoc_storage(
            server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage);
    ADM_return_t ret =
            ADM_register_adhoc_storage(server, name, ADM_ADHOC_STORAGE_GEKKOFS,
                                       ctx, adhoc_resources, &adhoc_storage);

    if(ret != ADM_SUCCESS) {
        fprintf(stderr,
Loading