iscsi_boot_sysfs.h 3.7 KB

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