]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: move subsys-dependant types to a dedicated header.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Sat, 3 Feb 2018 16:08:54 +0000 (17:08 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 27 Feb 2018 10:38:47 +0000 (11:38 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/common/config.h
src/common/subsys_types.h [new file with mode: 0644]

index 5fbcd662d1281cc6da1299b9ea10885b992119ad..4a8475c177cf5758999f972d0934ccb9a654df10 100644 (file)
@@ -23,6 +23,7 @@
 #include "log/SubsystemMap.h"
 #include "common/config_obs.h"
 #include "common/options.h"
+#include "common/subsys_types.h"
 
 class CephContext;
 
@@ -338,15 +339,4 @@ inline std::ostream& operator<<(std::ostream& o, const boost::blank& ) {
 int ceph_resolve_file_search(const std::string& filename_list,
                             std::string& result);
 
-enum config_subsys_id {
-  ceph_subsys_,   // default
-#define SUBSYS(name, log, gather) \
-  ceph_subsys_##name,
-#define DEFAULT_SUBSYS(log, gather)
-#include "common/subsys.h"
-#undef SUBSYS
-#undef DEFAULT_SUBSYS
-  ceph_subsys_max
-};
-
 #endif
diff --git a/src/common/subsys_types.h b/src/common/subsys_types.h
new file mode 100644 (file)
index 0000000..a7fffda
--- /dev/null
@@ -0,0 +1,34 @@
+// -*- 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) 2018 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.
+ *
+ */
+
+#ifndef CEPH_SUBSYS_TYPES_H
+#define CEPH_SUBSYS_TYPES_H
+
+enum ceph_subsys_id_t {
+  ceph_subsys_,   // default
+#define SUBSYS(name, log, gather) \
+  ceph_subsys_##name,
+#define DEFAULT_SUBSYS(log, gather)
+#include "common/subsys.h"
+#undef SUBSYS
+#undef DEFAULT_SUBSYS
+  ceph_subsys_max
+};
+
+constexpr static std::size_t ceph_subsys_get_num() {
+  return static_cast<std::size_t>(ceph_subsys_max);
+}
+
+#endif // CEPH_SUBSYS_TYPES_H
+