file-posix.c (7106a87d96c58a2ad7a4669781e58b22a3081004) file-posix.c (061ca8a368165fae300748c17971824a089f521f)
1/*
2 * Block driver for RAW files (posix)
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

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

1873 strerror(errno));
1874 }
1875 }
1876
1877 g_free(buf);
1878 return result;
1879}
1880
1/*
2 * Block driver for RAW files (posix)
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

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

1873 strerror(errno));
1874 }
1875 }
1876
1877 g_free(buf);
1878 return result;
1879}
1880
1881static int raw_truncate(BlockDriverState *bs, int64_t offset,
1882 PreallocMode prealloc, Error **errp)
1881static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset,
1882 PreallocMode prealloc, Error **errp)
1883{
1884 BDRVRawState *s = bs->opaque;
1885 struct stat st;
1886 int ret;
1887
1888 if (fstat(s->fd, &st)) {
1889 ret = -errno;
1890 error_setg_errno(errp, -ret, "Failed to fstat() the file");

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

2620 .bdrv_aio_pdiscard = raw_aio_pdiscard,
2621 .bdrv_co_copy_range_from = raw_co_copy_range_from,
2622 .bdrv_co_copy_range_to = raw_co_copy_range_to,
2623 .bdrv_refresh_limits = raw_refresh_limits,
2624 .bdrv_io_plug = raw_aio_plug,
2625 .bdrv_io_unplug = raw_aio_unplug,
2626 .bdrv_attach_aio_context = raw_aio_attach_aio_context,
2627
1883{
1884 BDRVRawState *s = bs->opaque;
1885 struct stat st;
1886 int ret;
1887
1888 if (fstat(s->fd, &st)) {
1889 ret = -errno;
1890 error_setg_errno(errp, -ret, "Failed to fstat() the file");

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

2620 .bdrv_aio_pdiscard = raw_aio_pdiscard,
2621 .bdrv_co_copy_range_from = raw_co_copy_range_from,
2622 .bdrv_co_copy_range_to = raw_co_copy_range_to,
2623 .bdrv_refresh_limits = raw_refresh_limits,
2624 .bdrv_io_plug = raw_aio_plug,
2625 .bdrv_io_unplug = raw_aio_unplug,
2626 .bdrv_attach_aio_context = raw_aio_attach_aio_context,
2627
2628 .bdrv_truncate = raw_truncate,
2628 .bdrv_co_truncate = raw_co_truncate,
2629 .bdrv_getlength = raw_getlength,
2630 .bdrv_get_info = raw_get_info,
2631 .bdrv_get_allocated_file_size
2632 = raw_get_allocated_file_size,
2633 .bdrv_check_perm = raw_check_perm,
2634 .bdrv_set_perm = raw_set_perm,
2635 .bdrv_abort_perm_update = raw_abort_perm_update,
2636 .create_opts = &raw_create_opts,

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

3100 .bdrv_aio_flush = raw_aio_flush,
3101 .bdrv_aio_pdiscard = hdev_aio_pdiscard,
3102 .bdrv_co_copy_range_from = raw_co_copy_range_from,
3103 .bdrv_co_copy_range_to = raw_co_copy_range_to,
3104 .bdrv_refresh_limits = raw_refresh_limits,
3105 .bdrv_io_plug = raw_aio_plug,
3106 .bdrv_io_unplug = raw_aio_unplug,
3107
2629 .bdrv_getlength = raw_getlength,
2630 .bdrv_get_info = raw_get_info,
2631 .bdrv_get_allocated_file_size
2632 = raw_get_allocated_file_size,
2633 .bdrv_check_perm = raw_check_perm,
2634 .bdrv_set_perm = raw_set_perm,
2635 .bdrv_abort_perm_update = raw_abort_perm_update,
2636 .create_opts = &raw_create_opts,

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

3100 .bdrv_aio_flush = raw_aio_flush,
3101 .bdrv_aio_pdiscard = hdev_aio_pdiscard,
3102 .bdrv_co_copy_range_from = raw_co_copy_range_from,
3103 .bdrv_co_copy_range_to = raw_co_copy_range_to,
3104 .bdrv_refresh_limits = raw_refresh_limits,
3105 .bdrv_io_plug = raw_aio_plug,
3106 .bdrv_io_unplug = raw_aio_unplug,
3107
3108 .bdrv_truncate = raw_truncate,
3108 .bdrv_co_truncate = raw_co_truncate,
3109 .bdrv_getlength = raw_getlength,
3110 .bdrv_get_info = raw_get_info,
3111 .bdrv_get_allocated_file_size
3112 = raw_get_allocated_file_size,
3113 .bdrv_check_perm = raw_check_perm,
3114 .bdrv_set_perm = raw_set_perm,
3115 .bdrv_abort_perm_update = raw_abort_perm_update,
3116 .bdrv_probe_blocksizes = hdev_probe_blocksizes,

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

3222
3223 .bdrv_co_preadv = raw_co_preadv,
3224 .bdrv_co_pwritev = raw_co_pwritev,
3225 .bdrv_aio_flush = raw_aio_flush,
3226 .bdrv_refresh_limits = raw_refresh_limits,
3227 .bdrv_io_plug = raw_aio_plug,
3228 .bdrv_io_unplug = raw_aio_unplug,
3229
3109 .bdrv_getlength = raw_getlength,
3110 .bdrv_get_info = raw_get_info,
3111 .bdrv_get_allocated_file_size
3112 = raw_get_allocated_file_size,
3113 .bdrv_check_perm = raw_check_perm,
3114 .bdrv_set_perm = raw_set_perm,
3115 .bdrv_abort_perm_update = raw_abort_perm_update,
3116 .bdrv_probe_blocksizes = hdev_probe_blocksizes,

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

3222
3223 .bdrv_co_preadv = raw_co_preadv,
3224 .bdrv_co_pwritev = raw_co_pwritev,
3225 .bdrv_aio_flush = raw_aio_flush,
3226 .bdrv_refresh_limits = raw_refresh_limits,
3227 .bdrv_io_plug = raw_aio_plug,
3228 .bdrv_io_unplug = raw_aio_unplug,
3229
3230 .bdrv_truncate = raw_truncate,
3230 .bdrv_co_truncate = raw_co_truncate,
3231 .bdrv_getlength = raw_getlength,
3232 .has_variable_length = true,
3233 .bdrv_get_allocated_file_size
3234 = raw_get_allocated_file_size,
3235
3236 /* removable device support */
3237 .bdrv_is_inserted = cdrom_is_inserted,
3238 .bdrv_eject = cdrom_eject,

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

