block.c (3b0d4f61c917c4612b561d75b33a11f4da00738b) | block.c (79639d423f779e65f24d0fcc05b14d6c45b4a894) |
---|---|
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 --- 430 unchanged lines hidden (view full) --- 439/* return -1 if error */ 440int bdrv_write(BlockDriverState *bs, int64_t sector_num, 441 const uint8_t *buf, int nb_sectors) 442{ 443 if (!bs->inserted) 444 return -1; 445 if (bs->read_only) 446 return -1; | 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 --- 430 unchanged lines hidden (view full) --- 439/* return -1 if error */ 440int bdrv_write(BlockDriverState *bs, int64_t sector_num, 441 const uint8_t *buf, int nb_sectors) 442{ 443 if (!bs->inserted) 444 return -1; 445 if (bs->read_only) 446 return -1; |
447 if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { 448 memcpy(bs->boot_sector_data, buf, 512); 449 } |
|
447 return bs->drv->bdrv_write(bs, sector_num, buf, nb_sectors); 448} 449 450void bdrv_get_geometry(BlockDriverState *bs, int64_t *nb_sectors_ptr) 451{ 452 *nb_sectors_ptr = bs->total_sectors; 453} 454 --- 312 unchanged lines hidden --- | 450 return bs->drv->bdrv_write(bs, sector_num, buf, nb_sectors); 451} 452 453void bdrv_get_geometry(BlockDriverState *bs, int64_t *nb_sectors_ptr) 454{ 455 *nb_sectors_ptr = bs->total_sectors; 456} 457 --- 312 unchanged lines hidden --- |