]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw,test: Add missing init_le calls
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 2 Sep 2019 19:27:56 +0000 (21:27 +0200)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 5 Sep 2019 08:50:04 +0000 (10:50 +0200)
Add calls to init_le16/32/64 to properly byte-swap values on
big-endian systems when assigning to ceph_le16/32/64 variables.

Fixes (partially): https://tracker.ceph.com/issues/41605

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
src/cls/rgw/cls_rgw_types.cc
src/cls/rgw/cls_rgw_types.h
src/rgw/rgw_dencoder.cc
src/test/common/test_time.cc

index 969153b0aa3114d11c3131e14af076085e98d8d1..a2d1880864a799e647901a3ec0b4a618e53de78b 100644 (file)
@@ -481,7 +481,7 @@ void rgw_bi_log_entry::generate_test_instances(list<rgw_bi_log_entry*>& ls)
   ls.push_back(new rgw_bi_log_entry);
   ls.back()->id = "midf";
   ls.back()->object = "obj";
-  ls.back()->timestamp = ceph::real_clock::from_ceph_timespec({{2}, {3}});
+  ls.back()->timestamp = ceph::real_clock::from_ceph_timespec({init_le32(2), init_le32(3)});
   ls.back()->index_ver = 4323;
   ls.back()->tag = "tagasdfds";
   ls.back()->op = CLS_RGW_OP_DEL;
@@ -663,7 +663,7 @@ void cls_rgw_reshard_entry::generate_test_instances(list<cls_rgw_reshard_entry*>
 {
   ls.push_back(new cls_rgw_reshard_entry);
   ls.push_back(new cls_rgw_reshard_entry);
-  ls.back()->time = ceph::real_clock::from_ceph_timespec({{2}, {3}});
+  ls.back()->time = ceph::real_clock::from_ceph_timespec({init_le32(2), init_le32(3)});
   ls.back()->tenant = "tenant";
   ls.back()->bucket_name = "bucket1""";
   ls.back()->bucket_id = "bucket_id";
index 7fb845b76620f1c090a7628ccc4682309551ad11..cdeb1301f613a9371ef1624a4defc088fecd897a 100644 (file)
@@ -1094,7 +1094,7 @@ struct cls_rgw_gc_obj_info
     ls.push_back(new cls_rgw_gc_obj_info);
     ls.push_back(new cls_rgw_gc_obj_info);
     ls.back()->tag = "footag";
-    ceph_timespec ts{21, 32};
+    ceph_timespec ts{init_le32(21), init_le32(32)};
     ls.back()->time = ceph::real_clock::from_ceph_timespec(ts);
   }
 };
index 461741ce5d90882eba9065d44af081e3c2c8b32f..7a6eff7113f68dd12f993be62cb963c3b12ed656 100644 (file)
@@ -585,7 +585,7 @@ void RGWBucketEntryPoint::generate_test_instances(list<RGWBucketEntryPoint*>& o)
   RGWBucketEntryPoint *bp = new RGWBucketEntryPoint();
   init_bucket(&bp->bucket, "tenant", "bucket", "pool", ".index.pool", "marker", "10");
   bp->owner = "owner";
-  bp->creation_time = ceph::real_clock::from_ceph_timespec({{2}, {3}});
+  bp->creation_time = ceph::real_clock::from_ceph_timespec({init_le32(2), init_le32(3)});
 
   o.push_back(bp);
   o.push_back(new RGWBucketEntryPoint);
index a643337d4ae7f6ae42c3ac6e835c6d0531daf7ef..347916114bf398d76ffd8b1545a19590d8f9a1f3 100644 (file)
@@ -51,7 +51,7 @@ static constexpr uint32_t bns = 123456789;
 static constexpr uint32_t bus = 123456;
 static constexpr time_t btt = bs;
 static constexpr struct timespec bts = { bs, bns };
-static constexpr struct ceph_timespec bcts = { bs, bns };
+static struct ceph_timespec bcts = { init_le32(bs), init_le32(bns) };
 static constexpr struct timeval btv = { bs, bus };
 static constexpr double bd = bs + ((double)bns / 1000000000.);