summarylogtreecommitdiffstats
path: root/ceph-18.2.0-fmt10-fixes.patch
AgeCommit message (Collapse)Author
2023-09-09repo: add ceph-18.2.0-fmt10-fixes.patchBazaah
This is fairly wide ranging series of patches, fixing multiple compile errors owing changes in fmtlib 9 and 10. Care was taken to attempt to not introduce #includes for fmtlib headers in the public headers of the project, largely through defining a sister <header file>_fmt.h header that just contains the necessary fmtlib definitions, along with importing these files into src/... files as needed. This appears to be the convention (at least, in some parts) of the upstream codebase. Briefly outlined, these are issues fixed: 1. Missing fmt::ostream_formatter definitions for types These used to be implicit, but now fmtlib requires that types specifically opt into this behavior. ~ src/common/LogEntry.h: clog_type, LogEntry + src/include/neorados/RADOS_fmt.hpp: neorados::Object + src/include/types_fmt.h: shard_id_t 2. Missing format_to() interface for ceph_le<T> According to the upstream docs, it should be possible to just use the explicit cast to the underlying T for formatting, but for whatever reason, this doesn't work. Therefore, define a templated format_to() for ceph_le<T> casting to the underlying T, explicitly. This is a fmtlib 10 feature -- previously format_to() was reserved for enums. However, this is the simplest method I can see to avoid needing to #include fmtlib headers in this header tree. ~ src/include/byteorder.h: ceph_le<T> 3. Make fmt::formatter.format definitions const Required since fmtlib 8, but seemingly only became an issue in 10. ~ src/osd/osd_types_fmt.h: chunk_info_t, pg_info_t, SnapSet, ScrubMap::object, ScrubMap 4. Explicitly from snapid_t to uint64_t for fmt::sprintf calls As the fmt::formatter.parse implementation for snapid_t does not handle the formatting qualifier used (or any at all). I think previously this implicitly was casted to uint64_t anyway, so we're just making the behavior explicit. ~ src/osd/SnapMapper.cc: snapid_t 5. Adding a fmt::formatter implementation for EntityName Appears to have another casualty in the "no longer try implicit casts" behavior change of fmtlib 10 ~ src/common/LogEntry.h: EntityName In addition to the above, we defer LogEntry's formatter to the ostream implementation rather than duplicating the same output, separately in the fmt::formatter.format definition. References: https://github.com/fmtlib/fmt/releases/tag/10.0.0 References: https://github.com/fmtlib/fmt/releases/tag/8.0.0