continue;
ret = check_range(t, i, j);
if (ret < 0) {
- if (ret != -E_OSL_INVALID_OBJECT &&
- ret != -E_FSCK_RANGE_VIOLATION)
+ if (ret != -E_FSCK_RANGE_VIOLATION)
goto err;
- if (ret == -E_OSL_INVALID_OBJECT) {
- CRIT_LOG("row %d, col %d maps to an "
- "invalid object\n", i, j);
- }
ret = mark_row_invalid(t, i);
if (ret < 0)
goto err;
for (j = 0; j < t->num_rows; j++) {
struct osl_object obj;
ret = get_mapped_object(t, i, j, &obj);
- if (ret >= 0) {
- loss[i] -= obj.size + 1; /* add one for header byte */
- continue;
- }
- if (ret != -E_OSL_INVALID_OBJECT)
+ if (ret < 0)
goto err;
- CRIT_LOG("row %d, col %d points to an invalid "
- "mapped object, bad\n", j, i);
+ loss[i] -= obj.size;
}
}
ret = 0;
return 1;
}
-static int append_file(const char *filename, char *header, size_t header_size,
- char *data, size_t data_size, uint32_t *new_pos)
+static int append_file(const char *filename, char *data, size_t data_size,
+ uint32_t *new_pos)
{
int ret, fd;
if (ret < 0)
return ret;
fd = ret;
- if (header && header_size) {
- ret = write_all(fd, header, &header_size);
- if (ret < 0)
- goto out;
- }
ret = write_all(fd, data, &data_size);
if (ret < 0)
goto out;
{
struct osl_column *col = &t->columns[col_num];
uint32_t offset;
- char *header;
char *cell_index;
int ret;
if (ret < 0)
return ret;
offset = read_u32(cell_index);
- obj->size = read_u32(cell_index + 4) - 1;
- header = col->data_map.data + offset;
- obj->data = header + 1;
- if (read_u8(header) == 0xff) {
- ERROR_LOG("col %u, size %zu, offset %u\n", col_num,
- obj->size, offset);
- return -E_OSL_INVALID_OBJECT;
- }
+ obj->size = read_u32(cell_index + 4);
+ obj->data = col->data_map.data + offset;
return 1;
}
{
char *filename = column_filename(t, col_num);
int ret;
- char header = 0; /* zero means valid object */
if (!filename)
return -ERRNO_TO_ERROR(ENOMEM);
- ret = append_file(filename, &header, 1, obj->data, obj->size,
- new_size);
+ ret = append_file(filename, obj->data, obj->size, new_size);
free(filename);
return ret;
}
filename = index_filename(t->desc);
if (!filename)
return -ERRNO_TO_ERROR(ENOMEM);
- ret = append_file(filename, NULL, 0, row_index,
- t->row_index_size, NULL);
+ ret = append_file(filename, row_index, t->row_index_size, NULL);
free(filename);
return ret;
}
return 1;
}
-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, row_num, &obj);
-
- if (ret < 0)
- return ret;
- p = obj.data;
- p--;
- *p = 0xff;
- return 1;
-}
-
__export int osl_del_row(struct osl_table *t, struct osl_row *row)
{
struct osl_row *r = row;
struct osl_column *col = t->columns + i;
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->num, i);
+ if (st == OSL_MAPPED_STORAGE)
continue;
- }
if (st == OSL_NO_STORAGE && !(cd->storage_flags & OSL_DONT_FREE))
free(r->volatile_objects[col->volatile_num].data);
}
uint32_t new_data_map_size;
char *row_index;
ret = get_row_index(t, r->num, &row_index);
- if (ret < 0)
- return ret;
- ret = mark_mapped_object_invalid(t, r->num, col_num);
if (ret < 0)
return ret;
unmap_column(t, col_num);