您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ virObjectRef函数代码示例

51自学网 2021-06-03 09:42:22
  C++
这篇教程C++ virObjectRef函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中virObjectRef函数的典型用法代码示例。如果您正苦于以下问题:C++ virObjectRef函数的具体用法?C++ virObjectRef怎么用?C++ virObjectRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了virObjectRef函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: virNetServerClientInitKeepAlive

intvirNetServerClientInitKeepAlive(virNetServerClientPtr client,                                int interval,                                unsigned int count){    virKeepAlivePtr ka;    int ret = -1;    virObjectLock(client);    if (!(ka = virKeepAliveNew(interval, count, client,                               virNetServerClientKeepAliveSendCB,                               virNetServerClientKeepAliveDeadCB,                               virObjectFreeCallback)))        goto cleanup;    /* keepalive object has a reference to client */    virObjectRef(client);    client->keepalive = ka; cleanup:    virObjectUnlock(client);    return ret;}
开发者ID:FrankYu,项目名称:libvirt,代码行数:25,


示例2: qemuTestCapsCacheInsert

int qemuTestCapsCacheInsert(virQEMUCapsCachePtr cache, const char *binary,                            virQEMUCapsPtr caps){    int ret;    if (caps) {        /* Our caps were created artificially, so we don't want         * virQEMUCapsCacheFree() to attempt to deallocate them */        virObjectRef(caps);    } else {        caps = virQEMUCapsNew();        if (!caps)            return -ENOMEM;    }    /* We can have repeating names for our test data sets,     * so make sure there's no old copy */    virHashRemoveEntry(cache->binaries, binary);    ret = virHashAddEntry(cache->binaries, binary, caps);    if (ret < 0)        virObjectUnref(caps);    else        qemuTestCapsName = binary;    return ret;}
开发者ID:JGulic,项目名称:libvirt,代码行数:27,


示例3: virNetServerAddClient

static int virNetServerAddClient(virNetServerPtr srv,                                 virNetServerClientPtr client){    virObjectLock(srv);    if (srv->nclients >= srv->nclients_max) {        virReportError(VIR_ERR_RPC,                       _("Too many active clients (%zu), dropping connection from %s"),                       srv->nclients_max, virNetServerClientRemoteAddrString(client));        goto error;    }    if (virNetServerClientInit(client) < 0)        goto error;    if (VIR_EXPAND_N(srv->clients, srv->nclients, 1) < 0)        goto error;    srv->clients[srv->nclients-1] = client;    virObjectRef(client);    virNetServerClientSetDispatcher(client,                                    virNetServerDispatchNewMessage,                                    srv);    virNetServerClientInitKeepAlive(client, srv->keepaliveInterval,                                    srv->keepaliveCount);    virObjectUnlock(srv);    return 0;error:    virObjectUnlock(srv);    return -1;}
开发者ID:hzguanqiang,项目名称:libvirt,代码行数:34,


示例4: virNetServerClientGetInfo

intvirNetServerClientGetInfo(virNetServerClientPtr client,                          bool *readonly, char **sock_addr,                          virIdentityPtr *identity){    int ret = -1;    const char *addr;    virObjectLock(client);    *readonly = client->readonly;    if (!(addr = virNetServerClientRemoteAddrStringURI(client))) {        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",                       _("No network socket associated with client"));        goto cleanup;    }    if (VIR_STRDUP(*sock_addr, addr) < 0)        goto cleanup;    if (!client->identity) {        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",                       _("No identity information available for client"));        goto cleanup;    }    *identity = virObjectRef(client->identity);    ret = 0; cleanup:    virObjectUnlock(client);    return ret;}
开发者ID:aruiz,项目名称:libvirt,代码行数:33,


示例5: virKeepAliveTimer

static voidvirKeepAliveTimer(int timer ATTRIBUTE_UNUSED, void *opaque){    virKeepAlivePtr ka = opaque;    virNetMessagePtr msg = NULL;    bool dead;    void *client;    virObjectLock(ka);    client = ka->client;    dead = virKeepAliveTimerInternal(ka, &msg);    if (!dead && !msg)        goto cleanup;    virObjectRef(ka);    virObjectUnlock(ka);    if (dead) {        ka->deadCB(client);    } else if (ka->sendCB(client, msg) < 0) {        VIR_WARN("Failed to send keepalive request to client %p", client);        virNetMessageFree(msg);    }    virObjectLock(ka);    virObjectUnref(ka); cleanup:    virObjectUnlock(ka);}
开发者ID:Archer-sys,项目名称:libvirt,代码行数:32,


