block.c (5447a9afc4150693d3909a8632891061147e170d) | block.c (74fe54f2a1b5c4f4498a8fe521e1dfc936656cd4) |
---|---|
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 --- 956 unchanged lines hidden (view full) --- 965int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, 966 int flags, BlockDriver *drv) 967{ 968 int ret; 969 /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ 970 char tmp_filename[PATH_MAX + 1]; 971 BlockDriverState *file = NULL; 972 QDict *file_options = NULL; | 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 --- 956 unchanged lines hidden (view full) --- 965int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, 966 int flags, BlockDriver *drv) 967{ 968 int ret; 969 /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ 970 char tmp_filename[PATH_MAX + 1]; 971 BlockDriverState *file = NULL; 972 QDict *file_options = NULL; |
973 const char *drvname; |
|
973 974 /* NULL means an empty set of options */ 975 if (options == NULL) { 976 options = qdict_new(); 977 } 978 979 bs->options = options; 980 options = qdict_clone_shallow(options); --- 73 unchanged lines hidden (view full) --- 1054 1055 ret = bdrv_file_open(&file, filename, file_options, 1056 bdrv_open_flags(bs, flags | BDRV_O_UNMAP)); 1057 if (ret < 0) { 1058 goto fail; 1059 } 1060 1061 /* Find the right image format driver */ | 974 975 /* NULL means an empty set of options */ 976 if (options == NULL) { 977 options = qdict_new(); 978 } 979 980 bs->options = options; 981 options = qdict_clone_shallow(options); --- 73 unchanged lines hidden (view full) --- 1055 1056 ret = bdrv_file_open(&file, filename, file_options, 1057 bdrv_open_flags(bs, flags | BDRV_O_UNMAP)); 1058 if (ret < 0) { 1059 goto fail; 1060 } 1061 1062 /* Find the right image format driver */ |
1063 drvname = qdict_get_try_str(options, "driver"); 1064 if (drvname) { 1065 drv = bdrv_find_whitelisted_format(drvname, !(flags & BDRV_O_RDWR)); 1066 qdict_del(options, "driver"); 1067 } 1068 |
|
1062 if (!drv) { 1063 ret = find_image_format(file, filename, &drv); 1064 } 1065 1066 if (!drv) { 1067 goto unlink_and_fail; 1068 } 1069 --- 3546 unchanged lines hidden --- | 1069 if (!drv) { 1070 ret = find_image_format(file, filename, &drv); 1071 } 1072 1073 if (!drv) { 1074 goto unlink_and_fail; 1075 } 1076 --- 3546 unchanged lines hidden --- |