FILE
io-factory.h
File preview with syntax highlighting.
linux-6.19.14/drivers/md/dm-vdo/indexer/io-factory.h
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright 2023 Red Hat 4 */ 5 6#ifndef UDS_IO_FACTORY_H 7#define UDS_IO_FACTORY_H 8 9#include <linux/dm-bufio.h> 10 11/* 12 * The I/O factory manages all low-level I/O operations to the underlying storage device. Its main 13 * clients are the index layout and the volume. The buffered reader and buffered writer interfaces 14 * are helpers for accessing data in a contiguous range of storage blocks. 15 */ 16 17struct buffered_reader; 18struct buffered_writer; 19 20struct io_factory; 21 22enum { 23 UDS_BLOCK_SIZE = 4096, 24 SECTORS_PER_BLOCK = UDS_BLOCK_SIZE >> SECTOR_SHIFT, 25}; 26 27int __must_check uds_make_io_factory(struct block_device *bdev, 28 struct io_factory **factory_ptr); 29 30int __must_check uds_replace_storage(struct io_factory *factory, 31 struct block_device *bdev); 32 33void uds_put_io_factory(struct io_factory *factory); 34 35size_t __must_check uds_get_writable_size(struct io_factory *factory); 36 37int __must_check uds_make_bufio(struct io_factory *factory, off_t block_offset, 38 size_t block_size, unsigned int reserved_buffers, 39 struct dm_bufio_client **client_ptr); 40 41int __must_check uds_make_buffered_reader(struct io_factory *factory, off_t offset, 42 u64 block_count, 43 struct buffered_reader **reader_ptr); 44 45void uds_free_buffered_reader(struct buffered_reader *reader); 46 47int __must_check uds_read_from_buffered_reader(struct buffered_reader *reader, u8 *data, 48 size_t length); 49 50int __must_check uds_verify_buffered_data(struct buffered_reader *reader, const u8 *value, 51 size_t length); 52 53int __must_check uds_make_buffered_writer(struct io_factory *factory, off_t offset, 54 u64 block_count, 55 struct buffered_writer **writer_ptr); 56 57void uds_free_buffered_writer(struct buffered_writer *buffer); 58 59int __must_check uds_write_to_buffered_writer(struct buffered_writer *writer, 60 const u8 *data, size_t length); 61 62int __must_check uds_flush_buffered_writer(struct buffered_writer *writer); 63 64#endif /* UDS_IO_FACTORY_H */
~/
Read-only file preview.