static int gather_storage_cap(LibHalContext *ctx, const char *udi, union _virNodeDevCapData *d) { int val; (void)get_str_prop(ctx, udi, "block.device", &d->storage.block); (void)get_str_prop(ctx, udi, "storage.bus", &d->storage.bus); (void)get_str_prop(ctx, udi, "storage.drive_type", &d->storage.drive_type); (void)get_str_prop(ctx, udi, "storage.model", &d->storage.model); (void)get_str_prop(ctx, udi, "storage.vendor", &d->storage.vendor); (void)get_str_prop(ctx, udi, "storage.serial", &d->storage.serial); if (get_bool_prop(ctx, udi, "storage.removable", &val) == 0 && val) { d->storage.flags |= VIR_NODE_DEV_CAP_STORAGE_REMOVABLE; if (get_bool_prop(ctx, udi, "storage.removable.media_available", &val) == 0 && val) { d->storage.flags |= VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE; (void)get_uint64_prop(ctx, udi, "storage.removable.media_size", &d->storage.removable_media_size); } } else { (void)get_uint64_prop(ctx, udi, "storage.size", &d->storage.size); } if (get_bool_prop(ctx, udi, "storage.hotpluggable", &val) == 0 && val) d->storage.flags |= VIR_NODE_DEV_CAP_STORAGE_HOTPLUGGABLE; return 0; }
static int gather_net_cap(LibHalContext *ctx, const char *udi, union _virNodeDevCapData *d) { unsigned long long dummy; (void)get_str_prop(ctx, udi, "net.interface", &d->net.ifname); (void)get_str_prop(ctx, udi, "net.address", &d->net.address); if (get_uint64_prop(ctx, udi, "net.80203.mac_address", &dummy) == 0) d->net.subtype = VIR_NODE_DEV_CAP_NET_80203; else if (get_uint64_prop(ctx, udi, "net.80211.mac_address", &dummy) == 0) d->net.subtype = VIR_NODE_DEV_CAP_NET_80211; else d->net.subtype = VIR_NODE_DEV_CAP_NET_LAST; return 0; }