Lines Matching refs:data
2 * undo_io.c --- This is the undo io manager that copies the old data that
3 * copies the old data being overwritten into a tdb database
77 int count, void *data);
79 int count, const void *data);
82 int size, const void *data);
134 struct undo_private_data *data;
138 data = (struct undo_private_data *) undo_channel->private_data;
139 channel = data->real;
200 struct undo_private_data *data;
205 data = (struct undo_private_data *) channel->private_data;
207 if (data->tdb == NULL) {
223 * Data is stored in tdb database as blocks of tdb_data_size size
228 offset = (block * channel->block_size) + data->offset ;
229 block_num = offset / data->tdb_data_size;
230 end_block = (offset + size) / data->tdb_data_size;
232 tdb_transaction_start(data->tdb);
240 if (tdb_exists(data->tdb, tdb_key)) {
252 offset = block_num * data->tdb_data_size;
253 backing_blk_num = (offset - data->offset) / channel->block_size;
255 count = data->tdb_data_size +
256 ((offset - data->offset) % channel->block_size);
259 tdb_transaction_cancel(data->tdb);
269 retval = io_channel_read_blk(data->real, backing_blk_num,
274 tdb_transaction_cancel(data->tdb);
283 tdb_data.dsize = data->tdb_data_size;
286 ((offset - data->offset) % channel->block_size);
288 printf("Printing with key %ld data %x and size %d\n",
293 if (!data->tdb_written) {
294 data->tdb_written = 1;
296 retval = write_block_size(data->tdb,
297 data->tdb_data_size);
299 tdb_transaction_cancel(data->tdb);
305 retval = tdb_store(data->tdb, tdb_key, tdb_data, TDB_INSERT);
311 tdb_transaction_cancel(data->tdb);
320 tdb_transaction_commit(data->tdb);
328 void *data ATTR((unused)),
345 struct undo_private_data *data = NULL;
355 retval = ext2fs_get_mem(sizeof(struct undo_private_data), &data);
365 io->private_data = data;
371 memset(data, 0, sizeof(struct undo_private_data));
372 data->magic = EXT2_ET_MAGIC_UNIX_IO_CHANNEL;
376 &data->real);
380 data->real = 0;
384 data->tdb = tdb_open(tdb_file, 0, TDB_CLEAR_IF_FIRST,
386 if (!data->tdb) {
395 undo_err_handler_init(data->real);
401 if (data->real)
402 io_channel_close(data->real);
403 if (data)
404 ext2fs_free_mem(&data);
412 struct undo_private_data *data;
416 data = (struct undo_private_data *) channel->private_data;
417 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
422 retval = write_file_system_identity(channel, data->tdb);
425 if (data->real)
426 retval = io_channel_close(data->real);
427 if (data->tdb)
428 tdb_close(data->tdb);
439 struct undo_private_data *data;
443 data = (struct undo_private_data *) channel->private_data;
444 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
446 if (data->real)
447 retval = io_channel_set_blksize(data->real, blksize);
451 if (!data->tdb_data_size) {
452 data->tdb_data_size = blksize;
462 struct undo_private_data *data;
465 data = (struct undo_private_data *) channel->private_data;
466 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
468 if (data->real)
469 retval = io_channel_read_blk(data->real, block, count, buf);
477 struct undo_private_data *data;
481 data = (struct undo_private_data *) channel->private_data;
482 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
489 if (data->real)
490 retval = io_channel_write_blk(data->real, block, count, buf);
498 struct undo_private_data *data;
504 data = (struct undo_private_data *) channel->private_data;
505 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
507 location = offset + data->offset;
520 if (data->real && data->real->manager->write_byte)
521 retval = io_channel_write_byte(data->real, offset, size, buf);
527 * Flush data buffers to disk.
532 struct undo_private_data *data;
535 data = (struct undo_private_data *) channel->private_data;
536 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
538 if (data->real)
539 retval = io_channel_flush(data->real);
548 struct undo_private_data *data;
553 data = (struct undo_private_data *) channel->private_data;
554 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
563 if (!data->tdb_data_size || !data->tdb_written) {
564 data->tdb_data_size = tmp;
572 if (data->real && data->real->manager->set_option) {
573 retval = data->real->manager->set_option(data->real,
583 data->offset = tmp;