示例6: qemuTestCapsCacheInsert

int qemuTestCapsCacheInsert(virQEMUCapsCachePtr cache,                            virQEMUCapsPtr caps){    size_t i;    virQEMUCapsPtr tmpCaps;    if (caps) {        tmpCaps = caps;    } else {        if (!(tmpCaps = virQEMUCapsNew()))            return -ENOMEM;    }    for (i = 0; i < ARRAY_CARDINALITY(QEMUBinList); i++) {        virObjectRef(tmpCaps);        if (virHashUpdateEntry(cache->binaries,                               QEMUBinList[i],                               tmpCaps) < 0) {            virObjectUnref(tmpCaps);            return -1;        }    }    if (!caps)        virObjectUnref(tmpCaps);    return 0;}
开发者ID:aruiz,项目名称:libvirt,代码行数:28,


示例7: virGetNWFilterBinding

/** * virGetNWFilterBinding: * @conn: the hypervisor connection * @portdev: pointer to the network filter port device name * @filtername: name of the network filter * * Allocates a new network filter binding object. When the object is no longer * needed, virObjectUnref() must be called in order to not leak data. * * Returns a pointer to the network filter binding object, or NULL on error. */virNWFilterBindingPtrvirGetNWFilterBinding(virConnectPtr conn, const char *portdev,                      const char *filtername){    virNWFilterBindingPtr ret = NULL;    if (virDataTypesInitialize() < 0)        return NULL;    virCheckConnectGoto(conn, error);    virCheckNonNullArgGoto(portdev, error);    if (!(ret = virObjectNew(virNWFilterBindingClass)))        goto error;    if (VIR_STRDUP(ret->portdev, portdev) < 0)        goto error;    if (VIR_STRDUP(ret->filtername, filtername) < 0)        goto error;    ret->conn = virObjectRef(conn);    return ret; error:    virObjectUnref(ret);    return NULL;}
开发者ID:Antique,项目名称:libvirt,代码行数:40,


示例8: virGetSecret

/** * virGetSecret: * @conn: the hypervisor connection * @uuid: secret UUID * * Allocates a new secret object. When the object is no longer needed, * virObjectUnref() must be called in order to not leak data. * * Returns a pointer to the secret object, or NULL on error. */virSecretPtrvirGetSecret(virConnectPtr conn, const unsigned char *uuid,             int usageType, const char *usageID){    virSecretPtr ret = NULL;    if (virDataTypesInitialize() < 0)        return NULL;    virCheckConnectGoto(conn, error);    virCheckNonNullArgGoto(uuid, error);    if (!(ret = virObjectNew(virSecretClass)))        return NULL;    memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);    ret->usageType = usageType;    if (VIR_STRDUP(ret->usageID, usageID ? usageID : "") < 0)        goto error;    ret->conn = virObjectRef(conn);    return ret; error:    virObjectUnref(ret);    return NULL;}
开发者ID:Antique,项目名称:libvirt,代码行数:38,


示例9: virGetNWFilter

/** * virGetNWFilter: * @conn: the hypervisor connection * @name: pointer to the network filter pool name * @uuid: pointer to the uuid * * Allocates a new network filter object. When the object is no longer needed, * virObjectUnref() must be called in order to not leak data. * * Returns a pointer to the network filter object, or NULL on error. */virNWFilterPtrvirGetNWFilter(virConnectPtr conn, const char *name,               const unsigned char *uuid){    virNWFilterPtr ret = NULL;    if (virDataTypesInitialize() < 0)        return NULL;    virCheckConnectGoto(conn, error);    virCheckNonNullArgGoto(name, error);    virCheckNonNullArgGoto(uuid, error);    if (!(ret = virObjectNew(virNWFilterClass)))        goto error;    if (VIR_STRDUP(ret->name, name) < 0)        goto error;    memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);    ret->conn = virObjectRef(conn);    return ret; error:    virObjectUnref(ret);    return NULL;}
开发者ID:Antique,项目名称:libvirt,代码行数:40,


示例10: virGetStoragePool

