Skip to contentSkip to conversation

block: Use GCC_FMT_ATTR and fix a format error

PATCH In review Stefan Weil 3 participants 11 messages Sep 23, 2010 – Oct 14, 2010 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: Use GCC_FMT_ATTR and fix a format error

Adding the gcc format attribute detects a format bug which is fixed here.

Cc Blue Swirl <[email protected]>
Cc Kevin Wolf <[email protected]>
---
 block/blkverify.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
block/blkverify.c +3 -2
index 8083464..b39fb67 100644
@@ -53,7 +53,8 @@ static AIOPool blkverify_aio_pool = {
     .cancel             = blkverify_aio_cancel,
 };
 
-static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
+                                             const char *fmt, ...)
 {
     va_list ap;
 
@@ -300,7 +301,7 @@ static void blkverify_verify_readv(BlkverifyAIOCB *acb)
     ssize_t offset = blkverify_iovec_compare(acb->qiov, &acb->raw_qiov);
     if (offset != -1) {
         blkverify_err(acb, "contents mismatch in sector %ld",
-                      acb->sector_num + (offset / BDRV_SECTOR_SIZE));
+                      (long)(acb->sector_num + (offset / BDRV_SECTOR_SIZE)));
     }
 }
 
Signature · 1 line
1.7.1
#1 lore raw
Quoted 25 lines · Stefan Weil

Adding the gcc format attribute detects a format bug which is fixed here.

Cc Blue Swirl <[email protected]>
Cc Kevin Wolf <[email protected]>

---
 block/blkverify.c |    5 +++--

 1 files changed, 3 insertions(+), 2 deletions(-)
block/blkverify.c +2 -1
index 8083464..b39fb67 100644
@@ -53,7 +53,8 @@ static AIOPool blkverify_aio_pool = {
     .cancel             = blkverify_aio_cancel,
  };
 
-static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
+                                             const char *fmt, ...)
  {
     va_list ap;
 

block/blkverify.c static void blkverify_verify_readv(BlkverifyAIOCB *acb) · line 304

Quoted 5 lines
block/blkverify.c +1 -1
@@ -300,7 +301,7 @@ static void blkverify_verify_readv(BlkverifyAIOCB *acb)
     ssize_t offset = blkverify_iovec_compare(acb->qiov, &acb->raw_qiov);
     if (offset != -1) {
         blkverify_err(acb, "contents mismatch in sector %ld",
-                      acb->sector_num + (offset / BDRV_SECTOR_SIZE));
+                      (long)(acb->sector_num + (offset / BDRV_SECTOR_SIZE)));

sector_num is int64_t, so the correct fix is to change '%ld' to '%" PRId64'.

#2 lore raw

Am 23.09.2010 20:53, schrieb Blue Swirl:

Quoted 26 lines · Stefan Weil
Quoted 25 lines

Adding the gcc format attribute detects a format bug which is fixed here.

---
  block/blkverify.c |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)
block/blkverify.c +2 -1
index 8083464..b39fb67 100644
@@ -53,7 +53,8 @@ static AIOPool blkverify_aio_pool = {
     .cancel             = blkverify_aio_cancel,
  };
 
-static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
+                                             const char *fmt, ...)
  {
     va_list ap;
 
Quoted 10 lines

block/blkverify.c static void blkverify_verify_readv(BlkverifyAIOCB *acb) · line 305

Quoted 7 lines
block/blkverify.c +1 -1
@@ -300,7 +301,7 @@ static void blkverify_verify_readv(BlkverifyAIOCB *acb)
     ssize_t offset = blkverify_iovec_compare(acb->qiov,&acb->raw_qiov);
     if (offset != -1) {
         blkverify_err(acb, "contents mismatch in sector %ld",
-                      acb->sector_num + (offset / BDRV_SECTOR_SIZE));
+                      (long)(acb->sector_num + (offset / BDRV_SECTOR_SIZE)));
 

sector_num is int64_t, so the correct fix is to change '%ld' to '%" PRId64'.

I noticed that, too. But offset is ssize_t.
Can you always be sure that (int64_t + ssize_t) results in a int64_t? I don't think it's so easy.

#3 lore raw

Am 23.09.2010 21:03, schrieb Stefan Weil:

Quoted 38 lines

Am 23.09.2010 20:53, schrieb Blue Swirl:

Quoted 25 lines · Stefan Weil
Quoted 24 lines

Adding the gcc format attribute detects a format bug which is fixed here.

---
  block/blkverify.c |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)
