Revision 39508e7a
b/block.c | ||
---|---|---|
288 | 288 |
char protocol[128]; |
289 | 289 |
int len; |
290 | 290 |
const char *p; |
291 |
int is_drive; |
|
292 | 291 |
|
293 | 292 |
/* TODO Drivers without bdrv_file_open must be specified explicitly */ |
294 | 293 |
|
294 |
/* |
|
295 |
* XXX(hch): we really should not let host device detection |
|
296 |
* override an explicit protocol specification, but moving this |
|
297 |
* later breaks access to device names with colons in them. |
|
298 |
* Thanks to the brain-dead persistent naming schemes on udev- |
|
299 |
* based Linux systems those actually are quite common. |
|
300 |
*/ |
|
301 |
drv1 = find_hdev_driver(filename); |
|
302 |
if (drv1) { |
|
303 |
return drv1; |
|
304 |
} |
|
305 |
|
|
295 | 306 |
#ifdef _WIN32 |
296 |
is_drive = is_windows_drive(filename) || |
|
297 |
is_windows_drive_prefix(filename); |
|
298 |
#else |
|
299 |
is_drive = 0; |
|
307 |
if (is_windows_drive(filename) || |
|
308 |
is_windows_drive_prefix(filename)) |
|
309 |
return bdrv_find_format("file"); |
|
300 | 310 |
#endif |
311 |
|
|
301 | 312 |
p = strchr(filename, ':'); |
302 |
if (!p || is_drive) { |
|
303 |
drv1 = find_hdev_driver(filename); |
|
304 |
if (!drv1) { |
|
305 |
drv1 = bdrv_find_format("file"); |
|
306 |
} |
|
307 |
return drv1; |
|
313 |
if (!p) { |
|
314 |
return bdrv_find_format("file"); |
|
308 | 315 |
} |
309 | 316 |
len = p - filename; |
310 | 317 |
if (len > sizeof(protocol) - 1) |
Also available in: Unified diff