#include <ucw/table.h>
+#ifdef CONFIG_UCW_CLEAN_ABI
+#define table_col_size ucw_table_col_size
+#define table_col_timestamp ucw_table_col_timestamp
+#define xt_size ucw_xt_size
+#define xt_timestamp ucw_xt_timestamp
+#endif
+
+/* Size, possibly with a unit. Internally represented as u64. */
+
+extern const struct xtype xt_size;
+
enum size_units {
- SIZE_UNIT_BYTE,
- SIZE_UNIT_KILOBYTE,
- SIZE_UNIT_MEGABYTE,
- SIZE_UNIT_GIGABYTE,
- SIZE_UNIT_TERABYTE,
- SIZE_UNIT_AUTO
+ XT_SIZE_UNIT_BYTE,
+ XT_SIZE_UNIT_KILOBYTE,
+ XT_SIZE_UNIT_MEGABYTE,
+ XT_SIZE_UNIT_GIGABYTE,
+ XT_SIZE_UNIT_TERABYTE,
+ XT_SIZE_UNIT_AUTO
};
-#define TIMESTAMP_EPOCH XTYPE_FMT_RAW
-#define TIMESTAMP_DATETIME XTYPE_FMT_PRETTY
+#define XT_SIZE_FMT_UNIT(_unit) (_unit | XT_SIZE_FMT_FIXED_UNIT)
+#define XT_SIZE_FMT_FIXED_UNIT XTYPE_FMT_CUSTOM
-#define SIZE_UNITS_FIXED 0x40000000
+#define TBL_COL_SIZE(_name, _width) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_size }
+#define TBL_COL_SIZE_FMT(_name, _width, _fmt) { .name = _name, .width = _width, .fmt = _fmt, .type_def = &xt_size }
-extern const struct xtype xt_size;
-extern const struct xtype xt_timestamp;
+TABLE_COL_PROTO(size, u64)
-int table_set_col_opt_size(struct table *tbl, uint col_inst_idx, const char *col_arg, char **err);
-int table_set_col_opt_timestamp(struct table *tbl, uint col_inst_idx, const char *col_arg, char **err);
+/* Timestamp. Internally represented as time_t. */
-#define TBL_COL_SIZE(_name, _width) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_size, .set_col_instance_option = table_set_col_opt_size }
-#define TBL_COL_TIMESTAMP(_name, _width) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_timestamp, .set_col_instance_option = table_set_col_opt_timestamp }
+#define XT_TIMESTAMP_FMT_EPOCH XTYPE_FMT_RAW
+#define XT_TIMESTAMP_FMT_DATETIME XTYPE_FMT_PRETTY
-#define TBL_COL_SIZE_FMT(_name, _width, _units) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_size, .set_col_instance_option = table_set_col_opt_size }
-#define TBL_COL_TIMESTAMP_FMT(_name, _width, _fmt) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_timestamp, .set_col_instance_option = table_set_col_opt_timestamp }
+extern const struct xtype xt_timestamp;
+#define TBL_COL_TIMESTAMP(_name, _width) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_timestamp }
+#define TBL_COL_TIMESTAMP_FMT(_name, _width, _fmt) { .name = _name, .width = _width, .fmt = _fmt, .type_def = &xt_timestamp }
-TABLE_COL_PROTO(size, u64)
TABLE_COL_PROTO(timestamp, u64)
#endif