/** * virGetStoragePool: * @conn: the hypervisor connection * @name: pointer to the storage pool name * @uuid: pointer to the uuid * @privateData: pointer to driver specific private data * @freeFunc: private data cleanup function pointer specific to driver * * Allocates a new storage pool object. When the object is no longer needed, * virObjectUnref() must be called in order to not leak data. * * Returns a pointer to the storage pool object, or NULL on error. */virStoragePoolPtrvirGetStoragePool(virConnectPtr conn, const char *name,                  const unsigned char *uuid,                  void *privateData, virFreeCallback freeFunc){    virStoragePoolPtr ret = NULL;    if (virDataTypesInitialize() < 0)        return NULL;    virCheckConnectGoto(conn, error);    virCheckNonNullArgGoto(name, error);    virCheckNonNullArgGoto(uuid, error);    if (!(ret = virObjectNew(virStoragePoolClass)))        goto error;    if (VIR_STRDUP(ret->name, name) < 0)        goto error;    ret->conn = virObjectRef(conn);    memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);    /* set the driver specific data */    ret->privateData = privateData;    ret->privateDataFreeFunc = freeFunc;    return ret; error:    virObjectUnref(ret);    return NULL;}
开发者ID:Antique,项目名称:libvirt,代码行数:46,


示例11: virGetStorageVol

/** * virGetStorageVol: * @conn: the hypervisor connection * @pool: pool owning the volume * @name: pointer to the storage vol name * @key: pointer to unique key of the volume * @privateData: pointer to driver specific private data * @freeFunc: private data cleanup function pointer specific to driver * * Allocates a new storage volume object. When the object is no longer needed, * virObjectUnref() must be called in order to not leak data. * * Returns a pointer to the storage volume object, or NULL on error. */virStorageVolPtrvirGetStorageVol(virConnectPtr conn, const char *pool, const char *name,                 const char *key, void *privateData, virFreeCallback freeFunc){    virStorageVolPtr ret = NULL;    if (virDataTypesInitialize() < 0)        return NULL;    virCheckConnectGoto(conn, error);    virCheckNonNullArgGoto(pool, error);    virCheckNonNullArgGoto(name, error);    virCheckNonNullArgGoto(key, error);    if (!(ret = virObjectNew(virStorageVolClass)))        goto error;    if (VIR_STRDUP(ret->pool, pool) < 0 ||        VIR_STRDUP(ret->name, name) < 0 ||        VIR_STRDUP(ret->key, key) < 0)        goto error;    ret->conn = virObjectRef(conn);    /* set driver specific data */    ret->privateData = privateData;    ret->privateDataFreeFunc = freeFunc;    return ret; error:    virObjectUnref(ret);    return NULL;}
开发者ID:Antique,项目名称:libvirt,代码行数:48,


示例12: virGetInterface

/** * virGetInterface: * @conn: the hypervisor connection * @name: pointer to the interface name * @mac: pointer to the mac * * Allocates a new interface object. When the object is no longer needed, * virObjectUnref() must be called in order to not leak data. * * Returns a pointer to the interface object, or NULL on error. */virInterfacePtrvirGetInterface(virConnectPtr conn, const char *name, const char *mac){    virInterfacePtr ret = NULL;    if (virDataTypesInitialize() < 0)        return NULL;    virCheckConnectGoto(conn, error);    virCheckNonNullArgGoto(name, error);    /* a NULL mac from caller is okay. Treat it as blank */    if (mac == NULL)       mac = "";    if (!(ret = virObjectNew(virInterfaceClass)))        goto error;    if (VIR_STRDUP(ret->name, name) < 0 ||        VIR_STRDUP(ret->mac, mac) < 0)        goto error;    ret->conn = virObjectRef(conn);    return ret; error:    virObjectUnref(ret);    return NULL;}
开发者ID:Antique,项目名称:libvirt,代码行数:41,


示例13: virAdmConnectCloseCallbackDataRegister

intvirAdmConnectCloseCallbackDataRegister(virAdmConnectCloseCallbackDataPtr cbdata,                                       virAdmConnectPtr conn,                                       virAdmConnectCloseFunc cb,                                       void *opaque,                                       virFreeCallback freecb){    int ret = -1;    virObjectLock(cbdata);    if (cbdata->callback) {        virReportError(VIR_ERR_OPERATION_INVALID, "%s",                       _("A close callback is already registered"));        goto cleanup;    }    cbdata->conn = virObjectRef(conn);    cbdata->callback = cb;    cbdata->opaque = opaque;    cbdata->freeCallback = freecb;    ret = 0; cleanup:    virObjectUnlock(conn->closeCallback);    return ret;}
开发者ID:Antique,项目名称:libvirt,代码行数:27,


