iscsi_boot_sysfs.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Export the iSCSI boot info to userland via sysfs.
  4. *
  5. * Copyright (C) 2010 Red Hat, Inc. All rights reserved.
  6. * Copyright (C) 2010 Mike Christie
  7. */
  8. #ifndef _ISCSI_BOOT_SYSFS_
  9. #define _ISCSI_BOOT_SYSFS_
  10. /*
  11. * The text attributes names for each of the kobjects.
  12. */
  13. enum iscsi_boot_eth_properties_enum {
  14. ISCSI_BOOT_ETH_INDEX,
  15. ISCSI_BOOT_ETH_FLAGS,
  16. ISCSI_BOOT_ETH_IP_ADDR,
  17. ISCSI_BOOT_ETH_PREFIX_LEN,
  18. ISCSI_BOOT_ETH_SUBNET_MASK,
  19. ISCSI_BOOT_ETH_ORIGIN,
  20. ISCSI_BOOT_ETH_GATEWAY,
  21. ISCSI_BOOT_ETH_PRIMARY_DNS,
  22. ISCSI_BOOT_ETH_SECONDARY_DNS,
  23. ISCSI_BOOT_ETH_DHCP,
  24. ISCSI_BOOT_ETH_VLAN,
  25. ISCSI_BOOT_ETH_MAC,
  26. /* eth_pci_bdf - this is replaced by link to the device itself. */
  27. ISCSI_BOOT_ETH_HOSTNAME,
  28. ISCSI_BOOT_ETH_END_MARKER,
  29. };
  30. enum iscsi_boot_tgt_properties_enum {
  31. ISCSI_BOOT_TGT_INDEX,
  32. ISCSI_BOOT_TGT_FLAGS,
  33. ISCSI_BOOT_TGT_IP_ADDR,
  34. ISCSI_BOOT_TGT_PORT,
  35. ISCSI_BOOT_TGT_LUN,
  36. ISCSI_BOOT_TGT_CHAP_TYPE,
  37. ISCSI_BOOT_TGT_NIC_ASSOC,
  38. ISCSI_BOOT_TGT_NAME,
  39. ISCSI_BOOT_TGT_CHAP_NAME,
  40. ISCSI_BOOT_TGT_CHAP_SECRET,
  41. ISCSI_BOOT_TGT_REV_CHAP_NAME,
  42. ISCSI_BOOT_TGT_REV_CHAP_SECRET,
  43. ISCSI_BOOT_TGT_END_MARKER,
  44. };
  45. enum iscsi_boot_initiator_properties_enum {
  46. ISCSI_BOOT_INI_INDEX,
  47. ISCSI_BOOT_INI_FLAGS,
  48. ISCSI_BOOT_INI_ISNS_SERVER,
  49. ISCSI_BOOT_INI_SLP_SERVER,
  50. ISCSI_BOOT_INI_PRI_RADIUS_SERVER,
  51. ISCSI_BOOT_INI_SEC_RADIUS_SERVER,
  52. ISCSI_BOOT_INI_INITIATOR_NAME,
  53. ISCSI_BOOT_INI_END_MARKER,
  54. };
  55. enum iscsi_boot_acpitbl_properties_enum {
  56. ISCSI_BOOT_ACPITBL_SIGNATURE,
  57. ISCSI_BOOT_ACPITBL_OEM_ID,
  58. ISCSI_BOOT_ACPITBL_OEM_TABLE_ID,
  59. };
  60. struct attribute_group;
  61. struct iscsi_boot_kobj {
  62. struct kobject kobj;
  63. struct attribute_group *attr_group;
  64. struct list_head list;
  65. /*
  66. * Pointer to store driver specific info. If set this will
  67. * be freed for the LLD when the kobj release function is called.
  68. */
  69. void *data;
  70. /*
  71. * Driver specific show function.
  72. *
  73. * The enum of the type. This can be any value of the above
  74. * properties.
  75. */
  76. ssize_t (*show) (void *data, int type, char *buf);
  77. /*
  78. * Drivers specific visibility function.
  79. * The function should return if they the attr should be readable
  80. * writable or should not be shown.
  81. *
  82. * The enum of the type. This can be any value of the above
  83. * properties.
  84. */
  85. umode_t (*is_visible) (void *data, int type);
  86. /*
  87. * Driver specific release function.
  88. *
  89. * The function should free the data passed in.
  90. */
  91. void (*release) (void *data);
  92. };
  93. struct iscsi_boot_kset {
  94. struct list_head kobj_list;
  95. struct kset *kset;
  96. };
  97. struct iscsi_boot_kobj *
  98. iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
  99. void *data,
  100. ssize_t (*show) (void *data, int type, char *buf),
  101. umode_t (*is_visible) (void *data, int type),
  102. void (*release) (void *data));
  103. struct iscsi_boot_kobj *
  104. iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
  105. void *data,
  106. ssize_t (*show) (void *data, int type, char *buf),
  107. umode_t (*is_visible) (void *data, int type),
  108. void (*release) (void *data));
  109. struct iscsi_boot_kobj *
  110. iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
  111. void *data,
  112. ssize_t (*show) (void *data, int type, char *buf),
  113. umode_t (*is_visible) (void *data, int type),
  114. void (*release) (void *data));
  115. struct iscsi_boot_kobj *
  116. iscsi_boot_create_acpitbl(struct iscsi_boot_kset *boot_kset, int index,
  117. void *data,
  118. ssize_t (*show)(void *data, int type, char *buf),
  119. umode_t (*is_visible)(void *data, int type),
  120. void (*release)(void *data));
  121. struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
  122. struct iscsi_boot_kset *iscsi_boot_create_host_kset(unsigned int hostno);
  123. void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset);
  124. #endif