qemu-img.c (3f379ab18741e75325cfca22f368de846d8b89f1) | qemu-img.c (96b8f136f52ea2dc5948fe24f0bf4483251ac280) |
---|---|
1/* 2 * QEMU disk image utility 3 * 4 * Copyright (c) 2003-2007 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 --- 221 unchanged lines hidden (view full) --- 230} 231 232static int img_create(int argc, char **argv) 233{ 234 int c, ret, flags; 235 const char *fmt = "raw"; 236 const char *filename; 237 const char *base_filename = NULL; | 1/* 2 * QEMU disk image utility 3 * 4 * Copyright (c) 2003-2007 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 --- 221 unchanged lines hidden (view full) --- 230} 231 232static int img_create(int argc, char **argv) 233{ 234 int c, ret, flags; 235 const char *fmt = "raw"; 236 const char *filename; 237 const char *base_filename = NULL; |
238 int64_t size; | 238 uint64_t size; |
239 const char *p; 240 BlockDriver *drv; 241 242 flags = 0; 243 for(;;) { 244 c = getopt(argc, argv, "b:f:he6"); 245 if (c == -1) 246 break; --- 48 unchanged lines hidden (view full) --- 295 if (flags & BLOCK_FLAG_ENCRYPT) 296 printf(", encrypted"); 297 if (flags & BLOCK_FLAG_COMPAT6) 298 printf(", compatibility level=6"); 299 if (base_filename) { 300 printf(", backing_file=%s", 301 base_filename); 302 } | 239 const char *p; 240 BlockDriver *drv; 241 242 flags = 0; 243 for(;;) { 244 c = getopt(argc, argv, "b:f:he6"); 245 if (c == -1) 246 break; --- 48 unchanged lines hidden (view full) --- 295 if (flags & BLOCK_FLAG_ENCRYPT) 296 printf(", encrypted"); 297 if (flags & BLOCK_FLAG_COMPAT6) 298 printf(", compatibility level=6"); 299 if (base_filename) { 300 printf(", backing_file=%s", 301 base_filename); 302 } |
303 printf(", size=%" PRId64 " kB\n", (int64_t) (size / 1024)); | 303 printf(", size=%" PRIu64 " kB\n", size / 1024); |
304 ret = bdrv_create(drv, filename, size / 512, base_filename, flags); 305 if (ret < 0) { 306 if (ret == -ENOTSUP) { 307 error("Formatting or formatting option not supported for file format '%s'", fmt); 308 } else { 309 error("Error while formatting"); 310 } 311 } --- 93 unchanged lines hidden (view full) --- 405#define IO_BUF_SIZE 65536 406 407static int img_convert(int argc, char **argv) 408{ 409 int c, ret, n, n1, bs_n, bs_i, flags, cluster_size, cluster_sectors; 410 const char *fmt, *out_fmt, *out_filename; 411 BlockDriver *drv; 412 BlockDriverState **bs, *out_bs; | 304 ret = bdrv_create(drv, filename, size / 512, base_filename, flags); 305 if (ret < 0) { 306 if (ret == -ENOTSUP) { 307 error("Formatting or formatting option not supported for file format '%s'", fmt); 308 } else { 309 error("Error while formatting"); 310 } 311 } --- 93 unchanged lines hidden (view full) --- 405#define IO_BUF_SIZE 65536 406 407static int img_convert(int argc, char **argv) 408{ 409 int c, ret, n, n1, bs_n, bs_i, flags, cluster_size, cluster_sectors; 410 const char *fmt, *out_fmt, *out_filename; 411 BlockDriver *drv; 412 BlockDriverState **bs, *out_bs; |
413 int64_t total_sectors, nb_sectors, sector_num, bs_offset, bs_sectors; | 413 int64_t total_sectors, nb_sectors, sector_num, bs_offset; 414 uint64_t bs_sectors; |
414 uint8_t buf[IO_BUF_SIZE]; 415 const uint8_t *buf1; 416 BlockDriverInfo bdi; 417 418 fmt = NULL; 419 out_fmt = "raw"; 420 flags = 0; 421 for(;;) { --- 228 unchanged lines hidden (view full) --- 650 651static int img_info(int argc, char **argv) 652{ 653 int c; 654 const char *filename, *fmt; 655 BlockDriver *drv; 656 BlockDriverState *bs; 657 char fmt_name[128], size_buf[128], dsize_buf[128]; | 415 uint8_t buf[IO_BUF_SIZE]; 416 const uint8_t *buf1; 417 BlockDriverInfo bdi; 418 419 fmt = NULL; 420 out_fmt = "raw"; 421 flags = 0; 422 for(;;) { --- 228 unchanged lines hidden (view full) --- 651 652static int img_info(int argc, char **argv) 653{ 654 int c; 655 const char *filename, *fmt; 656 BlockDriver *drv; 657 BlockDriverState *bs; 658 char fmt_name[128], size_buf[128], dsize_buf[128]; |
658 int64_t total_sectors, allocated_size; | 659 uint64_t total_sectors; 660 int64_t allocated_size; |
659 char backing_filename[1024]; 660 char backing_filename2[1024]; 661 BlockDriverInfo bdi; 662 663 fmt = NULL; 664 for(;;) { 665 c = getopt(argc, argv, "f:h"); 666 if (c == -1) --- 84 unchanged lines hidden --- | 661 char backing_filename[1024]; 662 char backing_filename2[1024]; 663 BlockDriverInfo bdi; 664 665 fmt = NULL; 666 for(;;) { 667 c = getopt(argc, argv, "f:h"); 668 if (c == -1) --- 84 unchanged lines hidden --- |