diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2020-12-02 04:46:28 -0500 |
---|---|---|
committer | Thanos Makatos <thanos.makatos@nutanix.com> | 2020-12-02 04:46:28 -0500 |
commit | 207374c07b90e386462ca6c43405345b84723a8a (patch) | |
tree | ef8928d5c1b634a48dc2d5e7e1d21a7fa2f2ed59 /lib | |
parent | a623866f21bdc102f0d96cbd196a3080439caa30 (diff) | |
download | libvfio-user-207374c07b90e386462ca6c43405345b84723a8a.zip libvfio-user-207374c07b90e386462ca6c43405345b84723a8a.tar.gz libvfio-user-207374c07b90e386462ca6c43405345b84723a8a.tar.bz2 |
introduce device type
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libvfio-user.c | 9 | ||||
-rw-r--r-- | lib/private.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c index 964091c..30416a9 100644 --- a/lib/libvfio-user.c +++ b/lib/libvfio-user.c @@ -1278,7 +1278,8 @@ vfu_ctx_try_attach(vfu_ctx_t *vfu_ctx) } vfu_ctx_t * -vfu_create_ctx(vfu_trans_t trans, const char *path, int flags, void *pvt) +vfu_create_ctx(vfu_trans_t trans, const char *path, int flags, void *pvt, + vfu_dev_type_t dev_type) { vfu_ctx_t *vfu_ctx = NULL; int err = 0; @@ -1288,10 +1289,16 @@ vfu_create_ctx(vfu_trans_t trans, const char *path, int flags, void *pvt) return NULL; } + if (dev_type != VFU_DEV_TYPE_PCI) { + errno = EINVAL; + return NULL; + } + vfu_ctx = calloc(1, sizeof(vfu_ctx_t)); if (vfu_ctx == NULL) { return NULL; } + vfu_ctx->dev_type = dev_type; vfu_ctx->trans = &sock_transport_ops; //FIXME: Validate arguments. diff --git a/lib/private.h b/lib/private.h index a2fb3a7..335ceaa 100644 --- a/lib/private.h +++ b/lib/private.h @@ -129,6 +129,7 @@ struct vfu_ctx { uint32_t irq_count[VFU_DEV_NUM_IRQS]; vfu_irqs_t *irqs; int ready; + vfu_dev_type_t dev_type; }; int |