Revision 036f7166

b/hw/qdev-properties.c
402 402

  
403 403
/* --- pointer --- */
404 404

  
405
static int print_ptr(DeviceState *dev, Property *prop, char *dest, size_t len)
406
{
407
    void **ptr = qdev_get_prop_ptr(dev, prop);
408
    return snprintf(dest, len, "<%p>", *ptr);
409
}
410

  
405
/* Not a proper property, just for dirty hacks.  TODO Remove it!  */
411 406
PropertyInfo qdev_prop_ptr = {
412 407
    .name  = "ptr",
413 408
    .type  = PROP_TYPE_PTR,
414 409
    .size  = sizeof(void*),
415
    .print = print_ptr,
416 410
};
417 411

  
418 412
/* --- mac address --- */
......
547 541
    int ret;
548 542

  
549 543
    prop = qdev_prop_find(dev, name);
550
    if (!prop) {
544
    /*
545
     * TODO Properties without a parse method are just for dirty
546
     * hacks.  qdev_prop_ptr is the only such PropertyInfo.  It's
547
     * marked for removal.  The test !prop->info->parse should be
548
     * removed along with it.
549
     */
550
    if (!prop || !prop->info->parse) {
551 551
        fprintf(stderr, "property \"%s.%s\" not found\n",
552 552
                dev->info->name, name);
553 553
        return -1;
554 554
    }
555
    if (!prop->info->parse) {
556
        fprintf(stderr, "property \"%s.%s\" has no parser\n",
557
                dev->info->name, name);
558
        return -1;
559
    }
560 555
    ret = prop->info->parse(dev, prop, value);
561 556
    if (ret < 0) {
562 557
        switch (ret) {
b/hw/qdev.c
180 180
    }
181 181

  
182 182
    for (prop = info->props; prop && prop->name; prop++) {
183
        /*
184
         * TODO Properties without a parser are just for dirty hacks.
185
         * qdev_prop_ptr is the only such PropertyInfo.  It's marked
186
         * for removal.  This conditional should be removed along with
187
         * it.
188
         */
189
        if (!prop->info->parse) {
190
            continue;           /* no way to set it, don't show */
191
        }
183 192
        error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
184 193
    }
185 194
    return 1;
......
682 691
    if (!props)
683 692
        return;
684 693
    while (props->name) {
694
        /*
695
         * TODO Properties without a print method are just for dirty
696
         * hacks.  qdev_prop_ptr is the only such PropertyInfo.  It's
697
         * marked for removal.  The test props->info->print should be
698
         * removed along with it.
699
         */
685 700
        if (props->info->print) {
686 701
            props->info->print(dev, props, buf, sizeof(buf));
687 702
            qdev_printf("%s-prop: %s = %s\n", prefix, props->name, buf);

Also available in: Unified diff