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