]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
buffer: use int64_t instead of loff_t 916/head
authorNoah Watkins <noahwatkins@gmail.com>
Fri, 6 Dec 2013 19:09:51 +0000 (11:09 -0800)
committerNoah Watkins <noahwatkins@gmail.com>
Fri, 20 Dec 2013 16:21:43 +0000 (08:21 -0800)
Because portability.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
src/common/buffer.cc
src/include/buffer.h
src/test/bufferlist.cc

index 69e4c85b1b27d887dcb710284334ad56bc4bc6bd..be74879e71eb53597b34001e9b26d7b60ee1a4fe 100644 (file)
@@ -525,10 +525,10 @@ static uint32_t simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZE
 #endif
   }
 
-  buffer::raw* buffer::create_zero_copy(unsigned len, int fd, loff_t *offset) {
+  buffer::raw* buffer::create_zero_copy(unsigned len, int fd, int64_t *offset) {
 #ifdef CEPH_HAVE_SPLICE
     buffer::raw_pipe* buf = new raw_pipe(len);
-    int r = buf->set_source(fd, offset);
+    int r = buf->set_source(fd, (loff_t*)offset);
     if (r < 0) {
       delete buf;
       throw error_code(r);
@@ -733,9 +733,9 @@ static uint32_t simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZE
     return _raw->can_zero_copy();
   }
 
-  int buffer::ptr::zero_copy_to_fd(int fd, loff_t *offset) const
+  int buffer::ptr::zero_copy_to_fd(int fd, int64_t *offset) const
   {
-    return _raw->zero_copy_to_fd(fd, offset);
+    return _raw->zero_copy_to_fd(fd, (loff_t*)offset);
   }
 
   // -- buffer::list::iterator --
@@ -1629,8 +1629,8 @@ int buffer::list::write_fd_zero_copy(int fd) const
   /* pass offset to each call to avoid races updating the fd seek
    * position, since the I/O may be non-blocking
    */
-  loff_t offset = ::lseek(fd, 0, SEEK_CUR);
-  loff_t *off_p = &offset;
+  int64_t offset = ::lseek(fd, 0, SEEK_CUR);
+  int64_t *off_p = &offset;
   if (offset < 0 && offset != ESPIPE)
     return (int) offset;
   if (offset == ESPIPE)
index 2d2e8e467fa9c79f3384fa2df382caa7cea8857c..e1366463795f0d515ddbe887275b9446a499f5b9 100644 (file)
@@ -157,7 +157,7 @@ public:
   static raw* claim_malloc(unsigned len, char *buf);
   static raw* create_static(unsigned len, char *buf);
   static raw* create_page_aligned(unsigned len);
-  static raw* create_zero_copy(unsigned len, int fd, loff_t *offset);
+  static raw* create_zero_copy(unsigned len, int fd, int64_t *offset);
 
   /*
    * a buffer pointer.  references (a subsequence of) a raw buffer.
@@ -216,7 +216,7 @@ public:
     }
 
     bool can_zero_copy() const;
-    int zero_copy_to_fd(int fd, loff_t *offset) const;
+    int zero_copy_to_fd(int fd, int64_t *offset) const;
 
     unsigned wasted();
 
index 85af76486f54534e7d1e05dc8f05384b828c4cee..3809ba15da126111d890c74e06782a4f1ba77dd8 100644 (file)
@@ -240,7 +240,7 @@ TEST_F(TestRawPipe, c_str_source_short) {
 }
 
 TEST_F(TestRawPipe, c_str_explicit_zero_offset) {
-  loff_t offset = 0;
+  int64_t offset = 0;
   ::lseek(fd, 1, SEEK_SET);
   bufferptr ptr = bufferptr(buffer::create_zero_copy(len, fd, &offset));
   EXPECT_EQ(len, offset);
@@ -249,7 +249,7 @@ TEST_F(TestRawPipe, c_str_explicit_zero_offset) {
 }
 
 TEST_F(TestRawPipe, c_str_explicit_positive_offset) {
-  loff_t offset = 1;
+  int64_t offset = 1;
   bufferptr ptr = bufferptr(buffer::create_zero_copy(len - offset, fd,
                                                     &offset));
   EXPECT_EQ(len, offset);
@@ -258,7 +258,7 @@ TEST_F(TestRawPipe, c_str_explicit_positive_offset) {
 }
 
 TEST_F(TestRawPipe, c_str_explicit_positive_empty_result) {
-  loff_t offset = len;
+  int64_t offset = len;
   bufferptr ptr = bufferptr(buffer::create_zero_copy(len - offset, fd,
                                                     &offset));
   EXPECT_EQ(len, offset);
@@ -266,7 +266,7 @@ TEST_F(TestRawPipe, c_str_explicit_positive_empty_result) {
 }
 
 TEST_F(TestRawPipe, c_str_source_short_explicit_offset) {
-  loff_t offset = 1;
+  int64_t offset = 1;
   bufferptr ptr = bufferptr(buffer::create_zero_copy(len, fd, &offset));
   EXPECT_EQ(len, offset);
   EXPECT_EQ(len - 1, ptr.length());
@@ -274,7 +274,7 @@ TEST_F(TestRawPipe, c_str_source_short_explicit_offset) {
 }
 
 TEST_F(TestRawPipe, c_str_dest_short_explicit_offset) {
-  loff_t offset = 1;
+  int64_t offset = 1;
   bufferptr ptr = bufferptr(buffer::create_zero_copy(2, fd, &offset));
   EXPECT_EQ(3, offset);
   EXPECT_EQ(2u, ptr.length());