block/blkverify.c +2 -1
index 8083464..b39fb67 100644
@@ -53,7 +53,8 @@ static AIOPool blkverify_aio_pool = {
     .cancel             = blkverify_aio_cancel,
  };
 
-static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
+                                             const char *fmt, ...)
  {
     va_list ap;
 
Quoted 11 lines

block/blkverify.c static void · line 307

Quoted 9 lines
block/blkverify.c +1 -1
@@ -300,7 +301,7 @@ static void 
 blkverify_verify_readv(BlkverifyAIOCB *acb)
     ssize_t offset = 
 blkverify_iovec_compare(acb->qiov,&acb->raw_qiov);
     if (offset != -1) {
         blkverify_err(acb, "contents mismatch in sector %ld",
-                      acb->sector_num + (offset / BDRV_SECTOR_SIZE));
+                      (long)(acb->sector_num + (offset / 
 BDRV_SECTOR_SIZE)));

sector_num is int64_t, so the correct fix is to change '%ld' to '%" PRId64'.

Quoted 3 lines

I noticed that, too. But offset is ssize_t.
Can you always be sure that (int64_t + ssize_t) results in a int64_t? I don't think it's so easy.

I think you are correct, the format should use PRId64. The type cast is still necessary, but should cast to int64_t. (needed when int64_t == long and ssize_t == long long).

If you agree, I'll send a new patch.

Stefan

#4 lore raw
Quoted 48 lines · Stefan Weil

Am 23.09.2010 21:03, schrieb Stefan Weil:

Quoted 43 lines

Am 23.09.2010 20:53, schrieb Blue Swirl:

Quoted 28 lines
Quoted 25 lines · Stefan Weil

Adding the gcc format attribute detects a format bug which is fixed here.

---
 block/blkverify.c |    5 +++--

 1 files changed, 3 insertions(+), 2 deletions(-)
block/blkverify.c +2 -1
index 8083464..b39fb67 100644
@@ -53,7 +53,8 @@ static AIOPool blkverify_aio_pool = {
     .cancel             = blkverify_aio_cancel,
  };
 
-static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
+                                             const char *fmt, ...)
  {
     va_list ap;
 
Quoted 12 lines

block/blkverify.c static void blkverify_verify_readv(BlkverifyAIOCB · line 306

Quoted 8 lines
block/blkverify.c +1 -1
@@ -300,7 +301,7 @@ static void blkverify_verify_readv(BlkverifyAIOCB
 *acb)
     ssize_t offset = blkverify_iovec_compare(acb->qiov,&acb->raw_qiov);
     if (offset != -1) {
         blkverify_err(acb, "contents mismatch in sector %ld",
-                      acb->sector_num + (offset / BDRV_SECTOR_SIZE));
+                      (long)(acb->sector_num + (offset /
 BDRV_SECTOR_SIZE)));

sector_num is int64_t, so the correct fix is to change '%ld' to '%" PRId64'.

Quoted 3 lines

I noticed that, too. But offset is ssize_t.
Can you always be sure that (int64_t + ssize_t) results in a int64_t? I don't think it's so easy.

Quoted 5 lines

I think you are correct, the format should use PRId64. The type cast is still necessary, but should cast to int64_t. (needed when int64_t == long and ssize_t == long long).

If you agree, I'll send a new patch.

It's also possible to cast offset to int64_t. Or perhaps even the type of the return value of blkverify_iovec_compare should be changed to int64_t.

#5 lore raw

Am 23.09.2010 22:24, schrieb Blue Swirl:

Quoted 54 lines · Stefan Weil
Quoted 53 lines

Am 23.09.2010 21:03, schrieb Stefan Weil:

Quoted 44 lines

Am 23.09.2010 20:53, schrieb Blue Swirl:

Quoted 28 lines
Quoted 25 lines · Stefan Weil

Adding the gcc format attribute detects a format bug which is fixed here.

---
 block/blkverify.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
block/blkverify.c +2 -1
index 8083464..b39fb67 100644
@@ -53,7 +53,8 @@ static AIOPool blkverify_aio_pool = {
    .cancel             = blkverify_aio_cancel,
 };
 
-static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
+                                             const char *fmt, ...)
 {
    va_list ap;
 
Quoted 13 lines

block/blkverify.c static void blkverify_verify_readv(BlkverifyAIOCB · line 307

Quoted 9 lines
block/blkverify.c +1 -1
@@ -300,7 +301,7 @@ static void blkverify_verify_readv(BlkverifyAIOCB
 *acb)
    ssize_t offset = 
 blkverify_iovec_compare(acb->qiov,&acb->raw_qiov);
    if (offset != -1) {
        blkverify_err(acb, "contents mismatch in sector %ld",
-                      acb->sector_num + (offset / BDRV_SECTOR_SIZE));
+                      (long)(acb->sector_num + (offset /
 BDRV_SECTOR_SIZE)));

sector_num is int64_t, so the correct fix is to change '%ld' to '%" PRId64'.

Quoted 3 lines

I noticed that, too. But offset is ssize_t.
Can you always be sure that (int64_t + ssize_t) results in a int64_t? I don't think it's so easy.

I think you are correct, the format should use PRId64. The type cast is still necessary, but should cast to int64_t. (needed when int64_t == long and ssize_t == long long).

Quoted 5 lines
Quoted 1 line

If you agree, I'll send a new patch.

It's also possible to cast offset to int64_t. Or perhaps even the type of the return value of blkverify_iovec_compare should be changed to int64_t.

Unless BDRV_SECTOR_SIZE is changed, too, this would still need a type cast. So we have two possible solutions:

(1) Use %lld (should work because BDRV_SECTOR_SIZE is unsigned long long).
(2) Use PRId64. This needs changes for BDRV_SECTOR_SIZE and blkverify_iovec_compare.

Any preferences? I tend to (2), but that change is less local.

#6 lore raw

PATCH 1/1 block: Use GCC_FMT_ATTR and fix a format error

Adding the gcc format attribute detects a format bug which is fixed here.

v2:
Don't use type cast. BDRV_SECTOR_SIZE is unsigned long long, so %lld should be the correct format specifier.

Cc Blue Swirl <[email protected]>
Cc Kevin Wolf <[email protected]>
---
 block/blkverify.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
block/blkverify.c +3 -2
index 8083464..b2a12fe 100644
@@ -53,7 +53,8 @@ static AIOPool blkverify_aio_pool = {
     .cancel             = blkverify_aio_cancel,
 };
 
-static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
+                                             const char *fmt, ...)
 {
     va_list ap;
 
@@ -299,7 +300,7 @@ static void blkverify_verify_readv(BlkverifyAIOCB *acb)
 {
     ssize_t offset = blkverify_iovec_compare(acb->qiov, &acb->raw_qiov);
     if (offset != -1) {
-        blkverify_err(acb, "contents mismatch in sector %ld",
+        blkverify_err(acb, "contents mismatch in sector %lld",
                       acb->sector_num + (offset / BDRV_SECTOR_SIZE));
     }
 }
Signature · 1 line
1.7.1
#7 lore raw
In reply to Stefan Weil
Quoted 62 lines · Stefan Weil

Am 23.09.2010 22:24, schrieb Blue Swirl:

Quoted 55 lines · Stefan Weil
Quoted 53 lines

Am 23.09.2010 21:03, schrieb Stefan Weil:

Quoted 43 lines

Am 23.09.2010 20:53, schrieb Blue Swirl:

Quoted 28 lines
Quoted 25 lines · Stefan Weil

Adding the gcc format attribute detects a format bug which is fixed here.

---
 block/blkverify.c |    5 +++--

 1 files changed, 3 insertions(+), 2 deletions(-)
block/blkverify.c +2 -1
index 8083464..b39fb67 100644
@@ -53,7 +53,8 @@ static AIOPool blkverify_aio_pool = {
    .cancel             = blkverify_aio_cancel,
  };
 
-static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
+                                             const char *fmt, ...)
  {
    va_list ap;
 
Quoted 12 lines

block/blkverify.c static void blkverify_verify_readv(BlkverifyAIOCB · line 306

Quoted 8 lines
block/blkverify.c +1 -1
@@ -300,7 +301,7 @@ static void blkverify_verify_readv(BlkverifyAIOCB
 *acb)
    ssize_t offset = blkverify_iovec_compare(acb->qiov,&acb->raw_qiov);
    if (offset != -1) {
        blkverify_err(acb, "contents mismatch in sector %ld",
-                      acb->sector_num + (offset / BDRV_SECTOR_SIZE));
+                      (long)(acb->sector_num + (offset /
 BDRV_SECTOR_SIZE)));

sector_num is int64_t, so the correct fix is to change '%ld' to '%" PRId64'.

Quoted 3 lines

I noticed that, too. But offset is ssize_t.
Can you always be sure that (int64_t + ssize_t) results in a int64_t? I don't think it's so easy.

I think you are correct, the format should use PRId64. The type cast is still necessary, but should cast to int64_t. (needed when int64_t == long and ssize_t == long long).

Quoted 5 lines
Quoted 1 line

If you agree, I'll send a new patch.

It's also possible to cast offset to int64_t. Or perhaps even the type of the return value of blkverify_iovec_compare should be changed to int64_t.

Quoted 6 lines

Unless BDRV_SECTOR_SIZE is changed, too, this would still need a type cast. So we have two possible solutions:

(1) Use %lld (should work because BDRV_SECTOR_SIZE is unsigned long long).
(2) Use PRId64. This needs changes for BDRV_SECTOR_SIZE and blkverify_iovec_compare.

Or
(3) Use PRId64, change blkverify_iovec_compare, leave BDRV_SECTOR_SIZE unchanged but add a cast to int64_t here.

Grepping for BDRV_SECTOR_SIZE shows that it is used in several places in size_t or off_t expressions, so long long is as good as any other large type.

I think Kevin should decide.

#8 lore raw

Am 25.09.2010 10:01, schrieb Blue Swirl:

Quoted 78 lines · Stefan Weil
Quoted 66 lines

Am 23.09.2010 22:24, schrieb Blue Swirl:

Quoted 59 lines · Stefan Weil
Quoted 57 lines

Am 23.09.2010 21:03, schrieb Stefan Weil:

Quoted 47 lines

Am 23.09.2010 20:53, schrieb Blue Swirl:

Quoted 29 lines
Quoted 26 lines · Stefan Weil

Adding the gcc format attribute detects a format bug which is fixed here.

---
 block/blkverify.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
block/blkverify.c +2 -1
index 8083464..b39fb67 100644
@@ -53,7 +53,8 @@ static AIOPool blkverify_aio_pool = {
   .cancel             = blkverify_aio_cancel,
 };
 
-static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, 
 ...)
+static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
+                                             const char *fmt, ...)
 {
   va_list ap;
Quoted 15 lines
Quoted 11 lines
block/blkverify.c +0 -0
@@ -300,7 +301,7 @@ static void 

blkverify_verify_readv(BlkverifyAIOCB
*acb)
ssize_t offset =
blkverify_iovec_compare(acb->qiov,&acb->raw_qiov);
if (offset != -1) {
blkverify_err(acb, "contents mismatch in sector %ld",
- acb->sector_num + (offset /
BDRV_SECTOR_SIZE));
+ (long)(acb->sector_num + (offset /
BDRV_SECTOR_SIZE)));

sector_num is int64_t, so the correct fix is to change '%ld' to '%" PRId64'.

Quoted 3 lines

I noticed that, too. But offset is ssize_t.
Can you always be sure that (int64_t + ssize_t) results in a int64_t? I don't think it's so easy.

I think you are correct, the format should use PRId64. The type cast is still necessary, but should cast to int64_t. (needed when int64_t == long and ssize_t == long long).

Quoted 5 lines
Quoted 1 line

If you agree, I'll send a new patch.

It's also possible to cast offset to int64_t. Or perhaps even the type of the return value of blkverify_iovec_compare should be changed to int64_t.

Quoted 6 lines

Unless BDRV_SECTOR_SIZE is changed, too, this would still need a type cast. So we have two possible solutions:

(1) Use %lld (should work because BDRV_SECTOR_SIZE is unsigned long long).
(2) Use PRId64. This needs changes for BDRV_SECTOR_SIZE and blkverify_iovec_compare.

Or
(3) Use PRId64, change blkverify_iovec_compare, leave BDRV_SECTOR_SIZE unchanged but add a cast to int64_t here.

Quoted 6 lines

Grepping for BDRV_SECTOR_SIZE shows that it is used in several places in size_t or off_t expressions, so long long is as good as any other large type.

I think Kevin should decide.

BDRV_SECTOR_MASK is the critical value. This should work:

#define BDRV_SECTOR_SIZE 512
#define BDRV_SECTOR_MASK (int64_t)(~(511ULL))

#9 lore raw
In reply to Blue Swirl

Am 25.09.2010 10:01, schrieb Blue Swirl:

Quoted 75 lines · Stefan Weil
Quoted 63 lines

Am 23.09.2010 22:24, schrieb Blue Swirl:

Quoted 54 lines · Stefan Weil
Quoted 53 lines

Am 23.09.2010 21:03, schrieb Stefan Weil:

Quoted 42 lines

Am 23.09.2010 20:53, schrieb Blue Swirl:

Quoted 27 lines
Quoted 24 lines · Stefan Weil

Adding the gcc format attribute detects a format bug which is fixed here.

---
  block/blkverify.c |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)
block/blkverify.c +2 -1
index 8083464..b39fb67 100644
@@ -53,7 +53,8 @@ static AIOPool blkverify_aio_pool = {
    .cancel             = blkverify_aio_cancel,
  };
 
-static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
+                                             const char *fmt, ...)
  {
    va_list ap;
 
Quoted 13 lines

block/blkverify.c static void blkverify_verify_readv(BlkverifyAIOCB · line 307

Quoted 9 lines
block/blkverify.c +1 -1
@@ -300,7 +301,7 @@ static void blkverify_verify_readv(BlkverifyAIOCB
 *acb)
    ssize_t offset = blkverify_iovec_compare(acb->qiov,&acb->raw_qiov);
    if (offset != -1) {
        blkverify_err(acb, "contents mismatch in sector %ld",
-                      acb->sector_num + (offset / BDRV_SECTOR_SIZE));
+                      (long)(acb->sector_num + (offset /
 BDRV_SECTOR_SIZE)));
 

sector_num is int64_t, so the correct fix is to change '%ld' to '%" PRId64'.

Quoted 4 lines

I noticed that, too. But offset is ssize_t.
Can you always be sure that (int64_t + ssize_t) results in a int64_t? I don't think it's so easy.

I think you are correct, the format should use PRId64. The type cast is still necessary, but should cast to int64_t. (needed when int64_t == long and ssize_t == long long).

Quoted 6 lines
Quoted 2 lines

If you agree, I'll send a new patch.

It's also possible to cast offset to int64_t. Or perhaps even the type of the return value of blkverify_iovec_compare should be changed to int64_t.

Quoted 7 lines

Unless BDRV_SECTOR_SIZE is changed, too, this would still need a type cast. So we have two possible solutions:

(1) Use %lld (should work because BDRV_SECTOR_SIZE is unsigned long long).
(2) Use PRId64. This needs changes for BDRV_SECTOR_SIZE and blkverify_iovec_compare.

Or
(3) Use PRId64, change blkverify_iovec_compare, leave BDRV_SECTOR_SIZE unchanged but add a cast to int64_t here.

Quoted 6 lines

Grepping for BDRV_SECTOR_SIZE shows that it is used in several places in size_t or off_t expressions, so long long is as good as any other large type.

I think Kevin should decide.

Kevin, how should this get fixed?

I suggest committing my last patch version sent on 2010-09-24 ("[PATCH] block: Use GCC_FMT_ATTR and fix a format error"), but I don't mind if you have a different solution.

Regards,
Stefan

#10 lore raw

Am 13.10.2010 21:06, schrieb Stefan Weil:

Quoted 80 lines

Am 25.09.2010 10:01, schrieb Blue Swirl:

Quoted 79 lines · Stefan Weil
Quoted 63 lines

Am 23.09.2010 22:24, schrieb Blue Swirl:

Quoted 54 lines · Stefan Weil
Quoted 53 lines

Am 23.09.2010 21:03, schrieb Stefan Weil:

Quoted 42 lines

Am 23.09.2010 20:53, schrieb Blue Swirl:

Quoted 27 lines
Quoted 24 lines · Stefan Weil

Adding the gcc format attribute detects a format bug which is fixed here.

---
  block/blkverify.c |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)
block/blkverify.c +2 -1
index 8083464..b39fb67 100644
@@ -53,7 +53,8 @@ static AIOPool blkverify_aio_pool = {
    .cancel             = blkverify_aio_cancel,
  };
 
-static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
+                                             const char *fmt, ...)
  {
    va_list ap;
 
Quoted 13 lines

block/blkverify.c static void blkverify_verify_readv(BlkverifyAIOCB · line 307

Quoted 9 lines
block/blkverify.c +1 -1
@@ -300,7 +301,7 @@ static void blkverify_verify_readv(BlkverifyAIOCB
 *acb)
    ssize_t offset = blkverify_iovec_compare(acb->qiov,&acb->raw_qiov);
    if (offset != -1) {
        blkverify_err(acb, "contents mismatch in sector %ld",
-                      acb->sector_num + (offset / BDRV_SECTOR_SIZE));
+                      (long)(acb->sector_num + (offset /
 BDRV_SECTOR_SIZE)));
 

sector_num is int64_t, so the correct fix is to change '%ld' to '%" PRId64'.

Quoted 4 lines

I noticed that, too. But offset is ssize_t.
Can you always be sure that (int64_t + ssize_t) results in a int64_t? I don't think it's so easy.

I think you are correct, the format should use PRId64. The type cast is still necessary, but should cast to int64_t. (needed when int64_t == long and ssize_t == long long).

Quoted 6 lines
Quoted 2 lines

If you agree, I'll send a new patch.

It's also possible to cast offset to int64_t. Or perhaps even the type of the return value of blkverify_iovec_compare should be changed to int64_t.

Quoted 7 lines

Unless BDRV_SECTOR_SIZE is changed, too, this would still need a type cast. So we have two possible solutions:

(1) Use %lld (should work because BDRV_SECTOR_SIZE is unsigned long long).
(2) Use PRId64. This needs changes for BDRV_SECTOR_SIZE and blkverify_iovec_compare.

Or
(3) Use PRId64, change blkverify_iovec_compare, leave BDRV_SECTOR_SIZE unchanged but add a cast to int64_t here.

Grepping for BDRV_SECTOR_SIZE shows that it is used in several places in size_t or off_t expressions, so long long is as good as any other large type.

Quoted 8 lines
Quoted 2 lines

I think Kevin should decide.

Kevin, how should this get fixed?

I suggest committing my last patch version sent on 2010-09-24 ("[PATCH] block: Use GCC_FMT_ATTR and fix a format error"), but I don't mind if you have a different solution.

I think I would have used PRId64 and cast the whole thing to int64_t, but I don't really care as long as it works. I haven't heard any complaints about your patch being broken, and nobody else has sent a different patch, so I'll apply it.

Kevin