vmci_host_dev
struct vmci_host_dev *vmci_host_dev;
vmci_host_dev = kzalloc_obj(struct vmci_host_dev);
if (vmci_host_dev == NULL)
vmci_host_dev->ct_type = VMCIOBJ_NOT_SET;
mutex_init(&vmci_host_dev->lock);
filp->private_data = vmci_host_dev;
struct vmci_host_dev *vmci_host_dev = filp->private_data;
if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) {
vmci_ctx_destroy(vmci_host_dev->context);
vmci_host_dev->context = NULL;
vmci_host_dev->ct_type = VMCIOBJ_NOT_SET;
kfree(vmci_host_dev);
struct vmci_host_dev *vmci_host_dev = filp->private_data;
if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) {
context = vmci_host_dev->context;
static int vmci_host_get_version(struct vmci_host_dev *vmci_host_dev,
if (get_user(vmci_host_dev->user_version, vptr))
if (vmci_host_dev->user_version > 0 &&
vmci_host_dev->user_version < VMCI_VERSION_HOSTQP) {
return vmci_host_dev->user_version;
static int vmci_host_do_init_context(struct vmci_host_dev *vmci_host_dev,
mutex_lock(&vmci_host_dev->lock);
if (vmci_host_dev->ct_type != VMCIOBJ_NOT_SET) {
vmci_host_dev->context = vmci_ctx_create(init_block.cid,
vmci_host_dev->user_version,
if (IS_ERR(vmci_host_dev->context)) {
retval = PTR_ERR(vmci_host_dev->context);
init_block.cid = vmci_ctx_get_id(vmci_host_dev->context);
vmci_ctx_destroy(vmci_host_dev->context);
vmci_host_dev->context = NULL;
vmci_host_dev->ct_type = VMCIOBJ_CONTEXT;
mutex_unlock(&vmci_host_dev->lock);
static int vmci_host_do_send_datagram(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
cid = vmci_ctx_get_id(vmci_host_dev->context);
static int vmci_host_do_receive_datagram(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
recv_info.result = vmci_ctx_dequeue_datagram(vmci_host_dev->context,
static int vmci_host_do_alloc_queuepair(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) {
vmci_host_dev->context);
vmci_host_dev->context);
vmci_host_dev->context);
static int vmci_host_do_queuepair_setva(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) {
vmci_host_dev->context,
vmci_host_dev->context, 0);
static int vmci_host_do_queuepair_setpf(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->user_version < VMCI_VERSION_HOSTQP ||
vmci_host_dev->user_version >= VMCI_VERSION_NOVMVM) {
vmci_host_dev->user_version);
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
vmci_host_dev->context);
static int vmci_host_do_qp_detach(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
vmci_host_dev->context);
vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) {
static int vmci_host_do_ctx_add_notify(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
cid = vmci_ctx_get_id(vmci_host_dev->context);
static int vmci_host_do_ctx_remove_notify(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
cid = vmci_ctx_get_id(vmci_host_dev->context);
static int vmci_host_do_ctx_get_cpt_state(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
cid = vmci_ctx_get_id(vmci_host_dev->context);
static int vmci_host_do_ctx_set_cpt_state(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
cid = vmci_ctx_get_id(vmci_host_dev->context);
static int vmci_host_do_get_context_id(struct vmci_host_dev *vmci_host_dev,
static int vmci_host_do_set_notify(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
vmci_host_setup_notify(vmci_host_dev->context,
vmci_ctx_unset_notify(vmci_host_dev->context);
static int vmci_host_do_notify_resource(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) {
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
cid = vmci_ctx_get_id(vmci_host_dev->context);
static int vmci_host_do_recv_notifications(struct vmci_host_dev *vmci_host_dev,
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) {
cid = vmci_ctx_get_id(vmci_host_dev->context);
vmci_host_dev, name, uptr); \
struct vmci_host_dev *vmci_host_dev = filp->private_data;
return vmci_host_get_version(vmci_host_dev, iocmd, uptr);