SHLIB_libxenforeignmemory = $(SHDEPS_libxenforeignmemory) -Wl,-rpath-link=$(XEN_LIBXENFOREIGNMEMORY)
CFLAGS_libxendevicemodel = -I$(XEN_LIBXENDEVICEMODEL)/include $(CFLAGS_xeninclude)
-SHDEPS_libxendevicemodel = $(SHLIB_libxentoollog) $(SHLIB_xencall)
+SHDEPS_libxendevicemodel = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_xencall)
LDLIBS_libxendevicemodel = $(SHDEPS_libxendevicemodel) $(XEN_LIBXENDEVICEMODEL)/libxendevicemodel$(libextension)
SHLIB_libxendevicemodel = $(SHDEPS_libxendevicemodel) -Wl,-rpath-link=$(XEN_LIBXENDEVICEMODEL)
CFLAGS += -Werror -Wmissing-prototypes
CFLAGS += -I./include $(CFLAGS_xeninclude)
CFLAGS += $(CFLAGS_libxentoollog)
+CFLAGS += $(CFLAGS_libxentoolcore)
CFLAGS += $(CFLAGS_libxencall)
SRCS-y += core.c
$(SYMLINK_SHLIB) $< $@
libxendevicemodel.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxendevicemodel.map
- $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(APPEND_LDFLAGS)
+ $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(LDLIBS_libxentoolcore) $(APPEND_LDFLAGS)
.PHONY: install
install: build
#include "private.h"
+static int all_restrict_cb(Xentoolcore__Active_Handle *ah, uint32_t domid) {
+ xendevicemodel_handle *dmod = CONTAINER_OF(ah, *dmod, tc_ah);
+
+ if (dmod->fd < 0)
+ /* just in case */
+ return 0;
+
+ return xendevicemodel_restrict(dmod, domid);
+}
+
xendevicemodel_handle *xendevicemodel_open(xentoollog_logger *logger,
unsigned open_flags)
{
if (!dmod)
return NULL;
+ dmod->fd = -1;
+ dmod->tc_ah.restrict_callback = all_restrict_cb;
+ xentoolcore__register_active_handle(&dmod->tc_ah);
+
dmod->flags = open_flags;
dmod->logger = logger;
dmod->logger_tofree = NULL;
err:
xtl_logger_destroy(dmod->logger_tofree);
xencall_close(dmod->xcall);
+ xentoolcore__deregister_active_handle(&dmod->tc_ah);
free(dmod);
return NULL;
}
rc = osdep_xendevicemodel_close(dmod);
xencall_close(dmod->xcall);
+ xentoolcore__deregister_active_handle(&dmod->tc_ah);
xtl_logger_destroy(dmod->logger_tofree);
free(dmod);
return rc;
#include <xendevicemodel.h>
#include <xencall.h>
+#include <xentoolcore_internal.h>
+
struct xendevicemodel_handle {
xentoollog_logger *logger, *logger_tofree;
unsigned int flags;
xencall_handle *xcall;
int fd;
+ Xentoolcore__Active_Handle tc_ah;
};
struct xendevicemodel_buf {
Version: @@version@@
Cflags: -I${includedir} @@cflagslocal@@
Libs: @@libsflag@@${libdir} -lxendevicemodel
-Requires.private: xentoollog,xencall
+Requires.private: xentoolcore,xentoollog,xencall