ceph_strings.c 1.2 KB

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