示例14: virLXCProcessConnectMonitor

static virLXCMonitorPtr virLXCProcessConnectMonitor(virLXCDriverPtr driver,                                                    virDomainObjPtr vm){    virLXCMonitorPtr monitor = NULL;    virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver);    if (virSecurityManagerSetSocketLabel(driver->securityManager, vm->def) < 0)        goto cleanup;    /* Hold an extra reference because we can't allow 'vm' to be     * deleted while the monitor is active */    virObjectRef(vm);    monitor = virLXCMonitorNew(vm, cfg->stateDir, &monitorCallbacks);    if (monitor == NULL)        virObjectUnref(vm);    if (virSecurityManagerClearSocketLabel(driver->securityManager, vm->def) < 0) {        if (monitor) {            virObjectUnref(monitor);            monitor = NULL;        }        goto cleanup;    } cleanup:    virObjectUnref(cfg);    return monitor;}
开发者ID:AGSaidi,项目名称:hacked-libvirt,代码行数:30,


示例15: virQEMUDriverGetCapabilities

/** * virQEMUDriverGetCapabilities: * * Get a reference to the virCapsPtr instance for the * driver. If @refresh is true, the capabilities will be * rebuilt first * * The caller must release the reference with virObjetUnref * * Returns: a reference to a virCapsPtr instance or NULL */virCapsPtr virQEMUDriverGetCapabilities(virQEMUDriverPtr driver,                                        bool refresh){    virCapsPtr ret = NULL;    if (refresh) {        virCapsPtr caps = NULL;        if ((caps = virQEMUDriverCreateCapabilities(driver)) == NULL)            return NULL;        qemuDriverLock(driver);        virObjectUnref(driver->caps);        driver->caps = caps;    } else {        qemuDriverLock(driver);    }    if (driver->caps->nguests == 0 && !refresh) {        VIR_DEBUG("Capabilities didn't detect any guests. Forcing a "            "refresh.");        qemuDriverUnlock(driver);        return virQEMUDriverGetCapabilities(driver, true);    }    ret = virObjectRef(driver->caps);    qemuDriverUnlock(driver);    return ret;}
开发者ID:candhare,项目名称:libvirt,代码行数:38,


示例16: virObjectEventStateFlush

static voidvirObjectEventStateFlush(virObjectEventStatePtr state){    virObjectEventQueue tempQueue;    /* We need to lock as well as ref due to the fact that we might     * unref the state we're working on in this very function */    virObjectRef(state);    virObjectLock(state);    state->isDispatching = true;    /* Copy the queue, so we're reentrant safe when dispatchFunc drops the     * driver lock */    tempQueue.count = state->queue->count;    tempQueue.events = state->queue->events;    state->queue->count = 0;    state->queue->events = NULL;    if (state->timer != -1)        virEventUpdateTimeout(state->timer, -1);    virObjectEventStateQueueDispatch(state,                                     &tempQueue,                                     state->callbacks);    /* Purge any deleted callbacks */    virObjectEventCallbackListPurgeMarked(state->callbacks);    /* If we purged all callbacks, we need to remove the timeout as     * well like virObjectEventStateDeregisterID() would do. */    virObjectEventStateCleanupTimer(state, true);    state->isDispatching = false;    virObjectUnlock(state);    virObjectUnref(state);}
开发者ID:libvirt,项目名称:libvirt,代码行数:35,


示例17: virQEMUDriverGetConfig

virQEMUDriverConfigPtr virQEMUDriverGetConfig(virQEMUDriverPtr driver){    virQEMUDriverConfigPtr conf;    qemuDriverLock(driver);    conf = virObjectRef(driver->config);    qemuDriverUnlock(driver);    return conf;}
开发者ID:Lantame,项目名称:libvirt,代码行数:8,


示例18: virLXCDriverGetConfig

virLXCDriverConfigPtr virLXCDriverGetConfig(virLXCDriverPtr driver){    virLXCDriverConfigPtr cfg;    lxcDriverLock(driver);    cfg = virObjectRef(driver->config);    lxcDriverUnlock(driver);    return cfg;}
开发者ID:Archer-sys,项目名称:libvirt,代码行数:8,


