From 40cc867d900f362c8513bbe38b8ac7b83c4ebe9c Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Wed, 1 Oct 2025 20:19:56 +0900 Subject: [PATCH 1/7] util: add table_init_with_columns() function This combined table_init() and table_add_columns() functions. Signed-off-by: Tokunori Ikegami --- util/table.c | 20 ++++++++++++++++++-- util/table.h | 12 ++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/util/table.c b/util/table.c index 88062699df..7374141134 100644 --- a/util/table.c +++ b/util/table.c @@ -211,16 +211,32 @@ void table_add_row(struct table *t, int row_id) struct table *table_init(void) { - struct table *t; + struct table *t = malloc(sizeof(struct table)); - t = malloc(sizeof(struct table)); if (!t) return NULL; memset(t, 0, sizeof(struct table)); + return t; } +struct table *table_init_with_columns(struct table_column *c, int num_columns) +{ + struct table *t = table_init(); + + if (!t) + return NULL; + + if (table_add_columns(t, c, num_columns)) { + table_free(t); + return NULL; + } + + return t; + +} + static int table_add_column(struct table *t, struct table_column *c) { struct table_column *new_columns; diff --git a/util/table.h b/util/table.h index 1c98c990de..aca03ca324 100644 --- a/util/table.h +++ b/util/table.h @@ -146,4 +146,16 @@ void table_add_row(struct table *t, int row); void table_print(struct table *t); void table_free(struct table *t); +/** + * table_init_with_columns() - Allocate a table instance with column definitions + * @c: Column definitions + * @num_columns:Number of columns + * + * This is a function combined table_init() and table_add_columns(). + * + * Return: The table instance, or NULL if unsuccessful. If allocated, the caller + * is responsible to free the table. + */ +struct table *table_init_with_columns(struct table_column *c, int num_columns); + #endif /* _TABLE_H_ */ From 3970e9681204662b4451e128cac3a7b466818146 Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Wed, 1 Oct 2025 20:22:35 +0900 Subject: [PATCH 2/7] util: allow table_add_columns() to set column width The value auto populated but change it for the existing tables. Signed-off-by: Tokunori Ikegami --- util/table.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/table.c b/util/table.c index 7374141134..3cf4f8f8f8 100644 --- a/util/table.c +++ b/util/table.c @@ -294,7 +294,10 @@ int table_add_columns(struct table *t, struct table_column *c, int num_columns) goto free_col; t->columns[col].align = c[col].align; - t->columns[col].width = strlen(t->columns[col].name); + if (c[col].width > strlen(t->columns[col].name)) + t->columns[col].width = c[col].width; + else + t->columns[col].width = strlen(t->columns[col].name); } t->num_columns = num_columns; From ffe640a40800326ea33263ca04a6cdb2d705e469 Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Wed, 1 Oct 2025 20:26:18 +0900 Subject: [PATCH 3/7] util: remove unnecessary row end padding print A space added between each columns but not necessary for end of line. Signed-off-by: Tokunori Ikegami --- util/table.c | 60 +++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/util/table.c b/util/table.c index 3cf4f8f8f8..844862f78e 100644 --- a/util/table.c +++ b/util/table.c @@ -41,22 +41,22 @@ static int table_get_value_width(struct value *v) return len; } -static void table_print_centered(struct value *val, int width, enum fmt_type type) +static void table_print_centered(struct value *val, int width, enum fmt_type type, bool add_pad) { int i, len, left_pad, right_pad; char buf[64]; - if (type == FMT_STRING) + if (type == FMT_STRING) { len = strlen(val->s); - else if (type == FMT_INT) + } else if (type == FMT_INT) { len = snprintf(buf, sizeof(buf), "%d", val->i); - else if (type == FMT_UNSIGNED) + } else if (type == FMT_UNSIGNED) { len = snprintf(buf, sizeof(buf), "%u", val->u); - else if (type == FMT_LONG) + } else if (type == FMT_LONG) { len = snprintf(buf, sizeof(buf), "%ld", val->ld); - else if (type == FMT_UNSIGNED_LONG) + } else if (type == FMT_UNSIGNED_LONG) { len = snprintf(buf, sizeof(buf), "%lu", val->lu); - else { + } else { fprintf(stderr, "Invalid format!\n"); return; } @@ -70,15 +70,15 @@ static void table_print_centered(struct value *val, int width, enum fmt_type typ /* print value */ if (type == FMT_STRING) - printf("%s ", val->s); + printf("%s%s", val->s, add_pad ? "" : " "); else if (type == FMT_INT) - printf("%d ", val->i); + printf("%d%s", val->i, add_pad ? "" : " "); else if (type == FMT_UNSIGNED) - printf("%u ", val->u); + printf("%u%s", val->u, add_pad ? "" : " "); else if (type == FMT_LONG) - printf("%ld ", val->ld); + printf("%ld%s", val->ld, add_pad ? "" : " "); else if (type == FMT_UNSIGNED_LONG) - printf("%lu", val->lu); + printf("%lu%s", val->lu, add_pad ? "" : " "); /* add right padding */ for (i = 0; i < right_pad; i++) @@ -90,8 +90,10 @@ static void table_print_columns(const struct table *t) int col, j, width; struct table_column *c; struct value v; + bool last_col; for (col = 0; col < t->num_columns; col++) { + last_col = col == t->num_columns - 1 ? true : false; c = &t->columns[col]; width = c->width; if (c->align == LEFT) @@ -100,17 +102,20 @@ static void table_print_columns(const struct table *t) if (c->align == CENTERED) { v.s = c->name; v.align = c->align; - table_print_centered(&v, width, FMT_STRING); - } else - printf("%*s ", width, c->name); + table_print_centered(&v, width, FMT_STRING, !last_col); + } else { + printf("%*s%s", width, c->name, last_col ? "" : " "); + } } printf("\n"); for (col = 0; col < t->num_columns; col++) { + last_col = col == t->num_columns - 1 ? true : false; for (j = 0; j < t->columns[col].width; j++) putchar('-'); - printf(" "); + if (!last_col) + printf(" "); } printf("\n"); @@ -123,9 +128,11 @@ static void table_print_rows(const struct table *t) struct table_row *r; int width; struct value *v; + bool last_col; for (row = 0; row < t->num_rows; row++) { for (col = 0; col < t->num_columns; col++) { + last_col = col == t->num_columns - 1 ? true : false; c = &t->columns[col]; r = &t->rows[row]; v = &r->val[col]; @@ -134,30 +141,25 @@ static void table_print_rows(const struct table *t) if (v->align == LEFT) width *= -1; - if (v->align == CENTERED) - table_print_centered(v, width, v->type); - else { + if (v->align == CENTERED) { + table_print_centered(v, width, v->type, !last_col); + } else { switch (v->type) { case FMT_STRING: - printf("%*s ", width, v->s); + printf("%*s%s", width, v->s, last_col ? "" : " "); break; - case FMT_INT: - printf("%*d ", width, v->i); + printf("%*d%s", width, v->i, last_col ? "" : " "); break; - case FMT_UNSIGNED: - printf("%*u ", width, v->u); + printf("%*u%s", width, v->u, last_col ? "" : " "); break; - case FMT_LONG: - printf("%*ld ", width, v->ld); + printf("%*ld%s", width, v->ld, last_col ? "" : " "); break; - case FMT_UNSIGNED_LONG: - printf("%*lu ", width, v->lu); + printf("%*lu%s", width, v->lu, last_col ? "" : " "); break; - default: fprintf(stderr, "Invalid format!\n"); break; From d85e800d52eaa0f30e8b0b9cd25b9807c3946831 Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Wed, 1 Oct 2025 20:13:58 +0900 Subject: [PATCH 4/7] nvme-print-stdout: replace nvme simple list with generic table Use the generic table code added instead of hard coded table. Signed-off-by: Tokunori Ikegami --- nvme-print-stdout.c | 116 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 104 insertions(+), 12 deletions(-) diff --git a/nvme-print-stdout.c b/nvme-print-stdout.c index 8b32eb7af8..9b1328b543 100644 --- a/nvme-print-stdout.c +++ b/nvme-print-stdout.c @@ -24,6 +24,18 @@ #include "logging.h" #include "common.h" +enum simple_list_col { + SIMPLE_LIST_COL_NODE, + SIMPLE_LIST_COL_GENERIC, + SIMPLE_LIST_COL_SN, + SIMPLE_LIST_COL_MODEL, + SIMPLE_LIST_COL_NS, + SIMPLE_LIST_COL_USAGE, + SIMPLE_LIST_COL_FORMAT, + SIMPLE_LIST_COL_FW_REV, + SIMPLE_LIST_COL_NUM, +}; + static const uint8_t zero_uuid[16] = { 0 }; static const uint8_t invalid_uuid[16] = {[0 ... 15] = 0xff }; static const char dash[100] = {[0 ... 99] = '-'}; @@ -104,6 +116,11 @@ struct nvme_resources { struct strset namespaces; }; +struct nvme_resources_table { + struct nvme_resources *res; + struct table *t; +}; + static int nvme_resources_init(nvme_root_t r, struct nvme_resources *res) { nvme_host_t h; @@ -5346,7 +5363,7 @@ static void stdout_generic_full_path(nvme_ns_t n, char *path, size_t len) snprintf(path, len, "ng%dn%d", instance, head_instance); } -static void stdout_list_item(nvme_ns_t n) +static void list_item(nvme_ns_t n, struct table *t) { char usage[128] = { 0 }, format[128] = { 0 }; char devname[128] = { 0 }; char genname[128] = { 0 }; @@ -5358,6 +5375,8 @@ static void stdout_list_item(nvme_ns_t n) const char *s_suffix = suffix_si_get(&nsze); const char *u_suffix = suffix_si_get(&nuse); const char *l_suffix = suffix_binary_get(&lba); + char ns[STR_LEN]; + int row; snprintf(usage, sizeof(usage), "%6.2f %2sB / %6.2f %2sB", nuse, u_suffix, nsze, s_suffix); @@ -5367,19 +5386,76 @@ static void stdout_list_item(nvme_ns_t n) stdout_dev_full_path(n, devname, sizeof(devname)); stdout_generic_full_path(n, genname, sizeof(genname)); - printf("%-21s %-21s %-20s %-40s %#-10x %-26s %-16s %-8s\n", - devname, genname, nvme_ns_get_serial(n), - nvme_ns_get_model(n), nvme_ns_get_nsid(n), usage, format, - nvme_ns_get_firmware(n)); + if (!t) { + printf("%-21s %-21s %-20s %-40s %#-10x %-26s %-16s %-8s\n", + devname, genname, nvme_ns_get_serial(n), + nvme_ns_get_model(n), nvme_ns_get_nsid(n), usage, format, + nvme_ns_get_firmware(n)); + return; + } + + row = table_get_row_id(t); + if (row < 0) { + printf("Failed to add row\n"); + return; + } + if (table_set_value_str(t, SIMPLE_LIST_COL_NODE, row, devname, LEFT)) { + printf("Failed to set node value\n"); + return; + } + if (table_set_value_str(t, SIMPLE_LIST_COL_GENERIC, row, genname, LEFT)) { + printf("Failed to set generic value\n"); + return; + } + if (table_set_value_str(t, SIMPLE_LIST_COL_SN, row, nvme_ns_get_serial(n), LEFT)) { + printf("Failed to set sn value\n"); + return; + } + if (table_set_value_str(t, SIMPLE_LIST_COL_MODEL, row, nvme_ns_get_model(n), LEFT)) { + printf("Failed to set model value\n"); + return; + } + if (!sprintf(ns, "0x%x", nvme_ns_get_nsid(n))) { + printf("Failed to output ns string\n"); + return; + } + if (table_set_value_str(t, SIMPLE_LIST_COL_NS, row, ns, LEFT)) { + printf("Failed to set ns value\n"); + return; + } + if (table_set_value_str(t, SIMPLE_LIST_COL_USAGE, row, usage, LEFT)) { + printf("Failed to set usage value\n"); + return; + } + if (table_set_value_str(t, SIMPLE_LIST_COL_FORMAT, row, format, LEFT)) { + printf("Failed to set format value\n"); + return; + } + if (table_set_value_str(t, SIMPLE_LIST_COL_FW_REV, row, nvme_ns_get_firmware(n), LEFT)) { + printf("Failed to set fw rev value\n"); + return; + } + table_add_row(t, row); +} + +static void stdout_list_item(nvme_ns_t n) +{ + list_item(n, NULL); +} + +static void stdout_list_item_table(nvme_ns_t n, struct table *t) +{ + list_item(n, t); } static bool stdout_simple_ns(const char *name, void *arg) { - struct nvme_resources *res = arg; + struct nvme_resources_table *rst_t = arg; + struct nvme_resources *res = rst_t->res; nvme_ns_t n; n = htable_ns_get(&res->ht_n, name); - stdout_list_item(n); + stdout_list_item_table(n, rst_t->t); return true; } @@ -5387,16 +5463,32 @@ static bool stdout_simple_ns(const char *name, void *arg) static void stdout_simple_list(nvme_root_t r) { struct nvme_resources res; + struct table_column columns[SIMPLE_LIST_COL_NUM] = { + { "Node", LEFT, 21 }, + { "Generic", LEFT, 21 }, + { "SN", LEFT, 20 }, + { "Model", LEFT, 40 }, + { "Namespace", LEFT, 10 }, + { "Usage", LEFT, 26 }, + { "Format", LEFT, 16 }, + { "FW Rev", LEFT, 8 }, + }; + struct table *t = table_init_with_columns(columns, ARRAY_SIZE(columns)); + struct nvme_resources_table res_t = { &res, t }; + + if (!t) { + printf("Failed to init table\n"); + return; + } nvme_resources_init(r, &res); - printf("%-21s %-21s %-20s %-40s %-10s %-26s %-16s %-8s\n", - "Node", "Generic", "SN", "Model", "Namespace", "Usage", "Format", "FW Rev"); - printf("%-.21s %-.21s %-.20s %-.40s %-.10s %-.26s %-.16s %-.8s\n", - dash, dash, dash, dash, dash, dash, dash, dash); - strset_iterate(&res.namespaces, stdout_simple_ns, &res); + strset_iterate(&res.namespaces, stdout_simple_ns, &res_t); + + table_print(t); nvme_resources_free(&res); + table_free(t); } static void stdout_ns_details(nvme_ns_t n) From 443c9aef2ac802238ab1e2c7bce819e4d26d026a Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Wed, 1 Oct 2025 20:43:23 +0900 Subject: [PATCH 5/7] util: use switch case statements instead of repeated else if This changes as same with other switch case statements. Signed-off-by: Tokunori Ikegami --- util/table.c | 63 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/util/table.c b/util/table.c index 844862f78e..df79607004 100644 --- a/util/table.c +++ b/util/table.c @@ -46,17 +46,23 @@ static void table_print_centered(struct value *val, int width, enum fmt_type typ int i, len, left_pad, right_pad; char buf[64]; - if (type == FMT_STRING) { + switch (type) { + case FMT_STRING: len = strlen(val->s); - } else if (type == FMT_INT) { + break; + case FMT_INT: len = snprintf(buf, sizeof(buf), "%d", val->i); - } else if (type == FMT_UNSIGNED) { + break; + case FMT_UNSIGNED: len = snprintf(buf, sizeof(buf), "%u", val->u); - } else if (type == FMT_LONG) { + break; + case FMT_LONG: len = snprintf(buf, sizeof(buf), "%ld", val->ld); - } else if (type == FMT_UNSIGNED_LONG) { + break; + case FMT_UNSIGNED_LONG: len = snprintf(buf, sizeof(buf), "%lu", val->lu); - } else { + break; + default: fprintf(stderr, "Invalid format!\n"); return; } @@ -69,16 +75,25 @@ static void table_print_centered(struct value *val, int width, enum fmt_type typ putchar(' '); /* print value */ - if (type == FMT_STRING) + switch (type) { + case FMT_STRING: printf("%s%s", val->s, add_pad ? "" : " "); - else if (type == FMT_INT) + break; + case FMT_INT: printf("%d%s", val->i, add_pad ? "" : " "); - else if (type == FMT_UNSIGNED) + break; + case FMT_UNSIGNED: printf("%u%s", val->u, add_pad ? "" : " "); - else if (type == FMT_LONG) + break; + case FMT_LONG: printf("%ld%s", val->ld, add_pad ? "" : " "); - else if (type == FMT_UNSIGNED_LONG) + break; + case FMT_UNSIGNED_LONG: printf("%lu%s", val->lu, add_pad ? "" : " "); + break; + default: + break; + } /* add right padding */ for (i = 0; i < right_pad; i++) @@ -96,15 +111,18 @@ static void table_print_columns(const struct table *t) last_col = col == t->num_columns - 1 ? true : false; c = &t->columns[col]; width = c->width; - if (c->align == LEFT) - width *= -1; - - if (c->align == CENTERED) { + switch (c->align) { + case CENTERED: v.s = c->name; v.align = c->align; table_print_centered(&v, width, FMT_STRING, !last_col); - } else { + break; + case LEFT: + width *= -1; + fallthrough; + default: printf("%*s%s", width, c->name, last_col ? "" : " "); + break; } } @@ -138,12 +156,14 @@ static void table_print_rows(const struct table *t) v = &r->val[col]; width = c->width; - if (v->align == LEFT) - width *= -1; - - if (v->align == CENTERED) { + switch (v->align) { + case CENTERED: table_print_centered(v, width, v->type, !last_col); - } else { + break; + case LEFT: + width *= -1; + fallthrough; + default: switch (v->type) { case FMT_STRING: printf("%*s%s", width, v->s, last_col ? "" : " "); @@ -164,6 +184,7 @@ static void table_print_rows(const struct table *t) fprintf(stderr, "Invalid format!\n"); break; } + break; } } printf("\n"); From 68bfb16d5bd8a23e5d4bf0d2fc835ff0fe87700b Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Wed, 8 Oct 2025 00:52:54 +0900 Subject: [PATCH 6/7] util: move to add final padding printf between each columns Delete the padding flag by padding in the caller functions. Signed-off-by: Tokunori Ikegami --- util/table.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/util/table.c b/util/table.c index df79607004..3c0c92d4ec 100644 --- a/util/table.c +++ b/util/table.c @@ -41,7 +41,7 @@ static int table_get_value_width(struct value *v) return len; } -static void table_print_centered(struct value *val, int width, enum fmt_type type, bool add_pad) +static void table_print_centered(struct value *val, int width, enum fmt_type type) { int i, len, left_pad, right_pad; char buf[64]; @@ -77,19 +77,19 @@ static void table_print_centered(struct value *val, int width, enum fmt_type typ /* print value */ switch (type) { case FMT_STRING: - printf("%s%s", val->s, add_pad ? "" : " "); + printf("%s", val->s); break; case FMT_INT: - printf("%d%s", val->i, add_pad ? "" : " "); + printf("%d", val->i); break; case FMT_UNSIGNED: - printf("%u%s", val->u, add_pad ? "" : " "); + printf("%u", val->u); break; case FMT_LONG: - printf("%ld%s", val->ld, add_pad ? "" : " "); + printf("%ld", val->ld); break; case FMT_UNSIGNED_LONG: - printf("%lu%s", val->lu, add_pad ? "" : " "); + printf("%lu", val->lu); break; default: break; @@ -105,35 +105,34 @@ static void table_print_columns(const struct table *t) int col, j, width; struct table_column *c; struct value v; - bool last_col; for (col = 0; col < t->num_columns; col++) { - last_col = col == t->num_columns - 1 ? true : false; c = &t->columns[col]; width = c->width; switch (c->align) { case CENTERED: v.s = c->name; v.align = c->align; - table_print_centered(&v, width, FMT_STRING, !last_col); + table_print_centered(&v, width, FMT_STRING); break; case LEFT: width *= -1; fallthrough; default: - printf("%*s%s", width, c->name, last_col ? "" : " "); + printf("%*s", width, c->name); break; } + if (col + 1 != t->num_columns) + putchar(' '); } printf("\n"); for (col = 0; col < t->num_columns; col++) { - last_col = col == t->num_columns - 1 ? true : false; for (j = 0; j < t->columns[col].width; j++) putchar('-'); - if (!last_col) - printf(" "); + if (col + 1 != t->num_columns) + putchar(' '); } printf("\n"); @@ -146,11 +145,9 @@ static void table_print_rows(const struct table *t) struct table_row *r; int width; struct value *v; - bool last_col; for (row = 0; row < t->num_rows; row++) { for (col = 0; col < t->num_columns; col++) { - last_col = col == t->num_columns - 1 ? true : false; c = &t->columns[col]; r = &t->rows[row]; v = &r->val[col]; @@ -158,7 +155,7 @@ static void table_print_rows(const struct table *t) width = c->width; switch (v->align) { case CENTERED: - table_print_centered(v, width, v->type, !last_col); + table_print_centered(v, width, v->type); break; case LEFT: width *= -1; @@ -166,19 +163,19 @@ static void table_print_rows(const struct table *t) default: switch (v->type) { case FMT_STRING: - printf("%*s%s", width, v->s, last_col ? "" : " "); + printf("%*s", width, v->s); break; case FMT_INT: - printf("%*d%s", width, v->i, last_col ? "" : " "); + printf("%*d", width, v->i); break; case FMT_UNSIGNED: - printf("%*u%s", width, v->u, last_col ? "" : " "); + printf("%*u", width, v->u); break; case FMT_LONG: - printf("%*ld%s", width, v->ld, last_col ? "" : " "); + printf("%*ld", width, v->ld); break; case FMT_UNSIGNED_LONG: - printf("%*lu%s", width, v->lu, last_col ? "" : " "); + printf("%*lu", width, v->lu); break; default: fprintf(stderr, "Invalid format!\n"); @@ -186,6 +183,8 @@ static void table_print_rows(const struct table *t) } break; } + if (col + 1 != t->num_columns) + putchar(' '); } printf("\n"); } From 747a6e21efb2406df0f6f2f941a4f20716752141 Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Wed, 8 Oct 2025 02:35:09 +0900 Subject: [PATCH 7/7] util: rename table_init() to table_create() Also changed the function to return calloc() instead. Signed-off-by: Tokunori Ikegami --- nvme-print-stdout.c | 4 ++-- util/table.c | 14 +++----------- util/table.h | 4 ++-- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/nvme-print-stdout.c b/nvme-print-stdout.c index 9b1328b543..63bbb2edb2 100644 --- a/nvme-print-stdout.c +++ b/nvme-print-stdout.c @@ -5726,7 +5726,7 @@ static void stdout_tabular_subsystem_topology_multipath(nvme_subsystem_t s) {"State", LEFT, 0}, }; - t = table_init(); + t = table_create(); if (!t) { printf("Failed to init table\n"); return; @@ -5922,7 +5922,7 @@ static void stdout_tabular_subsystem_topology(nvme_subsystem_t s) {"State", LEFT, 0}, }; - t = table_init(); + t = table_create(); if (!t) { printf("Failed to init table\n"); return; diff --git a/util/table.c b/util/table.c index 3c0c92d4ec..76366b93da 100644 --- a/util/table.c +++ b/util/table.c @@ -231,21 +231,14 @@ void table_add_row(struct table *t, int row_id) } } -struct table *table_init(void) +struct table *table_create(void) { - struct table *t = malloc(sizeof(struct table)); - - if (!t) - return NULL; - - memset(t, 0, sizeof(struct table)); - - return t; + return calloc(1, sizeof(struct table)); } struct table *table_init_with_columns(struct table_column *c, int num_columns) { - struct table *t = table_init(); + struct table *t = table_create(); if (!t) return NULL; @@ -256,7 +249,6 @@ struct table *table_init_with_columns(struct table_column *c, int num_columns) } return t; - } static int table_add_column(struct table *t, struct table_column *c) diff --git a/util/table.h b/util/table.h index aca03ca324..a2ab2860fd 100644 --- a/util/table.h +++ b/util/table.h @@ -135,7 +135,7 @@ static inline void table_set_value_unsigned_long(struct table *t, int col, v->type = FMT_UNSIGNED_LONG; } -struct table *table_init(void); +struct table *table_create(void); int table_add_columns(struct table *t, struct table_column *c, int num_columns); int table_add_columns_filter(struct table *t, struct table_column *c, int num_columns, @@ -151,7 +151,7 @@ void table_free(struct table *t); * @c: Column definitions * @num_columns:Number of columns * - * This is a function combined table_init() and table_add_columns(). + * This is a function combined table_create() and table_add_columns(). * * Return: The table instance, or NULL if unsuccessful. If allocated, the caller * is responsible to free the table.