summaryrefslogtreecommitdiffstats
path: root/src/rest.c
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2020-11-26 15:48:38 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-11-27 12:52:21 +0100
commit0dd3edd27c78b903e4a667a0d18d8092cd653982 (patch)
treebeb239bdac5a7e7f0db68eca0ab5683500035a21 /src/rest.c
parent24e6fbf1dee7ff21913a4bef8ae0ae4ed2245fc8 (diff)
#1008 Add support to work with GPT tables
ogServer /setup do not support to indicate which table type the user want to use. It always supposes that the partition table is MBR/MSDOS. Add ogServer support to work with GPT tables. Add new field table type to /setup that expects a string with "MSDOS" or "GPT". Example old JSON: { "clients": [...], "disk": "1", "cache": "0", "cache_size": "0", "partition_setup": [...] } Example new JSON: { "clients": [...], "type": "GPT", "disk": "1", "cache": "0", "cache_size": "0", "partition_setup": [...] }
Diffstat (limited to 'src/rest.c')
-rw-r--r--src/rest.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rest.c b/src/rest.c
index 5045dc6..ae4c44d 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -2075,6 +2075,9 @@ static int og_cmd_setup(json_t *element, struct og_msg_params *params)
json_object_foreach(element, key, value) {
if (!strcmp(key, "clients")) {
err = og_json_parse_clients(value, params);
+ } else if (!strcmp(key, "type")) {
+ err = og_json_parse_string(value, &params->type);
+ params->flags |= OG_REST_PARAM_TYPE;
} else if (!strcmp(key, "disk")) {
err = og_json_parse_string(value, &params->disk);
params->flags |= OG_REST_PARAM_DISK;
@@ -2093,6 +2096,7 @@ static int og_cmd_setup(json_t *element, struct og_msg_params *params)
}
if (!og_msg_params_validate(params, OG_REST_PARAM_ADDR |
+ OG_REST_PARAM_TYPE |
OG_REST_PARAM_DISK |
OG_REST_PARAM_CACHE |
OG_REST_PARAM_CACHE_SIZE |