btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / src / add-ons / kernel / file_systems / bfs / bfs_disk_system.cpp
blob496e2b597a9924563048864270d78f8940c91eb6
1 /*
2 * Copyright 2007-2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
6 #include "bfs_disk_system.h"
8 #include "bfs.h"
9 #include "Volume.h"
12 status_t
13 parse_initialize_parameters(const char* parameterString,
14 initialize_parameters& parameters)
16 parameters.flags = 0;
17 parameters.verbose = false;
19 void *handle = parse_driver_settings_string(parameterString);
20 if (handle == NULL)
21 return B_ERROR;
23 if (get_driver_boolean_parameter(handle, "noindex", false, true))
24 parameters.flags |= VOLUME_NO_INDICES;
25 if (get_driver_boolean_parameter(handle, "verbose", false, true))
26 parameters.verbose = true;
28 const char *string = get_driver_parameter(handle, "block_size",
29 NULL, NULL);
30 uint32 blockSize = 2048;
31 if (string != NULL)
32 blockSize = strtoul(string, NULL, 0);
34 delete_driver_settings(handle);
36 if (blockSize != 1024 && blockSize != 2048 && blockSize != 4096
37 && blockSize != 8192) {
38 return B_BAD_VALUE;
41 parameters.blockSize = blockSize;
43 return B_OK;
47 status_t
48 check_volume_name(const char* name)
50 if (name == NULL || strlen(name) >= BFS_DISK_NAME_LENGTH
51 || strchr(name, '/') != NULL) {
52 return B_BAD_VALUE;
55 return B_OK;