Skip to content

Commit 5735980

Browse files
committed
rgw: migrate rgw_admin to new directory.
Some C++ fixes, macro fixes, etc.. Gathers other core files, makes names more closely match executable. Signed-off-by: Jesse F. Williamson <[email protected]>
1 parent 3ec1e93 commit 5735980

File tree

7 files changed

+34
-32
lines changed

7 files changed

+34
-32
lines changed

src/rgw/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,9 @@ target_link_libraries(radosgw PRIVATE
487487
install(TARGETS radosgw DESTINATION bin)
488488

489489
set(radosgw_admin_srcs
490-
rgw_admin.cc
491-
rgw_sync_checkpoint.cc
492-
rgw_orphan.cc)
490+
radosgw-admin/radosgw-admin.cc
491+
radosgw-admin/sync_checkpoint.cc
492+
radosgw-admin/orphan.cc)
493493

494494
# this is unsatisfying and hopefully temporary; ARROW should not be
495495
# part of radosgw_admin

src/rgw/driver/rados/rgw_user.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919

2020
#define RGW_USER_ANON_ID "anonymous"
2121

22-
#define SECRET_KEY_LEN 40
23-
#define PUBLIC_ID_LEN 20
24-
#define RAND_SUBUSER_LEN 5
22+
constexpr auto SECRET_KEY_LEN=40;
23+
constexpr auto PUBLIC_ID_LEN=20;
24+
constexpr auto RAND_SUBUSER_LEN=5;
2525

26-
#define XMLNS_AWS_S3 "http://s3.amazonaws.com/doc/2006-03-01/"
26+
constexpr auto XMLNS_AWS_S3 = "http://s3.amazonaws.com/doc/2006-03-01/";
2727

2828
class RGWUserCtl;
2929
class RGWBucketCtl;
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
2+
/*
3+
* Copyright (C) 2024 IBM
4+
*/
5+
16
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
27
// vim: ts=8 sw=2 smarttab ft=cpp
38

9+
#include "radosgw-admin/orphan.h"
410
#include <string>
511

612

@@ -10,7 +16,6 @@
1016

1117
#include "rgw_op.h"
1218
#include "rgw_multi.h"
13-
#include "rgw_orphan.h"
1419
#include "rgw_zone.h"
1520
#include "rgw_bucket.h"
1621
#include "rgw_sal_rados.h"
Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
/*
2+
* Copyright (C) 2025 IBM
3+
*/
4+
15
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
26
// vim: ts=8 sw=2 smarttab ft=cpp
37

4-
#include <errno.h>
5-
#include <iostream>
6-
#include <sstream>
8+
#include <cerrno>
79
#include <string>
8-
9-
#include <boost/optional.hpp>
10+
#include <sstream>
11+
#include <optional>
12+
#include <iostream>
1013

1114
extern "C" {
1215
#include <liboath/oath.h>
@@ -38,6 +41,9 @@ extern "C" {
3841
#include "include/utime.h"
3942
#include "include/str_list.h"
4043

44+
#include "radosgw-admin/orphan.h"
45+
#include "radosgw-admin/sync_checkpoint.h"
46+
4147
#include "rgw_user.h"
4248
#include "rgw_otp.h"
4349
#include "rgw_rados.h"
@@ -48,7 +54,6 @@ extern "C" {
4854
#include "rgw_log.h"
4955
#include "rgw_formats.h"
5056
#include "rgw_usage.h"
51-
#include "rgw_orphan.h"
5257
#include "rgw_sync.h"
5358
#include "rgw_trim_bilog.h"
5459
#include "rgw_trim_datalog.h"
@@ -62,7 +67,6 @@ extern "C" {
6267
#include "rgw_zone.h"
6368
#include "rgw_pubsub.h"
6469
#include "rgw_bucket_sync.h"
65-
#include "rgw_sync_checkpoint.h"
6670
#include "rgw_lua.h"
6771
#include "rgw_sal.h"
6872
#include "rgw_sal_config.h"
@@ -82,11 +86,6 @@ extern "C" {
8286

8387
#define dout_context g_ceph_context
8488

85-
#define SECRET_KEY_LEN 40
86-
#define PUBLIC_ID_LEN 20
87-
88-
using namespace std;
89-
9089
static rgw::sal::Driver* driver = NULL;
9190
static constexpr auto dout_subsys = ceph_subsys_rgw;
9291

@@ -117,19 +116,13 @@ static const DoutPrefixProvider* dpp() {
117116
} \
118117
} while (0)
119118

120-
static inline int posix_errortrans(int r)
119+
using namespace std;
120+
121+
inline int posix_errortrans(int r)
121122
{
122-
switch(r) {
123-
case ERR_NO_SUCH_BUCKET:
124-
r = ENOENT;
125-
break;
126-
default:
127-
break;
128-
}
129-
return r;
123+
return ERR_NO_SUCH_BUCKET == r ? ENOENT : r;
130124
}
131125

132-
133126
static const std::string LUA_CONTEXT_LIST("prerequest, postrequest, background, getdata, putdata");
134127

135128
void usage()
@@ -1272,7 +1265,7 @@ static int read_input(const string& infile, bufferlist& bl)
12721265
}
12731266
}
12741267

1275-
#define READ_CHUNK 8196
1268+
constexpr auto READ_CHUNK=8196;
12761269
int r;
12771270
int err;
12781271

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Ceph - scalable distributed file system
66
*
77
* Copyright (C) 2020 Red Hat, Inc.
8+
* Copyright (C) 2024 IBM
89
*
910
* This is free software; you can redistribute it and/or
1011
* modify it under the terms of the GNU Lesser General Public
@@ -13,9 +14,12 @@
1314
*
1415
*/
1516

17+
#include "radosgw-admin/sync_checkpoint.h"
18+
1619
#include <fmt/format.h>
20+
1721
#include "common/errno.h"
18-
#include "rgw_sync_checkpoint.h"
22+
1923
#include "rgw_sal_rados.h"
2024
#include "rgw_bucket_sync.h"
2125
#include "rgw_data_sync.h"

0 commit comments

Comments
 (0)