Skip to content

Commit f88d0c9

Browse files
authored
Merge pull request ceph#58990 from Matan-B/wip-matanb-fmt-draft
fmt: bump up version + related changes Reviewed-by: Yingxin Cheng <[email protected]> Reviewed-by: Radosław Zarzyński <[email protected]>
2 parents fbfeb28 + ed0caa4 commit f88d0c9

37 files changed

+141
-87
lines changed

ceph.spec.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,12 @@
115115
%ifarch x86_64
116116
%if 0%{?fedora} || 0%{?rhel} >= 9
117117
%bcond_without system_qat
118-
%else # not fedora/rhel
118+
%else
119+
# not fedora/rhel
119120
%bcond_with system_qat
120121
%endif
121-
%else # not x86_64
122+
%else
123+
# not x86_64
122124
%bcond_with system_qat
123125
%endif
124126
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8 || 0%{?openEuler}

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ else()
362362
message(STATUS "Building fmt as submodule")
363363
set(old_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
364364
set(BUILD_SHARED_LIBS FALSE)
365+
set(FMT_INSTALL OFF)
365366
add_subdirectory(fmt)
366367
set(BUILD_SHARED_LIBS ${old_BUILD_SHARED_LIBS})
367368
unset(old_BUILD_SHARED_LIBS)

src/common/LogEntry.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <fmt/format.h>
1919

2020
#include "include/utime.h"
21+
#include "include/utime_fmt.h"
2122
#include "msg/msg_fmt.h"
2223
#include "msg/msg_types.h"
2324
#include "common/entity_name.h"
@@ -217,14 +218,14 @@ template <> struct fmt::formatter<clog_type> : fmt::ostream_formatter {};
217218

218219
template <> struct fmt::formatter<EntityName> : fmt::formatter<std::string_view> {
219220
template <typename FormatContext>
220-
auto format(const EntityName& e, FormatContext& ctx) {
221+
auto format(const EntityName& e, FormatContext& ctx) const {
221222
return formatter<std::string_view>::format(e.to_str(), ctx);
222223
}
223224
};
224225

225226
template <> struct fmt::formatter<LogEntry> : fmt::formatter<std::string_view> {
226227
template <typename FormatContext>
227-
auto format(const LogEntry& e, FormatContext& ctx) {
228+
auto format(const LogEntry& e, FormatContext& ctx) const {
228229
return fmt::format_to(ctx.out(), "{} {} ({}) {} : {} [{}] {}",
229230
e.stamp, e.name, e.rank, e.seq, e.channel,
230231
LogEntry::level_to_str(e.prio), e.msg);

src/common/fmt_common.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,19 @@ template<class T>
3838
concept has_alt_fmt_print = requires(T t) {
3939
{ t.alt_fmt_print(bool{}) } -> std::same_as<std::string>;
4040
};
41+
#if FMT_VERSION >= 110000
42+
template<class T>
43+
concept has_fmt_print_ctx = requires(
44+
T t, fmt::buffered_context<char> &ctx) {
45+
{ t.fmt_print_ctx(ctx) } -> std::same_as<decltype(ctx.out())>;
46+
};
47+
#else
4148
template<class T>
4249
concept has_fmt_print_ctx = requires(
4350
T t, fmt::buffer_context<char> &ctx) {
4451
{ t.fmt_print_ctx(ctx) } -> std::same_as<decltype(ctx.out())>;
4552
};
53+
#endif
4654

4755
namespace fmt {
4856

src/crimson/common/formatter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct fmt::formatter<seastar::lowres_system_clock::time_point> {
1919

2020
template <typename FormatContext>
2121
auto format(const seastar::lowres_system_clock::time_point& t,
22-
FormatContext& ctx) {
22+
FormatContext& ctx) const {
2323
std::time_t tt = std::chrono::duration_cast<std::chrono::seconds>(
2424
t.time_since_epoch()).count();
2525
auto milliseconds = (t.time_since_epoch() %

src/crimson/mon/MonClient.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "auth/RotatingKeyRing.h"
1515

1616
#include "common/hostname.h"
17+
#include "include/utime_fmt.h"
1718

1819
#include "crimson/auth/KeyRing.h"
1920
#include "crimson/common/config_proxy.h"
@@ -243,7 +244,7 @@ Connection::do_auth_single(Connection::request_t what)
243244
return std::make_optional(auth_result_t::canceled);
244245
}
245246
logger().info("do_auth_single: {} returns {}: {}",
246-
*conn, *m, m->result);
247+
*conn, *m, (int)m->result);
247248
auto p = m->result_bl.cbegin();
248249
auto ret = auth->handle_response(m->result, p,
249250
nullptr, nullptr);
@@ -806,7 +807,7 @@ seastar::future<> Client::handle_auth_reply(crimson::net::Connection &conn,
806807
Ref<MAuthReply> m)
807808
{
808809
logger().info("handle_auth_reply {} returns {}: {}",
809-
conn, *m, m->result);
810+
conn, *m, (int)m->result);
810811
auto found = std::find_if(pending_conns.begin(), pending_conns.end(),
811812
[peer_addr = conn.get_peer_addr()](auto& mc) {
812813
return mc->is_my_peer(peer_addr);

src/crimson/net/FrameAssemblerV2.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ void FrameAssemblerV2::log_main_preamble(const ceph::bufferlist &bl)
441441
reinterpret_cast<const preamble_block_t*>(bl.front().c_str());
442442
logger().trace("{} SEND({}) frame: tag={}, num_segments={}, crc={}",
443443
conn, bl.length(), (int)main_preamble->tag,
444-
(int)main_preamble->num_segments, main_preamble->crc);
444+
(int)main_preamble->num_segments, (uint32_t)main_preamble->crc);
445445
}
446446

447447
FrameAssemblerV2Ref FrameAssemblerV2::create(SocketConnection &conn)

src/crimson/net/Socket.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ Socket::connect(const entity_addr_t &peer_addr)
290290
auto ret = std::make_unique<Socket>(
291291
std::move(socket), side_t::connector, 0, construct_tag{});
292292
logger().debug("Socket::connect(): connected to {}, socket {}",
293-
peer_addr, fmt::ptr(ret));
293+
peer_addr, fmt::ptr(ret.get()));
294294
return ret;
295295
});
296296
}
@@ -431,7 +431,7 @@ ShardedServerSocket::accept(accept_func_t &&_fn_accept)
431431
peer_addr.get_port(), Socket::construct_tag{});
432432
logger().debug("ShardedServerSocket({})::accept(): accepted peer {}, "
433433
"socket {}, dispatch_only_on_primary_sid = {}",
434-
ss.listen_addr, peer_addr, fmt::ptr(_socket),
434+
ss.listen_addr, peer_addr, fmt::ptr(_socket.get()),
435435
ss.dispatch_only_on_primary_sid);
436436
std::ignore = seastar::with_gate(
437437
ss.shutdown_gate,

src/crimson/net/SocketMessenger.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <tuple>
2020
#include <boost/functional/hash.hpp>
2121
#include <fmt/os.h>
22+
#include <fmt/std.h>
2223

2324
#include "auth/Auth.h"
2425
#include "Errors.h"

src/crimson/net/io_handler.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "crimson/net/SocketMessenger.h"
1313
#include "msg/Message.h"
1414
#include "msg/msg_fmt.h"
15+
#include "include/utime_fmt.h"
1516

1617
using namespace ceph::msgr::v2;
1718
using crimson::common::local_conf;
@@ -1018,10 +1019,10 @@ IOHandler::read_message(
10181019
msg_frame.front_len(),
10191020
msg_frame.middle_len(),
10201021
msg_frame.data_len(),
1021-
current_header.type,
1022+
(uint16_t)current_header.type,
10221023
conn.get_peer_name(),
1023-
current_header.data_off,
1024-
current_header.seq);
1024+
(uint16_t)current_header.data_off,
1025+
(uint32_t)current_header.seq);
10251026

10261027
ceph_msg_header header{current_header.seq,
10271028
current_header.tid,
@@ -1088,7 +1089,7 @@ IOHandler::read_message(
10881089
logger().debug("{} <== #{},{} === {} ({})",
10891090
conn,
10901091
message->get_seq(),
1091-
current_header.ack_seq,
1092+
(uint32_t)current_header.ack_seq,
10921093
*message,
10931094
message->get_type());
10941095
}

0 commit comments

Comments
 (0)