block.c (5098699a51756f7e8934dc035112c8f8aa2a0ec3) block.c (cf8074b3825f7229a20c60e679511592bde41340)
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

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

3179 return -ENOTSUP;
3180 memset(bdi, 0, sizeof(*bdi));
3181 return drv->bdrv_get_info(bs, bdi);
3182}
3183
3184int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
3185 int64_t pos, int size)
3186{
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

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

3179 return -ENOTSUP;
3180 memset(bdi, 0, sizeof(*bdi));
3181 return drv->bdrv_get_info(bs, bdi);
3182}
3183
3184int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
3185 int64_t pos, int size)
3186{
3187 QEMUIOVector qiov;
3188 struct iovec iov = {
3189 .iov_base = (void *) buf,
3190 .iov_len = size,
3191 };
3192
3193 qemu_iovec_init_external(&qiov, &iov, 1);
3194 return bdrv_writev_vmstate(bs, &qiov, pos);
3195}
3196
3197int bdrv_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos)
3198{
3187 BlockDriver *drv = bs->drv;
3199 BlockDriver *drv = bs->drv;
3188 if (!drv)
3200
3201 if (!drv) {
3189 return -ENOMEDIUM;
3202 return -ENOMEDIUM;
3190 if (drv->bdrv_save_vmstate)
3191 return drv->bdrv_save_vmstate(bs, buf, pos, size);
3192 if (bs->file)
3193 return bdrv_save_vmstate(bs->file, buf, pos, size);
3203 } else if (drv->bdrv_save_vmstate) {
3204 return drv->bdrv_save_vmstate(bs, qiov, pos);
3205 } else if (bs->file) {
3206 return bdrv_writev_vmstate(bs->file, qiov, pos);
3207 }
3208
3194 return -ENOTSUP;
3195}
3196
3197int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf,
3198 int64_t pos, int size)
3199{
3200 BlockDriver *drv = bs->drv;
3201 if (!drv)

--- 1582 unchanged lines hidden ---
3209 return -ENOTSUP;
3210}
3211
3212int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf,
3213 int64_t pos, int size)
3214{
3215 BlockDriver *drv = bs->drv;
3216 if (!drv)

--- 1582 unchanged lines hidden ---