for (i = 0, p = buffer; i < len; i += 16) {
const uint8_t *s = p;
- printf("%08llx: ", (unsigned long long)offset + i);
+ printf("%08" PRIx64 ": ", offset + i);
for (j = 0; j < 16 && i + j < len; j++, p++)
printf("%02x ", *p);
printf(" ");
if (!Cflag) {
cvtstr((double)total, s1, sizeof(s1));
cvtstr(tdiv((double)total, *t), s2, sizeof(s2));
- printf("%s %d/%d bytes at offset %lld\n",
- op, total, count, (long long)offset);
+ printf("%s %d/%d bytes at offset %" PRId64 "\n",
+ op, total, count, offset);
printf("%s, %d ops; %s (%s/sec and %.4f ops/sec)\n",
s1, cnt, ts, s2, tdiv((double)cnt, *t));
} else {/* bytes,ops,time,bytes/sec,ops/sec */
for (i = 0; i < nr_iov; i++) {
char *arg = argv[i];
- long long len;
+ uint64_t len;
len = cvtnum(arg);
if (len < 0) {
}
if (len & 0x1ff) {
- printf("length argument %lld is not sector aligned\n",
- len);
+ printf("length argument %" PRId64
+ " is not sector aligned\n", len);
goto fail;
}
if (!pflag)
if (offset & 0x1ff) {
- printf("offset %lld is not sector aligned\n",
- (long long)offset);
+ printf("offset %" PRId64 " is not sector aligned\n",
+ offset);
return 0;
if (count & 0x1ff) {
void* cmp_buf = malloc(pattern_count);
memset(cmp_buf, pattern, pattern_count);
if (memcmp(buf + pattern_offset, cmp_buf, pattern_count)) {
- printf("Pattern verification failed at offset %lld, "
- "%d bytes\n",
- (long long) offset + pattern_offset, pattern_count);
+ printf("Pattern verification failed at offset %"
+ PRId64 ", %d bytes\n",
+ offset + pattern_offset, pattern_count);
}
free(cmp_buf);
}
optind++;
if (offset & 0x1ff) {
- printf("offset %lld is not sector aligned\n",
- (long long)offset);
+ printf("offset %" PRId64 " is not sector aligned\n",
+ offset);
return 0;
}
void* cmp_buf = malloc(qiov.size);
memset(cmp_buf, pattern, qiov.size);
if (memcmp(buf, cmp_buf, qiov.size)) {
- printf("Pattern verification failed at offset %lld, "
- "%zd bytes\n",
- (long long) offset, qiov.size);
+ printf("Pattern verification failed at offset %"
+ PRId64 ", %zd bytes\n",
+ offset, qiov.size);
}
free(cmp_buf);
}
if (!pflag) {
if (offset & 0x1ff) {
- printf("offset %lld is not sector aligned\n",
- (long long)offset);
+ printf("offset %" PRId64 " is not sector aligned\n",
+ offset);
return 0;
}
optind++;
if (offset & 0x1ff) {
- printf("offset %lld is not sector aligned\n",
- (long long)offset);
+ printf("offset %" PRId64 " is not sector aligned\n",
+ offset);
return 0;
}
memset(cmp_buf, ctx->pattern, ctx->qiov.size);
if (memcmp(ctx->buf, cmp_buf, ctx->qiov.size)) {
- printf("Pattern verification failed at offset %lld, "
- "%zd bytes\n",
- (long long) ctx->offset, ctx->qiov.size);
+ printf("Pattern verification failed at offset %"
+ PRId64 ", %zd bytes\n",
+ ctx->offset, ctx->qiov.size);
}
free(cmp_buf);
}
optind++;
if (ctx->offset & 0x1ff) {
- printf("offset %lld is not sector aligned\n",
- (long long)ctx->offset);
+ printf("offset %" PRId64 " is not sector aligned\n",
+ ctx->offset);
free(ctx);
return 0;
}
optind++;
if (ctx->offset & 0x1ff) {
- printf("offset %lld is not sector aligned\n",
- (long long)ctx->offset);
+ printf("offset %" PRId64 " is not sector aligned\n",
+ ctx->offset);
free(ctx);
return 0;
}
offset = cvtnum(argv[1]);
if (offset & 0x1ff) {
- printf("offset %lld is not sector aligned\n",
- (long long)offset);
+ printf("offset %" PRId64 " is not sector aligned\n",
+ offset);
return 0;
}
return 1;
}
- bs = bdrv_new("hda");
- if (!bs)
- return 1;
-
if (growable) {
- flags |= BDRV_O_FILE;
- }
-
- if (bdrv_open(bs, name, flags, NULL) < 0) {
- fprintf(stderr, "%s: can't open device %s\n", progname, name);
- bs = NULL;
- return 1;
+ if (bdrv_file_open(&bs, name, flags)) {
+ fprintf(stderr, "%s: can't open device %s\n", progname, name);
+ return 1;
+ }
+ } else {
+ bs = bdrv_new("hda");
+ if (!bs)
+ return 1;
+
+ if (bdrv_open(bs, name, flags, NULL) < 0) {
+ fprintf(stderr, "%s: can't open device %s\n", progname, name);
+ bs = NULL;
+ return 1;
+ }
}
- if (growable) {
- bs->growable = 1;
- }
return 0;
}