/* lmt_ost_v1: single ost (no oss info) */ void lmt_db_insert_ost_v1 (char *s) { lmt_db_t db; char *ossname = NULL, *ostname = NULL; uint64_t read_bytes, write_bytes; uint64_t kbytes_free, kbytes_total; uint64_t inodes_free, inodes_total; if (_init_db_ifneeded () < 0) goto done; if (lmt_ost_decode_v1 (s, &ossname, &ostname, &read_bytes, &write_bytes, &kbytes_free, &kbytes_total, &inodes_free, &inodes_total) < 0) { goto done; } if (!(db = _svc_to_db (ostname))) goto done; if (lmt_db_insert_ost_data (db, ossname, ostname, read_bytes, write_bytes, kbytes_free, kbytes_total - kbytes_free, inodes_free, inodes_total - inodes_free) < 0) { _trigger_db_reconnect (); goto done; } done: if (ostname) free (ostname); if (ossname) free (ossname); }
int _parse_ost_v1 (const char *s) { int retval = -1; char *ossname = NULL; char *name = NULL; uint64_t read_bytes, write_bytes; uint64_t kbytes_free, kbytes_total; uint64_t inodes_free, inodes_total; if (lmt_ost_decode_v1 (s, &ossname, &name, &read_bytes, &write_bytes, &kbytes_free, &kbytes_total, &inodes_free, &inodes_total) < 0) goto done; retval = 0; done: if (name) free (name); if (ossname) free (ossname); return retval; }