示例19: qemuBlockJobGetByDisk

qemuBlockJobDataPtrqemuBlockJobGetByDisk(virDomainDiskDefPtr disk){    qemuBlockJobDataPtr job = QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob;    if (!job)        return NULL;    return virObjectRef(job);}
开发者ID:olafhering,项目名称:libvirt,代码行数:10,


示例20: virIdentityGetCurrent

/** * virIdentityGetCurrent: * * Get the current identity associated with this thread. The * caller will own a reference to the returned identity, but * must not modify the object in any way, other than to * release the reference when done with virObjectUnref * * Returns: a reference to the current identity, or NULL */virIdentityPtr virIdentityGetCurrent(void){    virIdentityPtr ident;    if (virIdentityInitialize() < 0)        return NULL;    ident = virThreadLocalGet(&virIdentityCurrent);    return virObjectRef(ident);}
开发者ID:libvirt,项目名称:libvirt,代码行数:20,


示例21: libxlDriverConfigGet

libxlDriverConfigPtrlibxlDriverConfigGet(libxlDriverPrivatePtr driver){    libxlDriverConfigPtr cfg;    libxlDriverLock(driver);    cfg = virObjectRef(driver->config);    libxlDriverUnlock(driver);    return cfg;}
开发者ID:dmitryilyin,项目名称:libvirt,代码行数:10,


示例22: virSecretObjListFindByUUIDLocked

/** * virSecretObjFindByUUIDLocked: * @secrets: list of secret objects * @uuid: secret uuid to find * * This functions requires @secrets to be locked already! * * Returns: not locked, but ref'd secret object. */virSecretObjPtrvirSecretObjListFindByUUIDLocked(virSecretObjListPtr secrets,                                 const unsigned char *uuid){    char uuidstr[VIR_UUID_STRING_BUFLEN];    virUUIDFormat(uuid, uuidstr);    return virObjectRef(virHashLookup(secrets->objs, uuidstr));}
开发者ID:eskultety,项目名称:libvirt,代码行数:19,


示例23: virNetServerClientGetIdentity

virIdentityPtr virNetServerClientGetIdentity(virNetServerClientPtr client){    virIdentityPtr ret = NULL;    virObjectLock(client);    if (!client->identity)        client->identity = virNetServerClientCreateIdentity(client);    if (client->identity)        ret = virObjectRef(client->identity);    virObjectUnlock(client);    return ret;}
开发者ID:FrankYu,项目名称:libvirt,代码行数:11,


示例24: virNodeDeviceRef

/** * virNodeDeviceRef: * @dev: the dev to hold a reference on * * Increment the reference count on the dev. For each * additional call to this method, there shall be a corresponding * call to virNodeDeviceFree to release the reference count, once * the caller no longer needs the reference to this object. * * This method is typically useful for applications where multiple * threads are using a connection, and it is required that the * connection remain open until all threads have finished using * it. ie, each new thread using a dev would increment * the reference count. * * Returns 0 in case of success, -1 in case of failure. */intvirNodeDeviceRef(virNodeDevicePtr dev){    VIR_DEBUG("dev=%p refs=%d", dev, dev ? dev->object.u.s.refs : 0);    virResetLastError();    virCheckNodeDeviceReturn(dev, -1);    virObjectRef(dev);    return 0;}
开发者ID:xavierhardy,项目名称:libvirt,代码行数:29,


示例25: virNetServerClientSetSASLSession

void virNetServerClientSetSASLSession(virNetServerClientPtr client,                                      virNetSASLSessionPtr sasl){    /* We don't set the sasl session on the socket here     * because we need to send out the auth confirmation     * in the clear. Only once we complete the next 'tx'     * operation do we switch to SASL mode     */    virNetServerClientLock(client);    client->sasl = virObjectRef(sasl);    virNetServerClientUnlock(client);}
开发者ID:mohankku,项目名称:libvirt,代码行数:12,


示例26: virNetServerDispatchNewMessage

