本文整理汇总了C++中qdev_get_prop_ptr函数的典型用法代码示例。如果您正苦于以下问题:C++ qdev_get_prop_ptr函数的具体用法?C++ qdev_get_prop_ptr怎么用?C++ qdev_get_prop_ptr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qdev_get_prop_ptr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: set_uint64
static void set_uint64(Object *obj, Visitor *v, void *opaque,
const char *name, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
if (dev->realized) {
error_set(errp, QERR_PERMISSION_DENIED);
return;
}
visit_type_uint64(v, ptr, name, errp);
}
开发者ID:Blopeur,项目名称:qemu-heca,代码行数:14,代码来源:qdev-properties.c
示例2: set_enum
static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
int *ptr = qdev_get_prop_ptr(dev, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
return;
}
visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp);
}
开发者ID:JMR-b,项目名称:qemu,代码行数:14,代码来源:qdev-properties.c
示例3: get_string
static void get_string(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
char **ptr = qdev_get_prop_ptr(dev, prop);
if (!*ptr) {
char *str = (char *)"";
visit_type_str(v, name, &str, errp);
} else {
visit_type_str(v, name, ptr, errp);
}
}
开发者ID:JMR-b,项目名称:qemu,代码行数:14,代码来源:qdev-properties.c
示例4: set_int32
static void set_int32(Object *obj, Visitor *v, void *opaque,
const char *name, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
int32_t *ptr = qdev_get_prop_ptr(dev, prop);
if (dev->state != DEV_STATE_CREATED) {
error_set(errp, QERR_PERMISSION_DENIED);
return;
}
visit_type_int32(v, ptr, name, errp);
}
开发者ID:D3cedut0,项目名称:QEMU,代码行数:14,代码来源:qdev-properties.c
示例5: set_uint32
static void set_uint32(Object *obj, Visitor *v, void *opaque,
const char *name, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
return;
}
visit_type_uint32(v, ptr, name, errp);
}
开发者ID:AdrianHuang,项目名称:qemu,代码行数:14,代码来源:qdev-properties.c
示例6: get_mac
/*
* accepted syntax versions:
* 01:02:03:04:05:06
* 01-02-03-04-05-06
*/
static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
MACAddr *mac = qdev_get_prop_ptr(dev, prop);
char buffer[2 * 6 + 5 + 1];
char *p = buffer;
snprintf(buffer, sizeof(buffer), "%02x:%02x:%02x:%02x:%02x:%02x",
mac->a[0], mac->a[1], mac->a[2],
mac->a[3], mac->a[4], mac->a[5]);
visit_type_str(v, name, &p, errp);
}
开发者ID:GamerSource,项目名称:qemu,代码行数:20,代码来源:qdev-properties.c
示例7: release_drive
static void release_drive(Object *obj, const char *name, void *opaque)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
BlockBackend **ptr = qdev_get_prop_ptr(dev, prop);
if (*ptr) {
AioContext *ctx = blk_get_aio_context(*ptr);
aio_context_acquire(ctx);
blockdev_auto_del(*ptr);
blk_detach_dev(*ptr, dev);
aio_context_release(ctx);
}
}
开发者ID:artyom-tarasenko,项目名称:qemu,代码行数:15,代码来源:qdev-properties-system.c
示例8: set_pci_devfn
/*
* bus-local address, i.e. "$slot" or "$slot.$fn"
*/
static void set_pci_devfn(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
int32_t value, *ptr = qdev_get_prop_ptr(dev, prop);
unsigned int slot, fn, n;
Error *local_err = NULL;
char *str;
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
return;
}
visit_type_str(v, name, &str, &local_err);
if (local_err) {
error_free(local_err);
local_err = NULL;
visit_type_int32(v, name, &value, &local_err);
if (local_err) {
error_propagate(errp, local_err);
} else if (value < -1 || value > 255) {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
name ? name : "null", "pci_devfn");
} else {
*ptr = value;
}
return;
}
if (sscanf(str, "%x.%x%n", &slot, &fn, &n) != 2) {
fn = 0;
if (sscanf(str, "%x%n", &slot, &n) != 1) {
goto invalid;
}
}
if (str[n] != '\0' || fn > 7 || slot > 31) {
goto invalid;
}
*ptr = slot << 3 | fn;
g_free(str);
return;
invalid:
error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
g_free(str);
}
开发者ID:GamerSource,项目名称:qemu,代码行数:51,代码来源:qdev-properties.c
示例9: parse_hex64
static int parse_hex64(DeviceState *dev, Property *prop, const char *str)
{
uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
char *end;
if (str[0] != '0' || str[1] != 'x') {
return -EINVAL;
}
*ptr = strtoull(str, &end, 16);
if ((*end != '\0') || (end == str)) {
return -EINVAL;
}
return 0;
}
开发者ID:breuerr,项目名称:qemu,代码行数:16,代码来源:qdev-properties.c
示例10: set_mac
static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
MACAddr *mac = qdev_get_prop_ptr(dev, prop);
Error *local_err = NULL;
int i, pos;
char *str, *p;
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
return;
}
visit_type_str(v, name, &str, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
for (i = 0, pos = 0; i < 6; i++, pos += 3) {
if (!qemu_isxdigit(str[pos])) {
goto inval;
}
if (!qemu_isxdigit(str[pos+1])) {
goto inval;
}
if (i == 5) {
if (str[pos+2] != '\0') {
goto inval;
}
} else {
if (str[pos+2] != ':' && str[pos+2] != '-') {
goto inval;
}
}
mac->a[i] = strtol(str+pos, &p, 16);
}
g_free(str);
return;
inval:
error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
g_free(str);
}
开发者ID:GamerSource,项目名称:qemu,代码行数:46,代码来源:qdev-properties.c
示例11: get_vlan
static void get_vlan(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
NetClientState **ptr = qdev_get_prop_ptr(dev, prop);
int32_t id = -1;
if (*ptr) {
int hub_id;
if (!net_hub_id_for_client(*ptr, &hub_id)) {
id = hub_id;
}
}
visit_type_int32(v, name, &id, errp);
}
开发者ID:AmesianX,项目名称:panda,代码行数:17,代码来源:qdev-properties-system.c
示例12: parse_pci_devfn
/*
* bus-local address, i.e. "$slot" or "$slot.$fn"
*/
static int parse_pci_devfn(DeviceState *dev, Property *prop, const char *str)
{
uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
unsigned int slot, fn, n;
if (sscanf(str, "%x.%x%n", &slot, &fn, &n) != 2) {
fn = 0;
if (sscanf(str, "%x%n", &slot, &n) != 1) {
return -EINVAL;
}
}
if (str[n] != '\0')
return -EINVAL;
if (fn > 7)
return -EINVAL;
if (slot > 31)
return -EINVAL;
*ptr = slot << 3 | fn;
return 0;
}
开发者ID:ddk50,项目名称:qemu-qcas,代码行数:23,代码来源:qdev-properties.c
示例13: set_mac
static void set_mac(Object *obj, Visitor *v, void *opaque,
const char *name, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
MACAddr *mac = qdev_get_prop_ptr(dev, prop);
Error *local_err = NULL;
int i, pos;
char *str, *p;
if (dev->state != DEV_STATE_CREATED) {
error_set(errp, QERR_PERMISSION_DENIED);
return;
}
visit_type_str(v, &str, name, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
for (i = 0, pos = 0; i < 6; i++, pos += 3) {
if (!qemu_isxdigit(str[pos]))
goto inval;
if (!qemu_isxdigit(str[pos+1]))
goto inval;
if (i == 5) {
if (str[pos+2] != '\0')
goto inval;
} else {
if (str[pos+2] != ':' && str[pos+2] != '-')
goto inval;
}
mac->a[i] = strtol(str+pos, &p, 16);
}
return;
inval:
error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
}
开发者ID:breuerr,项目名称:qemu,代码行数:40,代码来源:qdev-properties.c
示例14: set_string
static void set_string(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
char **ptr = qdev_get_prop_ptr(dev, prop);
Error *local_err = NULL;
char *str;
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
return;
}
visit_type_str(v, name, &str, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
g_free(*ptr);
*ptr = str;
}
开发者ID:GamerSource,项目名称:qemu,代码行数:22,代码来源:qdev-properties.c
示例15: parse_mac
/*
* accepted syntax versions:
* 01:02:03:04:05:06
* 01-02-03-04-05-06
*/
static int parse_mac(DeviceState *dev, Property *prop, const char *str)
{
MACAddr *mac = qdev_get_prop_ptr(dev, prop);
int i, pos;
char *p;
for (i = 0, pos = 0; i < 6; i++, pos += 3) {
if (!qemu_isxdigit(str[pos]))
return -EINVAL;
if (!qemu_isxdigit(str[pos+1]))
return -EINVAL;
if (i == 5) {
if (str[pos+2] != '\0')
return -EINVAL;
} else {
if (str[pos+2] != ':' && str[pos+2] != '-')
return -EINVAL;
}
mac->a[i] = strtol(str+pos, &p, 16);
}
return 0;
}
开发者ID:ddk50,项目名称:qemu-qcas,代码行数:27,代码来源:qdev-properties.c
示例16: set_vlan
static void set_vlan(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop);
NetClientState **ptr = &peers_ptr->ncs[0];
Error *local_err = NULL;
int32_t id;
NetClientState *hubport;
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
return;
}
visit_type_int32(v, name, &id, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
if (id == -1) {
*ptr = NULL;
return;
}
if (*ptr) {
error_set_from_qdev_prop_error(errp, -EINVAL, dev, prop, name);
return;
}
hubport = net_hub_port_find(id);
if (!hubport) {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
name, prop->info->name);
return;
}
*ptr = hubport;
}
开发者ID:AmesianX,项目名称:panda,代码行数:38,代码来源:qdev-properties-system.c
示例17: set_chr
static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
DeviceState *dev = DEVICE(obj);
Error *local_err = NULL;
Property *prop = opaque;
CharBackend *be = qdev_get_prop_ptr(dev, prop);
CharDriverState *s;
char *str;
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
return;
}
visit_type_str(v, name, &str, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
if (!*str) {
g_free(str);
be->chr = NULL;
return;
}
s = qemu_chr_find(str);
if (s == NULL) {
error_setg(errp, "Property '%s.%s' can't find value '%s'",
object_get_typename(obj), prop->name, str);
} else if (!qemu_chr_fe_init(be, s, errp)) {
error_prepend(errp, "Property '%s.%s' can't take value '%s': ",
object_get_typename(obj), prop->name, str);
}
g_free(str);
}
开发者ID:AmesianX,项目名称:panda,代码行数:37,代码来源:qdev-properties-system.c
示例18: set_string
static void set_string(Object *obj, Visitor *v, void *opaque,
const char *name, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
char **ptr = qdev_get_prop_ptr(dev, prop);
Error *local_err = NULL;
char *str;
if (dev->state != DEV_STATE_CREATED) {
error_set(errp, QERR_PERMISSION_DENIED);
return;
}
visit_type_str(v, &str, name, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
if (*ptr) {
g_free(*ptr);
}
*ptr = str;
}
开发者ID:breuerr,项目名称:qemu,代码行数:24,代码来源:qdev-properties.c
示例19: set_netdev
static void set_netdev(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop);
NetClientState **ncs = peers_ptr->ncs;
NetClientState *peers[MAX_QUEUE_NUM];
Error *local_err = NULL;
int queues, err = 0, i = 0;
char *str;
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
return;
}
visit_type_str(v, name, &str, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
queues = qemu_find_net_clients_except(str, peers,
NET_CLIENT_DRIVER_NIC,
MAX_QUEUE_NUM);
if (queues == 0) {
err = -ENOENT;
goto out;
}
if (queues > MAX_QUEUE_NUM) {
error_setg(errp, "queues of backend '%s'(%d) exceeds QEMU limitation(%d)",
str, queues, MAX_QUEUE_NUM);
goto out;
}
for (i = 0; i < queues; i++) {
if (peers[i] == NULL) {
err = -ENOENT;
goto out;
}
if (peers[i]->peer) {
err = -EEXIST;
goto out;
}
if (ncs[i]) {
err = -EINVAL;
goto out;
}
ncs[i] = peers[i];
ncs[i]->queue_index = i;
}
peers_ptr->queues = queues;
out:
error_set_from_qdev_prop_error(errp, err, dev, prop, str);
g_free(str);
}
开发者ID:AmesianX,项目名称:panda,代码行数:63,代码来源:qdev-properties-system.c
示例20: print_uint16
static int print_uint16(DeviceState *dev, Property *prop, char *dest, size_t len)
{
uint16_t *ptr = qdev_get_prop_ptr(dev, prop);
return snprintf(dest, len, "%" PRIu16, *ptr);
}
开发者ID:ddk50,项目名称:qemu-qcas,代码行数:5,代码来源:qdev-properties.c
注:本文中的qdev_get_prop_ptr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论