diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-03-19 12:51:44 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-03-19 15:47:44 -0400 |
commit | 846f3398a27cff78c48e37c7a1ba1bccccff6287 (patch) | |
tree | ca038b1762701b2839689f903cae918074a7fc24 /c_src/libbcachefs.h | |
parent | e6aecdd3b8a00d9718fc1ef30ab6a5dbdb5a53dc (diff) |
More device option work
More work to regularize device options, with common command line
parsing - like other options.
This fixes an assortment of little nits: buggyness with the discard
option, device state (and others) can now be specied at device add time,
and is a decent cleanup.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'c_src/libbcachefs.h')
-rw-r--r-- | c_src/libbcachefs.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/c_src/libbcachefs.h b/c_src/libbcachefs.h index 026a3def..05ba1069 100644 --- a/c_src/libbcachefs.h +++ b/c_src/libbcachefs.h @@ -28,6 +28,9 @@ struct { }; void bch2_opt_strs_free(struct bch_opt_strs *); + +const struct bch_option *bch2_cmdline_opt_parse(int argc, char *argv[], + unsigned opt_types); struct bch_opt_strs bch2_cmdline_opts_get(int *, char *[], unsigned); struct bch_opts bch2_parse_opts(struct bch_opt_strs); void bch2_opts_usage(unsigned); @@ -58,25 +61,20 @@ struct dev_opts { struct file *file; struct block_device *bdev; char *path; - u64 size; /* bytes*/ - u64 bucket_size; /* bytes */ - const char *label; - unsigned data_allowed; - unsigned durability; - bool discard; - - u64 nbuckets; u64 sb_offset; u64 sb_end; + + u64 nbuckets; + + const char *label; /* make this a bch_opt */ + + struct bch_opts opts; }; static inline struct dev_opts dev_opts_default() { - return (struct dev_opts) { - .data_allowed = ~0U << 2, - .durability = 1, - }; + return (struct dev_opts) { .opts = bch2_opts_empty() }; } void bch2_sb_layout_init(struct bch_sb_layout *, |