From e3b8f3d2f9ea5f1b3ea68c4d5ba862680f7851fa Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Tue, 12 Dec 2023 11:28:57 +0100 Subject: client: stub to parse size field in /image/create response from client Still incomplete, src/schema.c needs to be update to add a new field to the 'imagenes' table in the database. --- src/client.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/client.c b/src/client.c index 67c6a2e..f2eb865 100644 --- a/src/client.c +++ b/src/client.c @@ -499,7 +499,8 @@ static int og_resp_refresh(json_t *data, struct og_client *cli) static int update_image_info(struct og_dbi *dbi, const char *image_id, const char *clonator, const char *compressor, - const char *filesystem, const uint64_t datasize) + const char *filesystem, const uint64_t datasize, + uint64_t size) { const char *msglog; dbi_result result; @@ -527,6 +528,7 @@ static int og_resp_image_create(json_t *data, struct og_client *cli) struct og_software_legacy soft_legacy; struct og_image_legacy img_legacy; struct og_computer computer = {}; + uint64_t datasize = 0, size = 0; const char *compressor = NULL; const char *filesystem = NULL; const char *partition = NULL; @@ -537,7 +539,6 @@ static int og_resp_image_create(json_t *data, struct og_client *cli) const char *code = NULL; const char *name = NULL; const char *repo = NULL; - uint64_t datasize = 0; struct og_dbi *dbi; const char *key; json_t *value; @@ -570,6 +571,8 @@ static int og_resp_image_create(json_t *data, struct og_client *cli) err = og_json_parse_string(value, &filesystem); else if (!strcmp(key, "datasize")) err = og_json_parse_uint64(value, &datasize); + else if (!strcmp(key, "size")) + err = og_json_parse_uint64(value, &size); if (err < 0) return err; @@ -633,7 +636,7 @@ static int og_resp_image_create(json_t *data, struct og_client *cli) } res = update_image_info(dbi, image_id, clonator, compressor, - filesystem, datasize); + filesystem, datasize, size); og_dbi_close(dbi); if (res) { -- cgit v1.2.3-18-g5258