qcow2: use Z_OK instead of 0 for deflateInit2 return code check
[qemu/ar7.git] / include / io / channel-util.h
blobc0b79cf6036bd30af6fc29a6f363fe1297fb7652
1 /*
2 * QEMU I/O channels utility APIs
4 * Copyright (c) 2016 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_UTIL_H
22 #define QIO_CHANNEL_UTIL_H
24 #include "io/channel.h"
27 * This module provides helper functions that are useful when dealing
28 * with QIOChannel objects
32 /**
33 * qio_channel_new_fd:
34 * @fd: the file descriptor
35 * @errp: pointer to a NULL-initialized error object
37 * Create a channel for performing I/O on the file
38 * descriptor @fd. The particular subclass of QIOChannel
39 * that is returned will depend on what underlying object
40 * the file descriptor is associated with. It may be either
41 * a QIOChannelSocket or a QIOChannelFile instance. Upon
42 * success, the returned QIOChannel instance will own
43 * the @fd file descriptor, and take responsibility for
44 * closing it when no longer required. On failure, the
45 * caller is responsible for closing @fd.
47 * Returns: the channel object, or NULL on error
49 QIOChannel *qio_channel_new_fd(int fd,
50 Error **errp);
52 #endif /* QIO_CHANNEL_UTIL_H */