]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: use MIN instead of min()
authorSage Weil <sage@newdream.net>
Wed, 1 Dec 2010 17:51:27 +0000 (09:51 -0800)
committerSage Weil <sage@newdream.net>
Wed, 1 Dec 2010 18:20:24 +0000 (10:20 -0800)
Not even sure where min() was coming from, but it seems to be missing on
i386 lucid.:

g++ -DHAVE_CONFIG_H -I.     -Wall -D__CEPH__ -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_THREAD_SAFE -rdynamic -g -O2 -MT rbd.o -MD -MP -MF .deps/rbd.Tpo -c -o rbd.o rbd.cc
rbd.cc: In function 'int do_import(void*, const char*, int, const char*)':
rbd.cc:837: error: no matching function for call to 'min(uint64_t&, off_t)'
make[3]: *** [rbd.o] Error 1

Reported-by: John Leach <john@johnleach.co.uk>
Signed-off-by: Sage Weil <sage@newdream.net>
src/rbd.cc

index fe4797f250f2426bab765dbe2587d224f9ea7187..a6dcb7d7f51d6871cd49f782b91133a7520b60ec 100644 (file)
@@ -20,6 +20,7 @@
 using namespace librados;
 #include "include/byteorder.h"
 
+#include "include/intarith.h"
 
 #include <errno.h>
 #include <inttypes.h>
@@ -834,7 +835,7 @@ static int do_import(pool_t pool, const char *imgname, int order, const char *pa
         break; /* don't try to merge if we're big enough */
 
       extent_len += fiemap->fm_extents[extent].fe_length;  /* length of current extent */
-      end_ofs = min(size, file_pos + extent_len);
+      end_ofs = MIN(size, file_pos + extent_len);
 
       end_block = get_block_num(&header, end_ofs - 1); /* ending block */