]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
include/cephfs/types.h: move struct keys_and_values to separate header
authorMax Kellermann <max.kellermann@ionos.com>
Fri, 25 Oct 2024 11:50:09 +0000 (13:50 +0200)
committerVenky Shankar <vshankar@redhat.com>
Tue, 22 Jul 2025 05:11:00 +0000 (10:41 +0530)
This struct is only used in two sources and moving it to a separate
header means we can eliminate the heavy header dependency on
boost::spirit.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/client/Client.cc
src/include/cephfs/keys_and_values.h [new file with mode: 0644]
src/include/cephfs/types.h
src/mds/Server.cc
src/mon/ConnectionTracker.cc

index 35baf658cf3a1601914ddd4a27b1624dcd761a83..8f081420735031d2a852d4fcda245e619b4bfb0b 100644 (file)
@@ -114,6 +114,7 @@ using namespace std::literals::string_view_literals;
 #include "posix_acl.h"
 
 #include "include/ceph_assert.h"
+#include "include/cephfs/keys_and_values.h"
 #include "include/stat.h"
 
 #include "include/cephfs/ceph_ll_client.h"
diff --git a/src/include/cephfs/keys_and_values.h b/src/include/cephfs/keys_and_values.h
new file mode 100644 (file)
index 0000000..94f958e
--- /dev/null
@@ -0,0 +1,39 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2020 Red Hat, Inc.
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation.  See file COPYING.
+ */
+
+#pragma once
+
+#include <boost/spirit/include/qi.hpp>
+
+#include <map>
+#include <string>
+
+// parse a map of keys/values.
+namespace qi = boost::spirit::qi;
+
+template <typename Iterator>
+struct keys_and_values
+  : qi::grammar<Iterator, std::map<std::string, std::string>()>
+{
+    keys_and_values()
+      : keys_and_values::base_type(query)
+    {
+      query =  pair >> *(qi::lit(' ') >> pair);
+      pair  =  key >> '=' >> value;
+      key   =  qi::char_("a-zA-Z_") >> *qi::char_("a-zA-Z_0-9");
+      value = +qi::char_("a-zA-Z0-9-_.");
+    }
+  qi::rule<Iterator, std::map<std::string, std::string>()> query;
+  qi::rule<Iterator, std::pair<std::string, std::string>()> pair;
+  qi::rule<Iterator, std::string()> key, value;
+};
index 91154b266e14707563f57372387821d1a8f49f27..dd449dd1ea48d9b0450f532982a7a5b5c034859c 100644 (file)
@@ -30,7 +30,6 @@
 #include "include/types.h" // for version_t
 #include "include/utime.h"
 
-#include <boost/spirit/include/qi.hpp>
 #include "include/ceph_assert.h"
 #include <boost/serialization/strong_typedef.hpp>
 #include "common/ceph_json.h"
@@ -1385,24 +1384,4 @@ inline void decode(inode_t<Allocator> &c, ::ceph::buffer::list::const_iterator &
   c.decode(p);
 }
 
-// parse a map of keys/values.
-namespace qi = boost::spirit::qi;
-
-template <typename Iterator>
-struct keys_and_values
-  : qi::grammar<Iterator, std::map<std::string, std::string>()>
-{
-    keys_and_values()
-      : keys_and_values::base_type(query)
-    {
-      query =  pair >> *(qi::lit(' ') >> pair);
-      pair  =  key >> '=' >> value;
-      key   =  qi::char_("a-zA-Z_") >> *qi::char_("a-zA-Z_0-9");
-      value = +qi::char_("a-zA-Z0-9-_.");
-    }
-  qi::rule<Iterator, std::map<std::string, std::string>()> query;
-  qi::rule<Iterator, std::pair<std::string, std::string>()> pair;
-  qi::rule<Iterator, std::string()> key, value;
-};
-
 #endif
index 605c4fb7eacd655c6ff3ae1bbbd84cfe61158067..539ea3c090dd6b25c8f7a0b6e3114f660f3ed987 100644 (file)
@@ -20,6 +20,7 @@
 #include <boost/lexical_cast.hpp>
 #include "include/ceph_assert.h"  // lexical_cast includes system assert.h
 #include "include/cephfs/metrics/Types.h"
+#include "include/cephfs/keys_and_values.h"
 #include "include/random.h" // for ceph::util::generate_random_number()
 
 #include <boost/config/warning_disable.hpp>
index 513d823011928de0461eef2a74a80db24c6a3acf..d1a9edcab6876c6ef3aae2901fa76a9c255b4b86 100644 (file)
@@ -16,6 +16,7 @@
 #include "common/Formatter.h"
 #include "common/dout.h"
 #include "include/ceph_assert.h"
+#include "include/cephfs/keys_and_values.h"
 
 #define dout_subsys ceph_subsys_mon
 #undef dout_prefix