}
ret = osl(osl_get_object(table, row, BLOBCOL_ID, &obj));
if (ret < 0) {
- para_printf(&aca->pbout, "cannot list %s\n", name);
+ afs_error(aca, "cannot list %s\n", name);
return ret;
}
id = read_u32(obj.data);
int ret = osl(osl_del_row(table, row));
if (ret < 0) {
- para_printf(&aca->pbout, "cannot remove %s\n", name);
+ afs_error(aca, "cannot remove %s\n", name);
return ret;
}
return 1;
ret = afs_event(BLOB_ADD, NULL, table);
out:
if (ret < 0)
- para_printf(&aca->pbout, "cannot add %s\n", name);
+ afs_error(aca, "cannot add %s\n", name);
else
para_printf(&aca->pbout, "added %s as id %u\n", name, id);
return ret;
ret = osl(osl_get_row(table, BLOBCOL_NAME, &obj, &row));
if (ret < 0) {
- para_printf(&aca->pbout, "cannot find source blob %s\n", src);
+ afs_error(aca, "cannot find source blob %s\n", src);
goto out;
}
obj.data = (char *)dest;
obj.size = strlen(dest) + 1;
ret = osl(osl_update_object(table, row, BLOBCOL_NAME, &obj));
if (ret < 0) {
- para_printf(&aca->pbout, "cannot rename blob %s to %s\n",
- src, dest);
+ afs_error(aca, "cannot rename blob %s to %s\n", src, dest);
goto out;
}
ret = afs_event(BLOB_RENAME, NULL, table);
&table_name ## _table_desc, dir); \
}
-
-/** Define the \p init function for this blob type. */
-#define DEFINE_BLOB_INIT(table_name) \
- void table_name ## _init(struct afs_table *t) \
- { \
- t->open = table_name ## _open; \
- t->close = table_name ## _close; \
- t->create = table_name ## _create;\
- t->event_handler = table_name ##_event_handler; \
- table_name ## _table = NULL; \
- }
-
+/** Blob tables map integers to blobs. */
+#define DEFINE_BLOB_AFS_TABLE_OPS(table_name) \
+ const struct afs_table_operations table_name ## _ops = { \
+ .open = table_name ## _open, \
+ .close = table_name ## _close, \
+ .create = table_name ## _create, \
+ .event_handler = table_name ##_event_handler, \
+ };
/** Define all functions for this blob type. */
#define DEFINE_BLOB_FUNCTIONS(table_name, short_name, c_short_name) \
DEFINE_BLOB_OPEN(table_name) \
DEFINE_BLOB_CLOSE(table_name) \
DEFINE_BLOB_CREATE(table_name) \
- DEFINE_BLOB_INIT(table_name) \
+ DEFINE_BLOB_AFS_TABLE_OPS(table_name) \
DEFINE_BLOB_COMMAND(ls, LS, table_name, short_name, c_short_name) \
DEFINE_BLOB_COMMAND(cat, CAT, table_name, short_name, c_short_name) \
DEFINE_BLOB_COMMAND(add, ADD, table_name, short_name, c_short_name) \