2010-09-22 18:32:21 +00:00
|
|
|
/*
|
2017-03-07 09:34:47 +00:00
|
|
|
* virfdstream.h: generic streams impl for file descriptors
|
2010-09-22 18:32:21 +00:00
|
|
|
*
|
2012-02-23 12:45:25 +00:00
|
|
|
* Copyright (C) 2009-2012 Red Hat, Inc.
|
2010-09-22 18:32:21 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2010-09-22 18:32:21 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-06-18 16:13:08 +00:00
|
|
|
#pragma once
|
2010-09-22 18:32:21 +00:00
|
|
|
|
2019-06-18 16:13:08 +00:00
|
|
|
#include "internal.h"
|
2010-09-22 18:32:21 +00:00
|
|
|
|
2012-02-23 12:45:25 +00:00
|
|
|
/* internal callback, the generic one is used up by daemon stream driver */
|
|
|
|
/* the close callback is called with fdstream private data locked */
|
|
|
|
typedef void (*virFDStreamInternalCloseCb)(virStreamPtr st, void *opaque);
|
|
|
|
|
|
|
|
typedef void (*virFDStreamInternalCloseCbFreeOpaque)(void *opaque);
|
|
|
|
|
|
|
|
|
2010-09-22 18:32:21 +00:00
|
|
|
int virFDStreamOpen(virStreamPtr st,
|
|
|
|
int fd);
|
|
|
|
|
|
|
|
int virFDStreamConnectUNIX(virStreamPtr st,
|
|
|
|
const char *path,
|
|
|
|
bool abstract);
|
|
|
|
|
|
|
|
int virFDStreamOpenFile(virStreamPtr st,
|
|
|
|
const char *path,
|
2011-02-22 12:05:20 +00:00
|
|
|
unsigned long long offset,
|
|
|
|
unsigned long long length,
|
2011-08-02 17:19:53 +00:00
|
|
|
int oflags);
|
2010-09-22 18:32:21 +00:00
|
|
|
int virFDStreamCreateFile(virStreamPtr st,
|
|
|
|
const char *path,
|
2011-02-22 12:05:20 +00:00
|
|
|
unsigned long long offset,
|
|
|
|
unsigned long long length,
|
2011-07-07 17:57:43 +00:00
|
|
|
int oflags,
|
2011-08-02 17:19:53 +00:00
|
|
|
mode_t mode);
|
2014-03-10 12:32:51 +00:00
|
|
|
int virFDStreamOpenPTY(virStreamPtr st,
|
|
|
|
const char *path,
|
|
|
|
unsigned long long offset,
|
|
|
|
unsigned long long length,
|
|
|
|
int oflags);
|
2014-08-15 08:11:35 +00:00
|
|
|
int virFDStreamOpenBlockDevice(virStreamPtr st,
|
|
|
|
const char *path,
|
|
|
|
unsigned long long offset,
|
|
|
|
unsigned long long length,
|
2016-04-27 08:51:46 +00:00
|
|
|
bool sparse,
|
2014-08-15 08:11:35 +00:00
|
|
|
int oflags);
|
2010-09-22 18:32:21 +00:00
|
|
|
|
2012-02-23 12:45:25 +00:00
|
|
|
int virFDStreamSetInternalCloseCb(virStreamPtr st,
|
|
|
|
virFDStreamInternalCloseCb cb,
|
|
|
|
void *opaque,
|
|
|
|
virFDStreamInternalCloseCbFreeOpaque fcb);
|