Makefile: remove obsolete edk2 exception from "clean" rule
[qemu/ar7.git] / include / io / channel-buffer.h
blob89632ef43725c558ce11f5ebbab7bbdde153e717
1 /*
2 * QEMU I/O channels memory buffer driver
4 * Copyright (c) 2015 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef QIO_CHANNEL_BUFFER_H
22 #define QIO_CHANNEL_BUFFER_H
24 #include "io/channel.h"
25 #include "qom/object.h"
27 #define TYPE_QIO_CHANNEL_BUFFER "qio-channel-buffer"
28 typedef struct QIOChannelBuffer QIOChannelBuffer;
29 DECLARE_INSTANCE_CHECKER(QIOChannelBuffer, QIO_CHANNEL_BUFFER,
30 TYPE_QIO_CHANNEL_BUFFER)
33 /**
34 * QIOChannelBuffer:
36 * The QIOChannelBuffer object provides a channel implementation
37 * that is able to perform I/O to/from a memory buffer.
41 struct QIOChannelBuffer {
42 QIOChannel parent;
43 size_t capacity; /* Total allocated memory */
44 size_t usage; /* Current size of data */
45 size_t offset; /* Offset for future I/O ops */
46 uint8_t *data;
50 /**
51 * qio_channel_buffer_new:
52 * @capacity: the initial buffer capacity to allocate
54 * Allocate a new buffer which is initially empty
56 * Returns: the new channel object
58 QIOChannelBuffer *
59 qio_channel_buffer_new(size_t capacity);
61 #endif /* QIO_CHANNEL_BUFFER_H */