static int virNetServerDispatchNewMessage(virNetServerClientPtr client,        virNetMessagePtr msg,        void *opaque){    virNetServerPtr srv = opaque;    virNetServerProgramPtr prog = NULL;    unsigned int priority = 0;    size_t i;    int ret = -1;    VIR_DEBUG("server=%p client=%p message=%p",              srv, client, msg);    virObjectLock(srv);    for (i = 0 ; i < srv->nprograms ; i++) {        if (virNetServerProgramMatches(srv->programs[i], msg)) {            prog = srv->programs[i];            break;        }    }    if (srv->workers) {        virNetServerJobPtr job;        if (VIR_ALLOC(job) < 0) {            virReportOOMError();            goto cleanup;        }        job->client = client;        job->msg = msg;        if (prog) {            virObjectRef(prog);            job->prog = prog;            priority = virNetServerProgramGetPriority(prog, msg->header.proc);        }        ret = virThreadPoolSendJob(srv->workers, priority, job);        if (ret < 0) {            VIR_FREE(job);            virObjectUnref(prog);        }    } else {        ret = virNetServerProcessMsg(srv, client, prog, msg);    }cleanup:    virObjectUnlock(srv);    return ret;}
开发者ID:siboulet,项目名称:libvirt-openvz,代码行数:53,


示例27: virNetworkRef

/** * virNetworkRef: * @network: the network to hold a reference on * * Increment the reference count on the network. For each * additional call to this method, there shall be a corresponding * call to virNetworkFree to release the reference count, once * the caller no longer needs the reference to this object. * * This method is typically useful for applications where multiple * threads are using a connection, and it is required that the * connection remain open until all threads have finished using * it. ie, each new thread using a network would increment * the reference count. * * Returns 0 in case of success, -1 in case of failure. */intvirNetworkRef(virNetworkPtr network){    VIR_DEBUG("network=%p refs=%d", network,              network ? network->parent.u.s.refs : 0);    virResetLastError();    virCheckNetworkReturn(network, -1);    virObjectRef(network);    return 0;}
开发者ID:Antique,项目名称:libvirt,代码行数:30,


示例28: virAdmConnectRef

/** * virAdmConnectRef: * @conn: the connection to hold a reference on * * Increment the reference count on the connection. For each additional call to * this method, there shall be a corresponding call to virAdmConnectClose to * release the reference count, once the caller no longer needs the reference to * this object. * * This method is typically useful for applications where multiple threads are * using a connection, and it is required that the connection remain open until * all threads have finished using it. I.e., each new thread using a connection * would increment the reference count. * * Returns 0 in case of success, -1 in case of failure */intvirAdmConnectRef(virAdmConnectPtr conn){    VIR_DEBUG("conn=%p refs=%d", conn,              conn ? conn->object.parent.u.s.refs : 0);    virResetLastError();    virCheckAdmConnectReturn(conn, -1);    virObjectRef(conn);    return 0;}
开发者ID:joe-nas,项目名称:libvirt,代码行数:29,


示例29: virNetDaemonGetServerInternal

/* * Separate function merely for the purpose of unified error * reporting. */static virNetServerPtrvirNetDaemonGetServerInternal(virNetDaemonPtr dmn,                              int subServerID){    if (subServerID < 0 || subServerID >= dmn->nservers) {        virReportError(VIR_ERR_INVALID_ARG,                       _("Invalid server ID: %d"),                       subServerID);        return NULL;    }    return virObjectRef(dmn->servers[subServerID]);}
开发者ID:carriercomm,项目名称:libvirt,代码行数:17,


示例30: virDomainSnapshotRef

/** * virDomainSnapshotRef: * @snapshot: the snapshot to hold a reference on * * Increment the reference count on the snapshot. For each * additional call to this method, there shall be a corresponding * call to virDomainSnapshotFree to release the reference count, once * the caller no longer needs the reference to this object. * * This method is typically useful for applications where multiple * threads are using a connection, and it is required that the * connection and domain remain open until all threads have finished * using the snapshot. ie, each new thread using a snapshot would * increment the reference count. * * Returns 0 in case of success and -1 in case of failure. */intvirDomainSnapshotRef(virDomainSnapshotPtr snapshot){    VIR_DEBUG("snapshot=%p, refs=%d", snapshot,              snapshot ? snapshot->parent.u.s.refs : 0);    virResetLastError();    virCheckDomainSnapshotReturn(snapshot, -1);    virObjectRef(snapshot);    return 0;}
开发者ID:libvirt,项目名称:libvirt,代码行数:30,



注:本文中的virObjectRef函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ virObjectUnlock函数代码示例
C++ virMutexUnlock函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。