vmdk.c (5820f1da5130e2afdacd6d8886a67cf95ddc5878) vmdk.c (c282e1fdf7ec9659c7f320123be397477a359d01)
1/*
2 * Block driver for the VMDK format
3 *
4 * Copyright (c) 2004 Fabrice Bellard
5 * Copyright (c) 2005 Filip Navara
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

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

1534 int ret, i;
1535 BlockDriverState *bs = NULL;
1536 VMDK4Header header;
1537 Error *local_err = NULL;
1538 uint32_t tmp, magic, grains, gd_sectors, gt_size, gt_count;
1539 uint32_t *gd_buf = NULL;
1540 int gd_buf_size;
1541
1/*
2 * Block driver for the VMDK format
3 *
4 * Copyright (c) 2004 Fabrice Bellard
5 * Copyright (c) 2005 Filip Navara
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

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

1534 int ret, i;
1535 BlockDriverState *bs = NULL;
1536 VMDK4Header header;
1537 Error *local_err = NULL;
1538 uint32_t tmp, magic, grains, gd_sectors, gt_size, gt_count;
1539 uint32_t *gd_buf = NULL;
1540 int gd_buf_size;
1541
1542 ret = bdrv_create_file(filename, NULL, NULL, &local_err);
1542 ret = bdrv_create_file(filename, NULL, &local_err);
1543 if (ret < 0) {
1544 error_propagate(errp, local_err);
1545 goto exit;
1546 }
1547
1548 assert(bs == NULL);
1549 ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
1550 NULL, &local_err);

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

1868 (int64_t)(63 * number_heads * BDRV_SECTOR_SIZE),
1869 number_heads,
1870 adapter_type);
1871 desc_len = strlen(desc);
1872 /* the descriptor offset = 0x200 */
1873 if (!split && !flat) {
1874 desc_offset = 0x200;
1875 } else {
1543 if (ret < 0) {
1544 error_propagate(errp, local_err);
1545 goto exit;
1546 }
1547
1548 assert(bs == NULL);
1549 ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
1550 NULL, &local_err);

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

1868 (int64_t)(63 * number_heads * BDRV_SECTOR_SIZE),
1869 number_heads,
1870 adapter_type);
1871 desc_len = strlen(desc);
1872 /* the descriptor offset = 0x200 */
1873 if (!split && !flat) {
1874 desc_offset = 0x200;
1875 } else {
1876 ret = bdrv_create_file(filename, NULL, opts, &local_err);
1876 ret = bdrv_create_file(filename, opts, &local_err);
1877 if (ret < 0) {
1878 error_propagate(errp, local_err);
1879 goto exit;
1880 }
1881 }
1882 assert(new_bs == NULL);
1883 ret = bdrv_open(&new_bs, filename, NULL, NULL,
1884 BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err);

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

2164 .bdrv_open = vmdk_open,
2165 .bdrv_check = vmdk_check,
2166 .bdrv_reopen_prepare = vmdk_reopen_prepare,
2167 .bdrv_read = vmdk_co_read,
2168 .bdrv_write = vmdk_co_write,
2169 .bdrv_write_compressed = vmdk_write_compressed,
2170 .bdrv_co_write_zeroes = vmdk_co_write_zeroes,
2171 .bdrv_close = vmdk_close,
1877 if (ret < 0) {
1878 error_propagate(errp, local_err);
1879 goto exit;
1880 }
1881 }
1882 assert(new_bs == NULL);
1883 ret = bdrv_open(&new_bs, filename, NULL, NULL,
1884 BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err);

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

2164 .bdrv_open = vmdk_open,
2165 .bdrv_check = vmdk_check,
2166 .bdrv_reopen_prepare = vmdk_reopen_prepare,
2167 .bdrv_read = vmdk_co_read,
2168 .bdrv_write = vmdk_co_write,
2169 .bdrv_write_compressed = vmdk_write_compressed,
2170 .bdrv_co_write_zeroes = vmdk_co_write_zeroes,
2171 .bdrv_close = vmdk_close,
2172 .bdrv_create2 = vmdk_create,
2172 .bdrv_create = vmdk_create,
2173 .bdrv_co_flush_to_disk = vmdk_co_flush,
2174 .bdrv_co_get_block_status = vmdk_co_get_block_status,
2175 .bdrv_get_allocated_file_size = vmdk_get_allocated_file_size,
2176 .bdrv_has_zero_init = vmdk_has_zero_init,
2177 .bdrv_get_specific_info = vmdk_get_specific_info,
2178 .bdrv_refresh_limits = vmdk_refresh_limits,
2179 .bdrv_get_info = vmdk_get_info,
2180 .bdrv_detach_aio_context = vmdk_detach_aio_context,
2181 .bdrv_attach_aio_context = vmdk_attach_aio_context,
2182
2183 .create_opts = &vmdk_create_opts,
2184};
2185
2186static void bdrv_vmdk_init(void)
2187{
2188 bdrv_register(&bdrv_vmdk);
2189}
2190
2191block_init(bdrv_vmdk_init);
2173 .bdrv_co_flush_to_disk = vmdk_co_flush,
2174 .bdrv_co_get_block_status = vmdk_co_get_block_status,
2175 .bdrv_get_allocated_file_size = vmdk_get_allocated_file_size,
2176 .bdrv_has_zero_init = vmdk_has_zero_init,
2177 .bdrv_get_specific_info = vmdk_get_specific_info,
2178 .bdrv_refresh_limits = vmdk_refresh_limits,
2179 .bdrv_get_info = vmdk_get_info,
2180 .bdrv_detach_aio_context = vmdk_detach_aio_context,
2181 .bdrv_attach_aio_context = vmdk_attach_aio_context,
2182
2183 .create_opts = &vmdk_create_opts,
2184};
2185
2186static void bdrv_vmdk_init(void)
2187{
2188 bdrv_register(&bdrv_vmdk);
2189}
2190
2191block_init(bdrv_vmdk_init);