block.c (c13163fba151f0be5176eaf55907bc1dbff3a1d4) block.c (12d3ba821da9f8a039240a8a1bc01e27a12f9c22)
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 3295 unchanged lines hidden (view full) ---

3304 entry->value = bdrv_block_device_info(bs);
3305 entry->next = list;
3306 list = entry;
3307 }
3308
3309 return list;
3310}
3311
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 3295 unchanged lines hidden (view full) ---

3304 entry->value = bdrv_block_device_info(bs);
3305 entry->next = list;
3306 list = entry;
3307 }
3308
3309 return list;
3310}
3311
3312BlockDriverState *bdrv_lookup_bs(const char *device,
3313 const char *node_name,
3314 Error **errp)
3315{
3316 BlockDriverState *bs = NULL;
3317
3318 if ((!device && !node_name) || (device && node_name)) {
3319 error_setg(errp, "Use either device or node-name but not both");
3320 return NULL;
3321 }
3322
3323 if (device) {
3324 bs = bdrv_find(device);
3325
3326 if (!bs) {
3327 error_set(errp, QERR_DEVICE_NOT_FOUND, device);
3328 return NULL;
3329 }
3330
3331 return bs;
3332 }
3333
3334 bs = bdrv_find_node(node_name);
3335
3336 if (!bs) {
3337 error_set(errp, QERR_DEVICE_NOT_FOUND, node_name);
3338 return NULL;
3339 }
3340
3341 return bs;
3342}
3343
3312BlockDriverState *bdrv_next(BlockDriverState *bs)
3313{
3314 if (!bs) {
3315 return QTAILQ_FIRST(&bdrv_states);
3316 }
3317 return QTAILQ_NEXT(bs, device_list);
3318}
3319

--- 1763 unchanged lines hidden ---
3344BlockDriverState *bdrv_next(BlockDriverState *bs)
3345{
3346 if (!bs) {
3347 return QTAILQ_FIRST(&bdrv_states);
3348 }
3349 return QTAILQ_NEXT(bs, device_list);
3350}
3351

--- 1763 unchanged lines hidden ---