From b169ef85673c208ff283217e4cde2f5816e69518 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 15 Sep 2007 23:05:29 +0200 Subject: [PATCH] osl: Rename struct row.id to row.num. --- osl.c | 26 +++++++++++++------------- osl_core.h | 12 ++++++++---- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/osl.c b/osl.c index f49785cd..f38ba58b 100644 --- a/osl.c +++ b/osl.c @@ -991,7 +991,7 @@ static int search_rbtree(const struct osl_object *obj, struct osl_object this_obj; parent = *new; if (st == OSL_MAPPED_STORAGE) { - ret = get_mapped_object(t, col_num, this_row->id, + ret = get_mapped_object(t, col_num, this_row->num, &this_obj); if (ret < 0) return ret; @@ -1061,7 +1061,7 @@ static void remove_rb_node(struct osl_table *t, unsigned col_num, rb_erase(victim, &col->rbtree); } -static int add_row_to_rbtrees(struct osl_table *t, uint32_t id, +static int add_row_to_rbtrees(struct osl_table *t, uint32_t row_num, struct osl_object *volatile_objs, struct osl_row **row_ptr) { unsigned i; @@ -1069,12 +1069,12 @@ static int add_row_to_rbtrees(struct osl_table *t, uint32_t id, struct osl_row *row = allocate_row(t->num_rbtrees); const struct osl_column_description *cd; - row->id = id; + row->num = row_num; row->volatile_objects = volatile_objs; FOR_EACH_RBTREE_COLUMN(i, t, cd) { if (cd->storage_type == OSL_MAPPED_STORAGE) { struct osl_object obj; - ret = get_mapped_object(t, i, id, &obj); + ret = get_mapped_object(t, i, row_num, &obj); if (ret < 0) goto err; ret = insert_rbtree(t, i, row, &obj); @@ -1637,18 +1637,18 @@ int osl_get_object(const struct osl_table *t, const struct osl_row *r, if (cd->storage_type == OSL_DISK_STORAGE) return -E_BAD_STORAGE_TYPE; if (cd->storage_type == OSL_MAPPED_STORAGE) - return get_mapped_object(t, col_num, r->id, object); + return get_mapped_object(t, col_num, r->num, object); /* volatile */ *object = r->volatile_objects[t->columns[col_num].volatile_num]; return 1; } -static int mark_mapped_object_invalid(const struct osl_table *t, uint32_t id, - unsigned col_num) +static int mark_mapped_object_invalid(const struct osl_table *t, + uint32_t row_num, unsigned col_num) { struct osl_object obj; char *p; - int ret = get_mapped_object(t, col_num, id, &obj); + int ret = get_mapped_object(t, col_num, row_num, &obj); if (ret < 0) return ret; @@ -1696,14 +1696,14 @@ int osl_del_row(struct osl_table *t, struct osl_row *row) enum osl_storage_type st = cd->storage_type; remove_rb_node(t, i, r); if (st == OSL_MAPPED_STORAGE) { - mark_mapped_object_invalid(t, r->id, i); + mark_mapped_object_invalid(t, r->num, i); continue; } if (st == OSL_NO_STORAGE) free(r->volatile_objects[col->volatile_num].data); } if (t->num_mapped_columns) { - ret = mark_row_invalid(t, r->id); + ret = mark_row_invalid(t, r->num); if (ret < 0) goto out; t->num_invalid_rows++; @@ -1952,7 +1952,7 @@ int osl_update_object(struct osl_table *t, const struct osl_row *r, return ret; } else { /* mapped storage */ struct osl_object old_obj; - ret = get_mapped_object(t, col_num, r->id, &old_obj); + ret = get_mapped_object(t, col_num, r->num, &old_obj); if (ret < 0) return ret; /* @@ -1970,10 +1970,10 @@ int osl_update_object(struct osl_table *t, const struct osl_row *r, else { /* TODO: if the size doesn't change, use old space */ uint32_t new_data_map_size; char *row_index; - ret = get_row_index(t, r->id, &row_index); + ret = get_row_index(t, r->num, &row_index); if (ret < 0) return ret; - ret = mark_mapped_object_invalid(t, r->id, col_num); + ret = mark_mapped_object_invalid(t, r->num, col_num); if (ret < 0) return ret; unmap_column(t, col_num); diff --git a/osl_core.h b/osl_core.h index 16a6775b..599d22da 100644 --- a/osl_core.h +++ b/osl_core.h @@ -67,8 +67,12 @@ struct osl_table { /** Internal representation of a row of an osl table */ struct osl_row { - /** The row number only present if there is at least one mapped column. */ - off_t id; + /** + * The row number. + * + * It is only used if there is at least one mapped column. + */ + off_t num; /** Array of size \a num_volatile_columns. */ struct osl_object *volatile_objects; }; @@ -76,9 +80,9 @@ struct osl_row { int read_table_desc(struct osl_object *map, struct osl_table_description *desc); int init_table_structure(const struct osl_table_description *desc, struct osl_table **table_ptr); -int row_is_invalid(struct osl_table *t, uint32_t id); +int row_is_invalid(struct osl_table *t, uint32_t row_num); int get_mapped_object(const struct osl_table *t, unsigned col_num, - uint32_t id, struct osl_object *obj); + uint32_t row_num, struct osl_object *obj); int para_truncate(const char *filename, off_t size); int unmap_table(struct osl_table *t, enum osl_close_flags flags); int init_rbtrees(struct osl_table *t); -- 2.30.2