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;
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;
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);
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;
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++;
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;
/*
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);
/** 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;
};
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);