2 * Copyright (c) 2005-2008 Zmanda, Inc. All Rights Reserved.
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 2.1 as
6 * published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11 * License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
18 * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
21 #ifndef DEVICE_QUEUEING_H
22 #define DEVICE_QUEUEING_H
24 /* some utilities for using queueing with device */
28 /* These functions will call device_read_block and device_write_block
29 * respectively. The user data should be a Device*.
31 * device_write_consumer assumes that the block_size passed to
32 * do_consumer_producer_queue_full is at least device->block_size();
33 * do_consumer_thread() will not pass a buffer of less than block_size
34 * to the consumer unless it has received EOF from the producer thread.
36 * Similarly, device_read_producer works similarly, but will expand its
37 * buffers if the device encounters larger blocks - this is Amanda's
38 * ability to read volumes written with larger block sizes.
40 producer_result_t device_read_producer(gpointer device,
41 queue_buffer_t *buffer,
43 ssize_t device_write_consumer(gpointer device, queue_buffer_t *buffer);
45 #endif /* DEVICE_QUEUEING_H */