block.c (e1e9b0aca05747be9e2174a53205bd904c10da49) block.c (f8d6bba1c1f56217d9ee71b7aee5f94f46c8f148)
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

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

1030 /* keep the same entry in bdrv_states */
1031 pstrcpy(tmp.device_name, sizeof(tmp.device_name), bs_top->device_name);
1032 tmp.list = bs_top->list;
1033
1034 /* The contents of 'tmp' will become bs_top, as we are
1035 * swapping bs_new and bs_top contents. */
1036 tmp.backing_hd = bs_new;
1037 pstrcpy(tmp.backing_file, sizeof(tmp.backing_file), bs_top->filename);
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

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

1030 /* keep the same entry in bdrv_states */
1031 pstrcpy(tmp.device_name, sizeof(tmp.device_name), bs_top->device_name);
1032 tmp.list = bs_top->list;
1033
1034 /* The contents of 'tmp' will become bs_top, as we are
1035 * swapping bs_new and bs_top contents. */
1036 tmp.backing_hd = bs_new;
1037 pstrcpy(tmp.backing_file, sizeof(tmp.backing_file), bs_top->filename);
1038 bdrv_get_format(bs_top, tmp.backing_format, sizeof(tmp.backing_format));
1038 pstrcpy(tmp.backing_format, sizeof(tmp.backing_format),
1039 bs_top->drv ? bs_top->drv->format_name : "");
1039
1040 /* swap contents of the fixed new bs and the current top */
1041 *bs_new = *bs_top;
1042 *bs_top = tmp;
1043
1044 /* device_name[] was carried over from the old bs_top. bs_new
1045 * shouldn't be in bdrv_states, so we need to make device_name[]
1046 * reflect the anonymity of bs_new

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

2423 } else if (!bs->valid_key) {
2424 bs->valid_key = 1;
2425 /* call the change callback now, we skipped it on open */
2426 bdrv_dev_change_media_cb(bs, true);
2427 }
2428 return ret;
2429}
2430
1040
1041 /* swap contents of the fixed new bs and the current top */
1042 *bs_new = *bs_top;
1043 *bs_top = tmp;
1044
1045 /* device_name[] was carried over from the old bs_top. bs_new
1046 * shouldn't be in bdrv_states, so we need to make device_name[]
1047 * reflect the anonymity of bs_new

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

2424 } else if (!bs->valid_key) {
2425 bs->valid_key = 1;
2426 /* call the change callback now, we skipped it on open */
2427 bdrv_dev_change_media_cb(bs, true);
2428 }
2429 return ret;
2430}
2431
2431void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size)
2432const char *bdrv_get_format_name(BlockDriverState *bs)
2432{
2433{
2433 if (!bs->drv) {
2434 buf[0] = '\0';
2435 } else {
2436 pstrcpy(buf, buf_size, bs->drv->format_name);
2437 }
2434 return bs->drv ? bs->drv->format_name : NULL;
2438}
2439
2440void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
2441 void *opaque)
2442{
2443 BlockDriver *drv;
2444
2445 QLIST_FOREACH(drv, &bdrv_drivers, list) {

--- 1934 unchanged lines hidden ---
2435}
2436
2437void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
2438 void *opaque)
2439{
2440 BlockDriver *drv;
2441
2442 QLIST_FOREACH(drv, &bdrv_drivers, list) {

--- 1934 unchanged lines hidden ---