ceph_strings.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Ceph string constants
  4. */
  5. #include <linux/module.h>
  6. #include <linux/ceph/types.h>
  7. const char *ceph_entity_type_name(int type)
  8. {
  9. switch (type) {
  10. case CEPH_ENTITY_TYPE_MDS: return "mds";
  11. case CEPH_ENTITY_TYPE_OSD: return "osd";
  12. case CEPH_ENTITY_TYPE_MON: return "mon";
  13. case CEPH_ENTITY_TYPE_CLIENT: return "client";
  14. case CEPH_ENTITY_TYPE_AUTH: return "auth";
  15. default: return "unknown";
  16. }
  17. }
  18. EXPORT_SYMBOL(ceph_entity_type_name);
  19. const char *ceph_osd_op_name(int op)
  20. {
  21. switch (op) {
  22. #define GENERATE_CASE(op, opcode, str) case CEPH_OSD_OP_##op: return (str);
  23. __CEPH_FORALL_OSD_OPS(GENERATE_CASE)
  24. #undef GENERATE_CASE
  25. default:
  26. return "???";
  27. }
  28. }
  29. const char *ceph_osd_watch_op_name(int o)
  30. {
  31. switch (o) {
  32. case CEPH_OSD_WATCH_OP_UNWATCH:
  33. return "unwatch";
  34. case CEPH_OSD_WATCH_OP_WATCH:
  35. return "watch";
  36. case CEPH_OSD_WATCH_OP_RECONNECT:
  37. return "reconnect";
  38. case CEPH_OSD_WATCH_OP_PING:
  39. return "ping";
  40. default:
  41. return "???";
  42. }
  43. }
  44. const char *ceph_osd_state_name(int s)
  45. {
  46. switch (s) {
  47. case CEPH_OSD_EXISTS:
  48. return "exists";
  49. case CEPH_OSD_UP:
  50. return "up";
  51. case CEPH_OSD_AUTOOUT:
  52. return "autoout";
  53. case CEPH_OSD_NEW:
  54. return "new";
  55. default:
  56. return "???";
  57. }
  58. }