]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: rados get takes --offset now 56420/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 22 Mar 2024 18:28:56 +0000 (18:28 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 22 Mar 2024 20:16:32 +0000 (20:16 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/tools/rados/rados.cc

index e6c5819666a7effeb4f8d15d1421eec1c9a69eb0..4eb84bcabaf8c61dfc6a72e0c7cbeea1366f4c47 100644 (file)
@@ -101,7 +101,8 @@ void usage(ostream& out)
 "   rmsnap <snap-name>               remove snap <snap-name>\n"
 "\n"
 "OBJECT COMMANDS\n"
-"   get <obj-name> <outfile>         fetch object\n"
+"   get <obj-name> <outfile> [--offset offset]\n"
+"                                    fetch object with start offset (default:0)\n"
 "   put <obj-name> <infile> [--offset offset]\n"
 "                                    write object with start offset (default:0)\n"
 "   append <obj-name> <infile>       append object\n"
@@ -482,7 +483,7 @@ static int dump_data(std::string const &filename, bufferlist const &data)
 }
 
 
-static int do_get(IoCtx& io_ctx, const std::string& oid, const char *outfile, unsigned op_size, [[maybe_unused]] const bool use_striper)
+static int do_get(IoCtx& io_ctx, const std::string& oid, const char *outfile, uint64_t offset, unsigned op_size, [[maybe_unused]] const bool use_striper)
 {
   int fd;
   if (strcmp(outfile, "-") == 0) {
@@ -496,7 +497,6 @@ static int do_get(IoCtx& io_ctx, const std::string& oid, const char *outfile, un
     }
   }
 
-  uint64_t offset = 0;
   int ret;
   while (true) {
     bufferlist outdata;
@@ -2623,7 +2623,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
       obj_name = nargs[1];
       out_filename = nargs[2];
     }
-    ret = do_get(io_ctx, *obj_name, out_filename, op_size, use_striper);
+    ret = do_get(io_ctx, *obj_name, out_filename, obj_offset, op_size, use_striper);
     if (ret < 0) {
       cerr << "error getting " << pool_name << "/" << prettify(*obj_name) << ": " << cpp_strerror(ret) << std::endl;
       return 1;