3352
3353 .bdrv_co_preadv = raw_co_preadv,
3354 .bdrv_co_pwritev = raw_co_pwritev,
3355 .bdrv_aio_flush = raw_aio_flush,
3356 .bdrv_refresh_limits = raw_refresh_limits,
3357 .bdrv_io_plug = raw_aio_plug,
3358 .bdrv_io_unplug = raw_aio_unplug,
3359
3231 .bdrv_getlength = raw_getlength,
3232 .has_variable_length = true,
3233 .bdrv_get_allocated_file_size
3234 = raw_get_allocated_file_size,
3235
3236 /* removable device support */
3237 .bdrv_is_inserted = cdrom_is_inserted,
3238 .bdrv_eject = cdrom_eject,

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

3352
3353 .bdrv_co_preadv = raw_co_preadv,
3354 .bdrv_co_pwritev = raw_co_pwritev,
3355 .bdrv_aio_flush = raw_aio_flush,
3356 .bdrv_refresh_limits = raw_refresh_limits,
3357 .bdrv_io_plug = raw_aio_plug,
3358 .bdrv_io_unplug = raw_aio_unplug,
3359
3360 .bdrv_truncate = raw_truncate,
3360 .bdrv_co_truncate = raw_co_truncate,
3361 .bdrv_getlength = raw_getlength,
3362 .has_variable_length = true,
3363 .bdrv_get_allocated_file_size
3364 = raw_get_allocated_file_size,
3365
3366 /* removable device support */
3367 .bdrv_is_inserted = cdrom_is_inserted,
3368 .bdrv_eject = cdrom_eject,

--- 21 unchanged lines hidden ---
3361 .bdrv_getlength = raw_getlength,
3362 .has_variable_length = true,
3363 .bdrv_get_allocated_file_size
3364 = raw_get_allocated_file_size,
3365
3366 /* removable device support */
3367 .bdrv_is_inserted = cdrom_is_inserted,
3368 .bdrv_eject = cdrom_eject,

--- 21 unchanged lines hidden ---