*
* If a simple string conversion is not possible then application (which want
* to use filters and counters) needs to define data function to do the
- * conversion. See scols_column_set_datafunc().
+ * conversion. See scols_column_set_data_func().
*
* Returns: 0, a negative value in case of an error.
*
return 0;
}
-/* scols_column_set_datafunc:
+/*
+ * scols_column_set_data_func:
* @cl: a pointer to a struct libscols_column instance
* @datafunc: function to return data
* @userdata: optional stuff for callbacks
*
- * The internal library operations (like filters) use standard cell data by default.
- * This callback allows to use the data in another format for internal library purpose.
- *
- * The callback needs to return the data as pointer to void, and the datatype
+ * The table always keep data in strings in form that is printed on output, but
+ * for some internal operations (like filters or counters) it needs to convert
+ * the strings to usable data format. If this converion is not possible then
+ * application can define datafunc() callback to provide data for filters and counters.
+
+ * The callback needs to return the data as pointer to void, and the data type
* is defined by scols_column_set_data_type().
*
* Returns: 0, a negative value in case of an error.
*
* Since: 2.40
*/
-int scols_column_set_datafunc(struct libscols_column *cl,
+int scols_column_set_data_func(struct libscols_column *cl,
void *(*datafunc)(const struct libscols_column *,
struct libscols_cell *,
void *),
/**
* @cl: a pointer to a struct libscols_column instance
*
- * Returns: 1 if datafunc defined, or 0
+ * See scols_column_set_data_func() for more details.
+ *
+ * Returns: 1 if data function defined, or 0
*
* Since: 2.40
*/
-int scols_column_has_datafunc(struct libscols_column *cl)
+int scols_column_has_data_func(struct libscols_column *cl)
{
return cl && cl->datafunc != NULL ? 1 : 0;
}
n->fetched = 1;
- if (cl->datafunc) {
+ if (scols_column_has_data_func(cl)) {
struct libscols_cell *ce = scols_line_get_column_cell(ln, cl);
if (ce)
char *, void *),
void *userdata);
-extern int scols_column_set_datafunc(struct libscols_column *cl,
+extern int scols_column_set_data_func(struct libscols_column *cl,
void *(*datafunc)(const struct libscols_column *,
struct libscols_cell *,
void *),
void *userdata);
-extern int scols_column_has_datafunc(struct libscols_column *cl);
+extern int scols_column_has_data_func(struct libscols_column *cl);
extern char *scols_wrapnl_nextchunk(const struct libscols_column *cl, char *data, void *userdata);
extern size_t scols_wrapnl_chunksize(const struct libscols_column *cl, const char *data, void *userdata);
scols_counter_get_name;
scols_filter_next_counter;
scols_shellvar_name;
- scols_column_set_datafunc;
- scols_column_has_datafunc;
+ scols_column_set_data_func;
+ scols_column_has_data_func;
scols_column_set_data_type;
scols_column_get_data_type;
} SMARTCOLS_2.39;
struct libscols_cell *ce;
void *data;
- if (cl != lsblk->sort_col && !scols_column_has_datafunc(cl))
+ if (cl != lsblk->sort_col && !scols_column_has_data_func(cl))
continue;
ce = scols_line_get_column_cell(ln, cl);
size_t datasiz = 0;
int rc, id = get_column_id(colnum);
- if (lsblk->sort_id == id || scols_column_has_datafunc(cl)) {
+ if (lsblk->sort_id == id || scols_column_has_data_func(cl)) {
uint64_t rawdata = (uint64_t) -1;
data = device_get_data(dev, parent, id, &rawdata, &datasiz);
/* For sizes use rawdata (u64) rather than strings from table */
if (ci->type == COLTYPE_SIZE
&& !lsblk->bytes
- && !scols_column_has_datafunc(col)) {
+ && !scols_column_has_data_func(col)) {
scols_column_set_data_type(col, SCOLS_DATA_U64);
- scols_column_set_datafunc(col, get_u64_cell, NULL);
+ scols_column_set_data_func(col, get_u64_cell, NULL);
lsblk->rawdata = 1;
}