X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=osl_core.h;h=16a6775be607ae36a344bea9162c075e9fe90054;hp=27b808a7dfbf415efec209c86e09128569b94000;hb=efa1d1c721efca286ed95567a365ea4a324c437f;hpb=f6f50d03a09d6bc423324206d274336e9905bbb4 diff --git a/osl_core.h b/osl_core.h index 27b808a7..16a6775b 100644 --- a/osl_core.h +++ b/osl_core.h @@ -60,7 +60,7 @@ struct osl_table { */ unsigned disk_storage_name_column; /** The number of bytes of an index entry of a row. */ - unsigned index_entry_size; + unsigned row_index_size; /** Pointer to the internal representation of the columns. */ struct osl_column *columns; }; @@ -204,7 +204,7 @@ _static_inline_ size_t index_column_description_size(const char *name) _static_inline_ unsigned table_num_rows(const struct osl_table *t) { return (t->index_map.size - t->index_header_size) - / t->index_entry_size; + / t->row_index_size; } /** @@ -243,22 +243,22 @@ _static_inline_ char *column_filename(const struct osl_table *t, unsigned col_nu * * \param t Pointer to a table which has been mapped. * \param row_num The number of the row whose index entry should be retrieved. - * \param index_entry Result is returned here. + * \param row_index Result pointer. * * \return Positive on success, \p -E_INDEX_CORRUPTION otherwise. * - * \sa get_index_entry(). + * \sa get_cell_index(). */ -_static_inline_ int get_index_entry_start(const struct osl_table *t, uint32_t row_num, - unsigned char **index_entry) +_static_inline_ int get_row_index(const struct osl_table *t, uint32_t row_num, + char **row_index) { uint32_t index_offset; - index_offset = t->index_header_size + t->index_entry_size * row_num; + index_offset = t->index_header_size + t->row_index_size * row_num; if (index_offset + 8 > t->index_map.size) { - *index_entry = NULL; + *row_index = NULL; return -E_INDEX_CORRUPTION; } - *index_entry = (unsigned char *)(t->index_map.data) + index_offset; + *row_index = (char *)(t->index_map.data) + index_offset; return 1; } @@ -268,26 +268,26 @@ _static_inline_ int get_index_entry_start(const struct osl_table *t, uint32_t ro * \param t Pointer to a table which has been mapped. * \param row_num The number of the row whose index entry should be retrieved. * \param col_num The number of the column whose index entry should be retrieved. - * \param index_entry Result pointer. + * \param cell_index Result pointer. * * \return Positive on success, \p -E_INDEX_CORRUPTION otherwise. * - * \sa get_index_entry_start(). + * \sa get_row_index(). */ -_static_inline_ int get_index_entry(const struct osl_table *t, uint32_t row_num, - uint32_t col_num, unsigned char **index_entry) +_static_inline_ int get_cell_index(const struct osl_table *t, uint32_t row_num, + uint32_t col_num, char **cell_index) { - int ret = get_index_entry_start(t, row_num, index_entry); + int ret = get_row_index(t, row_num, cell_index); if (ret < 0) return ret; - *index_entry += t->columns[col_num].index_offset; + *cell_index += t->columns[col_num].index_offset; return ret; } /** * Change an index entry of a column after object was added. * - * \param index_entry_start This determines the row. + * \param row_index Pointer to the index of the row to update. * \param col Pointer to the column. * \param map_size The new size of the data file. * \param object_size The size of the object just appended to the data file. @@ -295,13 +295,13 @@ _static_inline_ int get_index_entry(const struct osl_table *t, uint32_t row_num, * This is called right after an object was appended to the data file for a * mapped column. * - * \sa get_index_entry_start(). + * \sa get_row_index(). */ -_static_inline_ void update_index_entry(char *index_entry_start, struct osl_column *col, +_static_inline_ void update_cell_index(char *row_index, struct osl_column *col, uint32_t map_size, uint32_t object_size) { - write_u32(index_entry_start + col->index_offset, map_size - object_size - 1); - write_u32(index_entry_start + col->index_offset + 4, object_size + 1); + write_u32(row_index + col->index_offset, map_size - object_size - 1); + write_u32(row_index + col->index_offset + 4, object_size + 1); } /**