file-win32.c (fcb7e040f5c69ca1f0678f991ab5354488a9e192) file-win32.c (c86422c5549c0983b4b4525b8f56a1c69dd67aa1)
1/*
2 * Block driver for RAW files (win32)
3 *
4 * Copyright (c) 2006 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

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

521 }
522 if (SetEndOfFile(s->hfile) == 0) {
523 error_setg_win32(errp, GetLastError(), "SetEndOfFile error");
524 return -EIO;
525 }
526 return 0;
527}
528
1/*
2 * Block driver for RAW files (win32)
3 *
4 * Copyright (c) 2006 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

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

521 }
522 if (SetEndOfFile(s->hfile) == 0) {
523 error_setg_win32(errp, GetLastError(), "SetEndOfFile error");
524 return -EIO;
525 }
526 return 0;
527}
528
529static int64_t raw_getlength(BlockDriverState *bs)
529static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs)
530{
531 BDRVRawState *s = bs->opaque;
532 LARGE_INTEGER l;
533 ULARGE_INTEGER available, total, total_free;
534 DISK_GEOMETRY_EX dg;
535 DWORD count;
536 BOOL status;
537

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

759 .bdrv_reopen_commit = raw_reopen_commit,
760 .bdrv_reopen_abort = raw_reopen_abort,
761
762 .bdrv_aio_preadv = raw_aio_preadv,
763 .bdrv_aio_pwritev = raw_aio_pwritev,
764 .bdrv_aio_flush = raw_aio_flush,
765
766 .bdrv_co_truncate = raw_co_truncate,
530{
531 BDRVRawState *s = bs->opaque;
532 LARGE_INTEGER l;
533 ULARGE_INTEGER available, total, total_free;
534 DISK_GEOMETRY_EX dg;
535 DWORD count;
536 BOOL status;
537

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

759 .bdrv_reopen_commit = raw_reopen_commit,
760 .bdrv_reopen_abort = raw_reopen_abort,
761
762 .bdrv_aio_preadv = raw_aio_preadv,
763 .bdrv_aio_pwritev = raw_aio_pwritev,
764 .bdrv_aio_flush = raw_aio_flush,
765
766 .bdrv_co_truncate = raw_co_truncate,
767 .bdrv_getlength = raw_getlength,
767 .bdrv_co_getlength = raw_co_getlength,
768 .bdrv_get_allocated_file_size
769 = raw_get_allocated_file_size,
770
771 .create_opts = &raw_create_opts,
772};
773
774/***********************************************/
775/* host device */

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

928
929 .bdrv_aio_preadv = raw_aio_preadv,
930 .bdrv_aio_pwritev = raw_aio_pwritev,
931 .bdrv_aio_flush = raw_aio_flush,
932
933 .bdrv_detach_aio_context = raw_detach_aio_context,
934 .bdrv_attach_aio_context = raw_attach_aio_context,
935
768 .bdrv_get_allocated_file_size
769 = raw_get_allocated_file_size,
770
771 .create_opts = &raw_create_opts,
772};
773
774/***********************************************/
775/* host device */

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

928
929 .bdrv_aio_preadv = raw_aio_preadv,
930 .bdrv_aio_pwritev = raw_aio_pwritev,
931 .bdrv_aio_flush = raw_aio_flush,
932
933 .bdrv_detach_aio_context = raw_detach_aio_context,
934 .bdrv_attach_aio_context = raw_attach_aio_context,
935
936 .bdrv_getlength = raw_getlength,
937 .has_variable_length = true,
936 .bdrv_co_getlength = raw_co_getlength,
937 .has_variable_length = true,
938
939 .bdrv_get_allocated_file_size
940 = raw_get_allocated_file_size,
941};
942
943static void bdrv_file_init(void)
944{
945 bdrv_register(&bdrv_file);
946 bdrv_register(&bdrv_host_device);
947}
948
949block_init(bdrv_file_init);
938
939 .bdrv_get_allocated_file_size
940 = raw_get_allocated_file_size,
941};
942
943static void bdrv_file_init(void)
944{
945 bdrv_register(&bdrv_file);
946 bdrv_register(&bdrv_host_device);
947}
948
949block_init(bdrv_file_init);