xref: /openbmc/qemu/include/io/channel-null.h (revision 7db86fe2ed220c196061824e652b94e7a2acbabf)
1*87e42764SDaniel P. Berrangé /*
2*87e42764SDaniel P. Berrangé  * QEMU I/O channels null driver
3*87e42764SDaniel P. Berrangé  *
4*87e42764SDaniel P. Berrangé  * Copyright (c) 2022 Red Hat, Inc.
5*87e42764SDaniel P. Berrangé  *
6*87e42764SDaniel P. Berrangé  * This library is free software; you can redistribute it and/or
7*87e42764SDaniel P. Berrangé  * modify it under the terms of the GNU Lesser General Public
8*87e42764SDaniel P. Berrangé  * License as published by the Free Software Foundation; either
9*87e42764SDaniel P. Berrangé  * version 2.1 of the License, or (at your option) any later version.
10*87e42764SDaniel P. Berrangé  *
11*87e42764SDaniel P. Berrangé  * This library is distributed in the hope that it will be useful,
12*87e42764SDaniel P. Berrangé  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*87e42764SDaniel P. Berrangé  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14*87e42764SDaniel P. Berrangé  * Lesser General Public License for more details.
15*87e42764SDaniel P. Berrangé  *
16*87e42764SDaniel P. Berrangé  * You should have received a copy of the GNU Lesser General Public
17*87e42764SDaniel P. Berrangé  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18*87e42764SDaniel P. Berrangé  *
19*87e42764SDaniel P. Berrangé  */
20*87e42764SDaniel P. Berrangé 
21*87e42764SDaniel P. Berrangé #ifndef QIO_CHANNEL_FILE_H
22*87e42764SDaniel P. Berrangé #define QIO_CHANNEL_FILE_H
23*87e42764SDaniel P. Berrangé 
24*87e42764SDaniel P. Berrangé #include "io/channel.h"
25*87e42764SDaniel P. Berrangé #include "qom/object.h"
26*87e42764SDaniel P. Berrangé 
27*87e42764SDaniel P. Berrangé #define TYPE_QIO_CHANNEL_NULL "qio-channel-null"
28*87e42764SDaniel P. Berrangé OBJECT_DECLARE_SIMPLE_TYPE(QIOChannelNull, QIO_CHANNEL_NULL)
29*87e42764SDaniel P. Berrangé 
30*87e42764SDaniel P. Berrangé 
31*87e42764SDaniel P. Berrangé /**
32*87e42764SDaniel P. Berrangé  * QIOChannelNull:
33*87e42764SDaniel P. Berrangé  *
34*87e42764SDaniel P. Berrangé  * The QIOChannelNull object provides a channel implementation
35*87e42764SDaniel P. Berrangé  * that discards all writes and returns EOF for all reads.
36*87e42764SDaniel P. Berrangé  */
37*87e42764SDaniel P. Berrangé 
38*87e42764SDaniel P. Berrangé struct QIOChannelNull {
39*87e42764SDaniel P. Berrangé     QIOChannel parent;
40*87e42764SDaniel P. Berrangé     bool closed;
41*87e42764SDaniel P. Berrangé };
42*87e42764SDaniel P. Berrangé 
43*87e42764SDaniel P. Berrangé 
44*87e42764SDaniel P. Berrangé /**
45*87e42764SDaniel P. Berrangé  * qio_channel_null_new:
46*87e42764SDaniel P. Berrangé  *
47*87e42764SDaniel P. Berrangé  * Create a new IO channel object that discards all writes
48*87e42764SDaniel P. Berrangé  * and returns EOF for all reads.
49*87e42764SDaniel P. Berrangé  *
50*87e42764SDaniel P. Berrangé  * Returns: the new channel object
51*87e42764SDaniel P. Berrangé  */
52*87e42764SDaniel P. Berrangé QIOChannelNull *
53*87e42764SDaniel P. Berrangé qio_channel_null_new(void);
54*87e42764SDaniel P. Berrangé 
55*87e42764SDaniel P. Berrangé #endif /* QIO_CHANNEL_NULL_H */
56