Files
xen/tools/libs/devicemodel/private.h
T
Paul Durrant 8ef5f344d0 tools/libxendevicemodel: add a call to restrict the handle
My recent patch [1] to the Linux privcmd module introduced a mechanism
to restrict an open file handle to subsequently only accept operations for
a specified domain.

This patch extends the libxendevicemodel API and make use of the
mechanism in the Linux-specific code to restrict operations on the
interface handle.

[1] https://git.kernel.org/cgit/linux/kernel/git/ostr/linux.git/commit/?id=4610d240

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2017-02-23 11:57:51 +00:00

49 lines
1.1 KiB
C

#ifndef XENDEVICEMODEL_PRIVATE_H
#define XENDEVICEMODEL_PRIVATE_H
#define __XEN_TOOLS__ 1
#include <xentoollog.h>
#include <xendevicemodel.h>
#include <xencall.h>
struct xendevicemodel_handle {
xentoollog_logger *logger, *logger_tofree;
unsigned int flags;
xencall_handle *xcall;
int fd;
};
struct xendevicemodel_buf {
void *ptr;
size_t size;
};
int xendevicemodel_xcall(xendevicemodel_handle *dmod,
domid_t domid, unsigned int nr_bufs,
struct xendevicemodel_buf bufs[]);
int osdep_xendevicemodel_open(xendevicemodel_handle *dmod);
int osdep_xendevicemodel_close(xendevicemodel_handle *dmod);
int osdep_xendevicemodel_op(xendevicemodel_handle *dmod,
domid_t domid, unsigned int nr_bufs,
struct xendevicemodel_buf bufs[]);
int osdep_xendevicemodel_restrict(
xendevicemodel_handle *dmod, domid_t domid);
#define PERROR(_f...) \
xtl_log(dmod->logger, XTL_ERROR, errno, "xendevicemodel", _f)
#endif
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/