qemu-img.c (8b7968f7c4ac8c07cad6a1a0891d38cf239a2839) qemu-img.c (51ef67270b1d10e1fcf3de7368dccad1ba0bf9d1)
1/*
2 * QEMU disk image utility
3 *
4 * Copyright (c) 2003-2008 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

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

641 BlockDriverState **bs = NULL, *out_bs = NULL;
642 int64_t total_sectors, nb_sectors, sector_num, bs_offset;
643 uint64_t bs_sectors;
644 uint8_t * buf = NULL;
645 const uint8_t *buf1;
646 BlockDriverInfo bdi;
647 QEMUOptionParameter *param = NULL, *create_options = NULL;
648 char *options = NULL;
1/*
2 * QEMU disk image utility
3 *
4 * Copyright (c) 2003-2008 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

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

641 BlockDriverState **bs = NULL, *out_bs = NULL;
642 int64_t total_sectors, nb_sectors, sector_num, bs_offset;
643 uint64_t bs_sectors;
644 uint8_t * buf = NULL;
645 const uint8_t *buf1;
646 BlockDriverInfo bdi;
647 QEMUOptionParameter *param = NULL, *create_options = NULL;
648 char *options = NULL;
649 const char *snapshot_name = NULL;
649
650 fmt = NULL;
651 out_fmt = "raw";
652 out_baseimg = NULL;
653 flags = 0;
654 for(;;) {
650
651 fmt = NULL;
652 out_fmt = "raw";
653 out_baseimg = NULL;
654 flags = 0;
655 for(;;) {
655 c = getopt(argc, argv, "f:O:B:hce6o:");
656 c = getopt(argc, argv, "f:O:B:s:hce6o:");
656 if (c == -1)
657 break;
658 switch(c) {
659 case 'h':
660 help();
661 break;
662 case 'f':
663 fmt = optarg;

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

675 flags |= BLOCK_FLAG_ENCRYPT;
676 break;
677 case '6':
678 flags |= BLOCK_FLAG_COMPAT6;
679 break;
680 case 'o':
681 options = optarg;
682 break;
657 if (c == -1)
658 break;
659 switch(c) {
660 case 'h':
661 help();
662 break;
663 case 'f':
664 fmt = optarg;

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

676 flags |= BLOCK_FLAG_ENCRYPT;
677 break;
678 case '6':
679 flags |= BLOCK_FLAG_COMPAT6;
680 break;
681 case 'o':
682 options = optarg;
683 break;
684 case 's':
685 snapshot_name = optarg;
686 break;
683 }
684 }
685
686 bs_n = argc - optind - 1;
687 if (bs_n < 1) help();
688
689 out_filename = argv[argc - 1];
690

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

706 error("Could not open '%s'", argv[optind + bs_i]);
707 ret = -1;
708 goto out;
709 }
710 bdrv_get_geometry(bs[bs_i], &bs_sectors);
711 total_sectors += bs_sectors;
712 }
713
687 }
688 }
689
690 bs_n = argc - optind - 1;
691 if (bs_n < 1) help();
692
693 out_filename = argv[argc - 1];
694

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

710 error("Could not open '%s'", argv[optind + bs_i]);
711 ret = -1;
712 goto out;
713 }
714 bdrv_get_geometry(bs[bs_i], &bs_sectors);
715 total_sectors += bs_sectors;
716 }
717
718 if (snapshot_name != NULL) {
719 if (bs_n > 1) {
720 error("No support for concatenating multiple snapshot\n");
721 ret = -1;
722 goto out;
723 }
724 if (bdrv_snapshot_load_tmp(bs[0], snapshot_name) < 0) {
725 error("Failed to load snapshot\n");
726 ret = -1;
727 goto out;
728 }
729 }
730
714 /* Find driver and parse its options */
715 drv = bdrv_find_format(out_fmt);
716 if (!drv) {
717 error("Unknown file format '%s'", out_fmt);
718 ret = -1;
719 goto out;
720 }
721

--- 815 unchanged lines hidden ---
731 /* Find driver and parse its options */
732 drv = bdrv_find_format(out_fmt);
733 if (!drv) {
734 error("Unknown file format '%s'", out_fmt);
735 ret = -1;
736 goto out;
737 }
738

--- 815 unchanged lines hidden ---