block.c (e012b78cf5bc42f20ef1a1f78383035f2293ceea) | block.c (0a82855a1a819f3de49781d42728f485fbd64284) |
---|---|
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 --- 289 unchanged lines hidden (view full) --- 298 if (len > dest_size - 1) 299 len = dest_size - 1; 300 memcpy(dest, base_path, len); 301 dest[len] = '\0'; 302 pstrcat(dest, dest_size, filename); 303 } 304} 305 | 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 --- 289 unchanged lines hidden (view full) --- 298 if (len > dest_size - 1) 299 len = dest_size - 1; 300 memcpy(dest, base_path, len); 301 dest[len] = '\0'; 302 pstrcat(dest, dest_size, filename); 303 } 304} 305 |
306void bdrv_get_full_backing_filename(BlockDriverState *bs, char *dest, size_t sz) | 306void bdrv_get_full_backing_filename_from_filename(const char *backed, 307 const char *backing, 308 char *dest, size_t sz) |
307{ | 309{ |
308 if (bs->backing_file[0] == '\0' || path_has_protocol(bs->backing_file)) { 309 pstrcpy(dest, sz, bs->backing_file); | 310 if (backing[0] == '\0' || path_has_protocol(backing)) { 311 pstrcpy(dest, sz, backing); |
310 } else { | 312 } else { |
311 path_combine(dest, sz, bs->filename, bs->backing_file); | 313 path_combine(dest, sz, backed, backing); |
312 } 313} 314 | 314 } 315} 316 |
317void bdrv_get_full_backing_filename(BlockDriverState *bs, char *dest, size_t sz) 318{ 319 bdrv_get_full_backing_filename_from_filename(bs->filename, bs->backing_file, 320 dest, sz); 321} 322 |
|
315void bdrv_register(BlockDriver *bdrv) 316{ 317 /* Block drivers without coroutine functions need emulation */ 318 if (!bdrv->bdrv_co_readv) { 319 bdrv->bdrv_co_readv = bdrv_co_readv_em; 320 bdrv->bdrv_co_writev = bdrv_co_writev_em; 321 322 /* bdrv_co_readv_em()/brdv_co_writev_em() work in terms of aio, so if --- 5764 unchanged lines hidden --- | 323void bdrv_register(BlockDriver *bdrv) 324{ 325 /* Block drivers without coroutine functions need emulation */ 326 if (!bdrv->bdrv_co_readv) { 327 bdrv->bdrv_co_readv = bdrv_co_readv_em; 328 bdrv->bdrv_co_writev = bdrv_co_writev_em; 329 330 /* bdrv_co_readv_em()/brdv_co_writev_em() work in terms of aio, so if --- 5764 unchanged lines hidden --- |