]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
inttypes: use portable types in public headers
authorNoah Watkins <noahwatkins@gmail.com>
Sun, 29 Dec 2013 20:54:48 +0000 (12:54 -0800)
committerNoah Watkins <noahwatkins@gmail.com>
Sun, 29 Dec 2013 21:35:58 +0000 (13:35 -0800)
loff_t -> int64_t
  __u8 -> uint8_t

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
src/include/cephfs/libcephfs.h
src/include/rados/librados.hpp
src/libcephfs.cc
src/test/libcephfs/test.cc

index ded4e1e120a4b18f99aa0f7a7842c55793f2643c..1370021ef57cc1268def122abf25c63d36d5a0cf 100644 (file)
@@ -375,7 +375,7 @@ void ceph_rewinddir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp
  *          by ceph_telldir do not have a particular order (cannot be compared with
  *          inequality).
  */
-loff_t ceph_telldir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp);
+int64_t ceph_telldir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp);
 
 /**
  * Move the directory stream to a position specified by the given offset.
@@ -386,7 +386,7 @@ loff_t ceph_telldir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp
  *        a value returned by seekdir.  Note that this value does not refer to the nth
  *        entry in a directory, and can not be manipulated with plus or minus.
  */
-void ceph_seekdir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp, loff_t offset);
+void ceph_seekdir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp, int64_t offset);
 
 /**
  * Create a directory.
@@ -447,7 +447,7 @@ int ceph_link(struct ceph_mount_info *cmount, const char *existing, const char *
  * @param size the length of the buffer
  * @returns 0 on success or negative error code on failure
  */
-int ceph_readlink(struct ceph_mount_info *cmount, const char *path, char *buf, loff_t size);
+int ceph_readlink(struct ceph_mount_info *cmount, const char *path, char *buf, int64_t size);
 
 /**
  * Creates a symbolic link.
@@ -591,7 +591,7 @@ int ceph_utime(struct ceph_mount_info *cmount, const char *path, struct utimbuf
  * @param size the new size of the file.
  * @returns 0 on success or a negative error code on failure.
  */
-int ceph_truncate(struct ceph_mount_info *cmount, const char *path, loff_t size);
+int ceph_truncate(struct ceph_mount_info *cmount, const char *path, int64_t size);
 
 /**
  * Make a block or character special file.
@@ -660,7 +660,7 @@ int ceph_close(struct ceph_mount_info *cmount, int fd);
  *      SEEK_END: the offset is set to the end of the file plus @ref offset bytes.
  * @returns 0 on success or a negative error code on failure.
  */
-loff_t ceph_lseek(struct ceph_mount_info *cmount, int fd, loff_t offset, int whence);
+int64_t ceph_lseek(struct ceph_mount_info *cmount, int fd, int64_t offset, int whence);
 /**
  * Read data from the file.
  *
@@ -672,7 +672,7 @@ loff_t ceph_lseek(struct ceph_mount_info *cmount, int fd, loff_t offset, int whe
  *        function reads from the current offset of the file descriptor.
  * @returns the number of bytes read into buf, or a negative error code on failure.
  */
-int ceph_read(struct ceph_mount_info *cmount, int fd, char *buf, loff_t size, loff_t offset);
+int ceph_read(struct ceph_mount_info *cmount, int fd, char *buf, int64_t size, int64_t offset);
 
 /**
  * Write data to a file.
@@ -685,8 +685,8 @@ int ceph_read(struct ceph_mount_info *cmount, int fd, char *buf, loff_t size, lo
  *        function writes to the current offset of the file descriptor.
  * @returns the number of bytes written, or a negative error code
  */
-int ceph_write(struct ceph_mount_info *cmount, int fd, const char *buf, loff_t size,
-              loff_t offset);
+int ceph_write(struct ceph_mount_info *cmount, int fd, const char *buf, int64_t size,
+              int64_t offset);
 
 /**
  * Truncate a file to the given size.
@@ -696,7 +696,7 @@ int ceph_write(struct ceph_mount_info *cmount, int fd, const char *buf, loff_t s
  * @param size the new size of the file
  * @returns 0 on success or a negative error code on failure.
  */
