X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=blob.c;h=20d8cba81499218a4c6bc9a0008d99712a984755;hb=00f69cb56e12b9c0106d45bbbf11b98fbcc4239f;hp=b63724014138513dfb89d4300cb38056bfaa601a;hpb=610cb53b94af8e95326cd44b7845f35cffdb6bf3;p=paraslash.git diff --git a/blob.c b/blob.c index b6372401..20d8cba8 100644 --- a/blob.c +++ b/blob.c @@ -520,11 +520,11 @@ static int blob_get_name_by_id(struct osl_table *table, uint32_t id, return blob_get_name_by_id(table_name ## _table, id, name); \ } -static int blob_get_def_by_name(struct osl_table *table, char *name, +static int blob_get_def_by_name(struct osl_table *table, const char *name, struct osl_object *def) { struct osl_row *row; - struct osl_object obj = {.data = name, .size = strlen(name) + 1}; + struct osl_object obj = {.data = (void *)name, .size = strlen(name) + 1}; int ret; def->data = NULL; @@ -538,7 +538,7 @@ static int blob_get_def_by_name(struct osl_table *table, char *name, /** Define the \p get_def_by_id function for this blob type. */ #define DEFINE_GET_DEF_BY_NAME(table_name, cmd_prefix) \ - int cmd_prefix ## _get_def_by_name(char *name, struct osl_object *def) \ + int cmd_prefix ## _get_def_by_name(const char *name, struct osl_object *def) \ { \ return blob_get_def_by_name(table_name ## _table, name, def); \ } @@ -625,25 +625,21 @@ static int blob_open(struct osl_table **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) \