mirror of https://git.48k.eu/ogserver
#1008 Restore support for 4 disks and 16 partitions
ogServer expects to receive information of 1 disk and 4 partitions from ogClient. Previous ogServer versions support several disks and partitions. Add ogServer support for 4 disks and 16 partitions.master
parent
727f31a88b
commit
24e6fbf1de
30
src/client.c
30
src/client.c
|
@ -284,10 +284,10 @@ static int og_dbi_queue_autorun(uint32_t computer_id, uint32_t proc_id)
|
|||
static int og_resp_refresh(json_t *data, struct og_client *cli)
|
||||
{
|
||||
struct og_partition partitions[OG_PARTITION_MAX] = {};
|
||||
struct og_partition disks[OG_DISK_MAX] = {};
|
||||
const char *serial_number = NULL;
|
||||
struct og_computer computer = {};
|
||||
struct og_partition disk_setup;
|
||||
char cfg[1024] = {};
|
||||
char cfg[4096] = {};
|
||||
struct og_dbi *dbi;
|
||||
const char *key;
|
||||
unsigned int i;
|
||||
|
@ -300,9 +300,7 @@ static int og_resp_refresh(json_t *data, struct og_client *cli)
|
|||
|
||||
json_object_foreach(data, key, value) {
|
||||
if (!strcmp(key, "disk_setup")) {
|
||||
err = og_json_parse_partition(value,
|
||||
&disk_setup,
|
||||
OG_PARAMS_RESP_REFRESH);
|
||||
err = og_json_parse_partition_array(value, disks);
|
||||
} else if (!strcmp(key, "partition_setup")) {
|
||||
err = og_json_parse_partition_array(value, partitions);
|
||||
} else if (!strcmp(key, "serial_number")) {
|
||||
|
@ -318,16 +316,20 @@ static int og_resp_refresh(json_t *data, struct og_client *cli)
|
|||
if (strlen(serial_number) > 0)
|
||||
snprintf(cfg, sizeof(cfg), "ser=%s\n", serial_number);
|
||||
|
||||
if (!disk_setup.disk || !disk_setup.number || !disk_setup.code ||
|
||||
!disk_setup.filesystem || !disk_setup.os || !disk_setup.size ||
|
||||
!disk_setup.used_size)
|
||||
return -1;
|
||||
for (i = 0; i < OG_DISK_MAX; i++) {
|
||||
if (!disks[i].disk || !disks[i].number ||
|
||||
!disks[i].code || !disks[i].filesystem ||
|
||||
!disks[i].os || !disks[i].size ||
|
||||
!disks[i].used_size)
|
||||
continue;
|
||||
|
||||
snprintf(cfg + strlen(cfg), sizeof(cfg) - strlen(cfg),
|
||||
"disk=%s\tpar=%s\tcpt=%s\tfsi=%s\tsoi=%s\ttam=%s\tuso=%s\n",
|
||||
disk_setup.disk, disk_setup.number, disk_setup.code,
|
||||
disk_setup.filesystem, disk_setup.os, disk_setup.size,
|
||||
disk_setup.used_size);
|
||||
snprintf(cfg + strlen(cfg), sizeof(cfg) - strlen(cfg),
|
||||
"disk=%s\tpar=%s\tcpt=%s\tfsi=%s\tsoi=%s\ttam=%s\tuso=%s\n",
|
||||
disks[i].disk, disks[i].number,
|
||||
disks[i].code, disks[i].filesystem,
|
||||
disks[i].os, disks[i].size,
|
||||
disks[i].used_size);
|
||||
}
|
||||
|
||||
for (i = 0; i < OG_PARTITION_MAX; i++) {
|
||||
if (!partitions[i].disk || !partitions[i].number ||
|
||||
|
|
|
@ -30,7 +30,8 @@ struct og_partition {
|
|||
const char *used_size;
|
||||
};
|
||||
|
||||
#define OG_PARTITION_MAX 4
|
||||
#define OG_DISK_MAX 4
|
||||
#define OG_PARTITION_MAX (4 * OG_DISK_MAX)
|
||||
|
||||
int og_json_parse_partition(json_t *element, struct og_partition *part,
|
||||
uint64_t required_flags);
|
||||
|
|
Loading…
Reference in New Issue