-int ceph_ftruncate(struct ceph_mount_info *cmount, int fd, loff_t size);
+int ceph_ftruncate(struct ceph_mount_info *cmount, int fd, int64_t size);
 
 /**
  * Synchronize an open file to persistent media.
@@ -725,7 +725,7 @@ int ceph_fsync(struct ceph_mount_info *cmount, int fd, int syncdataonly);
  * @return 0 on success or a negative error code on failure.
  */
 int ceph_fallocate(struct ceph_mount_info *cmount, int fd, int mode,
-                             loff_t offset, loff_t length);
+                             int64_t offset, int64_t length);
 
 /**
  * Get the open file's statistics.
@@ -1046,7 +1046,7 @@ int ceph_get_pool_replication(struct ceph_mount_info *cmount, int pool_id);
  * @returns the size of the addressed filled into the @ref addr parameter, or a negative
  *     error code on failure.
  */
-int ceph_get_file_stripe_address(struct ceph_mount_info *cmount, int fd, loff_t offset,
+int ceph_get_file_stripe_address(struct ceph_mount_info *cmount, int fd, int64_t offset,
                                 struct sockaddr_storage *addr, int naddr);
 
 /**
@@ -1063,7 +1063,7 @@ int ceph_get_file_stripe_address(struct ceph_mount_info *cmount, int fd, loff_t
  * array is not large enough.
  */
 int ceph_get_file_extent_osds(struct ceph_mount_info *cmount, int fh,
-                              loff_t offset, loff_t *length, int *osds, int nosds);
+                              int64_t offset, int64_t *length, int *osds, int nosds);
 
 /**
  * Get the fully qualified CRUSH location of an OSD.
index 2030fb15608d84a6c5b06a9a9c3f75a1ebc8506b..106c6f87ec5a093257e198936f9f3980f1ff0bae 100644 (file)
@@ -848,10 +848,10 @@ namespace librados
 
     int pool_create(const char *name);
     int pool_create(const char *name, uint64_t auid);
-    int pool_create(const char *name, uint64_t auid, __u8 crush_rule);
+    int pool_create(const char *name, uint64_t auid, uint8_t crush_rule);
     int pool_create_async(const char *name, PoolAsyncCompletion *c);
     int pool_create_async(const char *name, uint64_t auid, PoolAsyncCompletion *c);
-    int pool_create_async(const char *name, uint64_t auid, __u8 crush_rule, PoolAsyncCompletion *c);
+    int pool_create_async(const char *name, uint64_t auid, uint8_t crush_rule, PoolAsyncCompletion *c);
     int pool_delete(const char *name);
     int pool_delete_async(const char *name, PoolAsyncCompletion *c);
     int64_t pool_lookup(const char *name);
index 86f9763478122b7e9be7f29cb382b1945830efc1..cc24a31a5fa1320e8237e9c573fb7724fde6a615 100644 (file)
@@ -419,14 +419,14 @@ extern "C" void ceph_rewinddir(struct ceph_mount_info *cmount, struct ceph_dir_r
   cmount->get_client()->rewinddir((dir_result_t*)dirp);
 }
 
-extern "C" loff_t ceph_telldir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp)
+extern "C" int64_t ceph_telldir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp)
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
   return cmount->get_client()->telldir((dir_result_t*)dirp);
 }
 
-extern "C" void ceph_seekdir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp, loff_t offset)
+extern "C" void ceph_seekdir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp, int64_t offset)
 {
   if (!cmount->is_mounted())
     return;
@@ -480,7 +480,7 @@ extern "C" int ceph_rmdir(struct ceph_mount_info *cmount, const char *path)
 
 // symlinks
 extern "C" int ceph_readlink(struct ceph_mount_info *cmount, const char *path,
-                            char *buf, loff_t size)
+                            char *buf, int64_t size)
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
@@ -622,7 +622,7 @@ extern "C" int ceph_utime(struct ceph_mount_info *cmount, const char *path,
 }
 
 extern "C" int ceph_truncate(struct ceph_mount_info *cmount, const char *path,
-                            loff_t size)
+                            int64_t size)
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
@@ -662,8 +662,8 @@ extern "C" int ceph_close(struct ceph_mount_info *cmount, int fd)
   return cmount->get_client()->close(fd);
 }
 
-extern "C" loff_t ceph_lseek(struct ceph_mount_info *cmount, int fd,
-                            loff_t offset, int whence)
+extern "C" int64_t ceph_lseek(struct ceph_mount_info *cmount, int fd,
+                            int64_t offset, int whence)
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
@@ -671,7 +671,7 @@ extern "C" loff_t ceph_lseek(struct ceph_mount_info *cmount, int fd,
 }
 
 extern "C" int ceph_read(struct ceph_mount_info *cmount, int fd, char *buf,
-                        loff_t size, loff_t offset)
+                        int64_t size, int64_t offset)
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
@@ -679,14 +679,14 @@ extern "C" int ceph_read(struct ceph_mount_info *cmount, int fd, char *buf,
 }
 
 extern "C" int ceph_write(struct ceph_mount_info *cmount, int fd, const char *buf,
-                         loff_t size, loff_t offset)
+                         int64_t size, int64_t offset)
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
   return cmount->get_client()->write(fd, buf, size, offset);
 }
 
-extern "C" int ceph_ftruncate(struct ceph_mount_info *cmount, int fd, loff_t size)
+extern "C" int ceph_ftruncate(struct ceph_mount_info *cmount, int fd, int64_t size)
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
@@ -701,7 +701,7 @@ extern "C" int ceph_fsync(struct ceph_mount_info *cmount, int fd, int syncdataon
 }
 
 extern "C" int ceph_fallocate(struct ceph_mount_info *cmount, int fd, int mode,
-                             loff_t offset, loff_t length)
+                             int64_t offset, int64_t length)
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
@@ -982,7 +982,7 @@ extern "C" int ceph_set_default_preferred_pg(struct ceph_mount_info *cmount, int
 }
 
 extern "C" int ceph_get_file_extent_osds(struct ceph_mount_info *cmount, int fh,
-    loff_t offset, loff_t *length, int *osds, int nosds)
+    int64_t offset, int64_t *length, int *osds, int nosds)
 {
   if (nosds < 0)
     return -EINVAL;
@@ -1065,7 +1065,7 @@ extern "C" int ceph_get_osd_addr(struct ceph_mount_info *cmount, int osd,
 }
 
 extern "C" int ceph_get_file_stripe_address(struct ceph_mount_info *cmount, int fh,
-                                           loff_t offset, struct sockaddr_storage *addr, int naddr)
+                                           int64_t offset, struct sockaddr_storage *addr, int naddr)
 {
   vector<entity_addr_t> address;
   unsigned i;
index 597d049e2a44698d3df5ca559f201bdb7f85be89..a5fac4178e366c5f6f947759bd15b9c3d6934797 100644 (file)
@@ -1021,24 +1021,24 @@ TEST(LibCephFS, GetExtentOsds) {
   int ret = ceph_get_file_extent_osds(cmount, fd, 0, NULL, NULL, 0);
   EXPECT_GT(ret, 0);
 
-  loff_t len;
+  int64_t len;
   int osds[ret];
 
   /* full stripe extent */
   EXPECT_EQ(ret, ceph_get_file_extent_osds(cmount, fd, 0, &len, osds, ret));
-  EXPECT_EQ(len, (loff_t)stripe_unit);
+  EXPECT_EQ(len, (int64_t)stripe_unit);
 
   /* half stripe extent */
   EXPECT_EQ(ret, ceph_get_file_extent_osds(cmount, fd, stripe_unit/2, &len, osds, ret));
-  EXPECT_EQ(len, (loff_t)stripe_unit/2);
+  EXPECT_EQ(len, (int64_t)stripe_unit/2);
 
   /* 1.5 stripe unit offset -1 byte */
   EXPECT_EQ(ret, ceph_get_file_extent_osds(cmount, fd, 3*stripe_unit/2-1, &len, osds, ret));
-  EXPECT_EQ(len, (loff_t)stripe_unit/2+1);
+  EXPECT_EQ(len, (int64_t)stripe_unit/2+1);
 
   /* 1.5 stripe unit offset +1 byte */
   EXPECT_EQ(ret, ceph_get_file_extent_osds(cmount, fd, 3*stripe_unit/2+1, &len, osds, ret));
-  EXPECT_EQ(len, (loff_t)stripe_unit/2-1);
+  EXPECT_EQ(len, (int64_t)stripe_unit/2-1);
 
   /* only when more than 1 osd */
   if (ret > 1)