diff mbox series

[blktests] fix discontiguous-io compile error on 32 bit systems

Message ID 1541054148-144718-1-git-send-email-yuyufen@huawei.com (mailing list archive)
State New, archived
Headers show
Series [blktests] fix discontiguous-io compile error on 32 bit systems | expand

Commit Message

Yufen Yu Nov. 1, 2018, 6:35 a.m. UTC
When make discontiguous-io.cpp with -m32, g++ compiler reports
error for std::min(long unsigned int, size_t) has diffent
arguments type.

fixes: fd21728886e7 ("Add the discontiguous-io test program")
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 src/discontiguous-io.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bart Van Assche Nov. 1, 2018, 2:52 p.m. UTC | #1
On Thu, 2018-11-01 at 14:35 +0800, Yufen Yu wrote:
> When make discontiguous-io.cpp with -m32, g++ compiler reports
> error for std::min(long unsigned int, size_t) has diffent
> arguments type.
> 
> fixes: fd21728886e7 ("Add the discontiguous-io test program")
> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> ---
>  src/discontiguous-io.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/discontiguous-io.cpp b/src/discontiguous-io.cpp
> index 5e0ee0f..855aba9 100644
> --- a/src/discontiguous-io.cpp
> +++ b/src/discontiguous-io.cpp
> @@ -291,7 +291,7 @@ int main(int argc, char **argv)
>  			unsigned char *p = &*buf.begin();
>  			for (int i = 0; i < len / 4; i++)
>  				iov.append(p + 4 + i * 8,
> -					   std::min(4ul, len - i * 4));
> +					   std::min((size_t)4, len - i * 4));
>  		} else {
>  			iov.append(&*buf.begin(), buf.size());
>  		}

Are you reading the messages posted on linux-block? An alternative that I like
better has been discussed in this e-mail thread:
https://www.spinics.net/lists/linux-block/msg32181.html

Bart.
Yufen Yu Nov. 6, 2018, 2:19 a.m. UTC | #2
On 2018/11/1 22:52, Bart Van Assche wrote:
> On Thu, 2018-11-01 at 14:35 +0800, Yufen Yu wrote:
>> When make discontiguous-io.cpp with -m32, g++ compiler reports
>> error for std::min(long unsigned int, size_t) has diffent
>> arguments type.
>>
>> fixes: fd21728886e7 ("Add the discontiguous-io test program")
>> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
>> ---
>>   src/discontiguous-io.cpp | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/discontiguous-io.cpp b/src/discontiguous-io.cpp
>> index 5e0ee0f..855aba9 100644
>> --- a/src/discontiguous-io.cpp
>> +++ b/src/discontiguous-io.cpp
>> @@ -291,7 +291,7 @@ int main(int argc, char **argv)
>>   			unsigned char *p = &*buf.begin();
>>   			for (int i = 0; i < len / 4; i++)
>>   				iov.append(p + 4 + i * 8,
>> -					   std::min(4ul, len - i * 4));
>> +					   std::min((size_t)4, len - i * 4));
>>   		} else {
>>   			iov.append(&*buf.begin(), buf.size());
>>   		}
> Are you reading the messages posted on linux-block? An alternative that I like
> better has been discussed in this e-mail thread:
> https://www.spinics.net/lists/linux-block/msg32181.html
>
> Bart.
>
> .
>

I am sorry that I did not see the discussion before this.
And you are right. Please ignore this patch.

Yufen.
thanks
Bart Van Assche Nov. 6, 2018, 3:29 a.m. UTC | #3
On 11/5/18 6:19 PM, yuyufen wrote:
> I am sorry that I did not see the discussion before this.
> And you are right. Please ignore this patch.

Don't worry - this can happen :-)

Bart.
diff mbox series

Patch

diff --git a/src/discontiguous-io.cpp b/src/discontiguous-io.cpp
index 5e0ee0f..855aba9 100644
--- a/src/discontiguous-io.cpp
+++ b/src/discontiguous-io.cpp
@@ -291,7 +291,7 @@  int main(int argc, char **argv)
 			unsigned char *p = &*buf.begin();
 			for (int i = 0; i < len / 4; i++)
 				iov.append(p + 4 + i * 8,
-					   std::min(4ul, len - i * 4));
+					   std::min((size_t)4, len - i * 4));
 		} else {
 			iov.append(&*buf.begin(), buf.size());
 		}