From: Max Kellermann Date: Fri, 25 Oct 2024 11:50:09 +0000 (+0200) Subject: include/cephfs/types.h: move struct keys_and_values to separate header X-Git-Tag: v21.0.0~256^2~78^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c914920e6bff787dce75d76deb4afad2aed45c58;p=ceph.git include/cephfs/types.h: move struct keys_and_values to separate header 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 --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 35baf658cf3a..8f0814207350 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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 index 000000000000..94f958eddc3e --- /dev/null +++ b/src/include/cephfs/keys_and_values.h @@ -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 + +#include +#include + +// parse a map of keys/values. +namespace qi = boost::spirit::qi; + +template +struct keys_and_values + : qi::grammar()> +{ + 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()> query; + qi::rule()> pair; + qi::rule key, value; +}; diff --git a/src/include/cephfs/types.h b/src/include/cephfs/types.h index 91154b266e14..dd449dd1ea48 100644 --- a/src/include/cephfs/types.h +++ b/src/include/cephfs/types.h @@ -30,7 +30,6 @@ #include "include/types.h" // for version_t #include "include/utime.h" -#include #include "include/ceph_assert.h" #include #include "common/ceph_json.h" @@ -1385,24 +1384,4 @@ inline void decode(inode_t &c, ::ceph::buffer::list::const_iterator & c.decode(p); } -// parse a map of keys/values. -namespace qi = boost::spirit::qi; - -template -struct keys_and_values - : qi::grammar()> -{ - 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()> query; - qi::rule()> pair; - qi::rule key, value; -}; - #endif diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 605c4fb7eacd..539ea3c090dd 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -20,6 +20,7 @@ #include #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 diff --git a/src/mon/ConnectionTracker.cc b/src/mon/ConnectionTracker.cc index 513d82301192..d1a9edcab687 100644 --- a/src/mon/ConnectionTracker.cc +++ b/src/mon/ConnectionTracker.cc @@ -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