qemu-img.c (ccf34716eeda0e3ad203c8a28f01efb412c56763) qemu-img.c (f8d6bba1c1f56217d9ee71b7aee5f94f46c8f148)
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

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

1102 g_free(sn_tab);
1103}
1104
1105static int img_info(int argc, char **argv)
1106{
1107 int c;
1108 const char *filename, *fmt;
1109 BlockDriverState *bs;
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

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

1102 g_free(sn_tab);
1103}
1104
1105static int img_info(int argc, char **argv)
1106{
1107 int c;
1108 const char *filename, *fmt;
1109 BlockDriverState *bs;
1110 char fmt_name[128], size_buf[128], dsize_buf[128];
1110 char size_buf[128], dsize_buf[128];
1111 uint64_t total_sectors;
1112 int64_t allocated_size;
1113 char backing_filename[1024];
1114 char backing_filename2[1024];
1115 BlockDriverInfo bdi;
1116
1117 fmt = NULL;
1118 for(;;) {

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

1134 help();
1135 }
1136 filename = argv[optind++];
1137
1138 bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_NO_BACKING);
1139 if (!bs) {
1140 return 1;
1141 }
1111 uint64_t total_sectors;
1112 int64_t allocated_size;
1113 char backing_filename[1024];
1114 char backing_filename2[1024];
1115 BlockDriverInfo bdi;
1116
1117 fmt = NULL;
1118 for(;;) {

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

1134 help();
1135 }
1136 filename = argv[optind++];
1137
1138 bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_NO_BACKING);
1139 if (!bs) {
1140 return 1;
1141 }
1142 bdrv_get_format(bs, fmt_name, sizeof(fmt_name));
1143 bdrv_get_geometry(bs, &total_sectors);
1144 get_human_readable_size(size_buf, sizeof(size_buf), total_sectors * 512);
1145 allocated_size = bdrv_get_allocated_file_size(bs);
1146 if (allocated_size < 0) {
1147 snprintf(dsize_buf, sizeof(dsize_buf), "unavailable");
1148 } else {
1149 get_human_readable_size(dsize_buf, sizeof(dsize_buf),
1150 allocated_size);
1151 }
1152 printf("image: %s\n"
1153 "file format: %s\n"
1154 "virtual size: %s (%" PRId64 " bytes)\n"
1155 "disk size: %s\n",
1142 bdrv_get_geometry(bs, &total_sectors);
1143 get_human_readable_size(size_buf, sizeof(size_buf), total_sectors * 512);
1144 allocated_size = bdrv_get_allocated_file_size(bs);
1145 if (allocated_size < 0) {
1146 snprintf(dsize_buf, sizeof(dsize_buf), "unavailable");
1147 } else {
1148 get_human_readable_size(dsize_buf, sizeof(dsize_buf),
1149 allocated_size);
1150 }
1151 printf("image: %s\n"
1152 "file format: %s\n"
1153 "virtual size: %s (%" PRId64 " bytes)\n"
1154 "disk size: %s\n",
1156 filename, fmt_name, size_buf,
1155 filename, bdrv_get_format_name(bs), size_buf,
1157 (total_sectors * 512),
1158 dsize_buf);
1159 if (bdrv_is_encrypted(bs)) {
1160 printf("encrypted: yes\n");
1161 }
1162 if (bdrv_get_info(bs, &bdi) >= 0) {
1163 if (bdi.cluster_size != 0) {
1164 printf("cluster_size: %d\n", bdi.cluster_size);

--- 549 unchanged lines hidden ---
1156 (total_sectors * 512),
1157 dsize_buf);
1158 if (bdrv_is_encrypted(bs)) {
1159 printf("encrypted: yes\n");
1160 }
1161 if (bdrv_get_info(bs, &bdi) >= 0) {
1162 if (bdi.cluster_size != 0) {
1163 printf("cluster_size: %d\n", bdi.cluster_size);

--- 549 unchanged lines hidden ---