Changeset 150adbd2 in mainline for uspace/app


Ignore:
Timestamp:
2025-06-29T10:08:40Z (4 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
40ab4901
Parents:
93ea452
Message:

hr: add NOOP metadata type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/hrctl/hrctl.c

    r93ea452 r150adbd2  
    5252static errno_t fill_config_devs(int, char **, hr_config_t *);
    5353static errno_t get_vol_configs_from_sif(const char *, hr_config_t **, size_t *);
    54 static int create_from_config(hr_t *, const char *);
    55 static int create_from_argv(hr_t *, int, char **);
     54static int create_from_config(hr_t *, const char *, uint8_t);
     55static int create_from_argv(hr_t *, int, char **, uint8_t);
    5656static int handle_create(hr_t *, int, char **);
    5757static int assemble_from_config(hr_t *, const char *);
     
    7070    "  -h, --help                                Display this message and exit.\n"
    7171    "\n"
    72     "  -c, --create                              Create a volume, options:\n"
     72    "  -c, --create [--no_meta]                  Create a volume, options:\n"
    7373    "      name {-l , --level level} device...   manual device specification, or\n"
    7474    "      -f configuration.sif                  create from configuration file.\n"
     
    108108    "\n"
    109109    "Notes:\n"
     110    "  Add --no_meta after --create to disable storing on-disk metadata.\n"
    110111    "  Simulating an extent failure with -m volume -f index is dangerous. It marks\n"
    111112    "  metadata as dirty in other healthy extents, and zeroes out the superblock\n"
     
    341342}
    342343
    343 static int create_from_config(hr_t *hr, const char *config_path)
     344static int create_from_config(hr_t *hr, const char *config_path,
     345    uint8_t vol_flags)
    344346{
    345347        hr_config_t *vol_configs = NULL;
     
    351353                return EXIT_FAILURE;
    352354        }
     355
     356        for (size_t i = 0; i < vol_count; i++)
     357                vol_configs[i].vol_flags |= vol_flags;
    353358
    354359        for (size_t i = 0; i < vol_count; i++) {
     
    368373}
    369374
    370 static int create_from_argv(hr_t *hr, int argc, char **argv)
     375static int create_from_argv(hr_t *hr, int argc, char **argv, uint8_t vol_flags)
    371376{
    372377        /* we need name + --level + arg + at least one extent */
     
    381386                return EXIT_FAILURE;
    382387        }
     388
     389        vol_config->vol_flags |= vol_flags;
    383390
    384391        const char *name = argv[optind++];
     
    441448{
    442449        int rc;
     450        uint8_t vol_flags = 0;
    443451
    444452        if (optind >= argc) {
    445453                printf(NAME ": no arguments to --create\n");
    446454                return EXIT_FAILURE;
     455        }
     456
     457        if (str_cmp(argv[optind], "--no_meta") == 0) {
     458                vol_flags |= HR_VOL_FLAG_NOOP_META;
     459                optind++;
    447460        }
    448461
     
    461474                }
    462475
    463                 rc = create_from_config(hr, config_path);
     476                rc = create_from_config(hr, config_path, vol_flags);
    464477        } else {
    465                 rc = create_from_argv(hr, argc, argv);
     478                rc = create_from_argv(hr, argc, argv, vol_flags);
    466479        }
    467480
Note: See TracChangeset for help on using the changeset viewer.