blob: 5f244d3f1472ac1896133e1ae29e08a841340e9f [file] [log] [blame]
Thomas Gleixnerd9523672019-05-29 07:18:01 -07001/* SPDX-License-Identifier: GPL-2.0-only */
Mike Christieba4ee302010-04-12 18:06:17 +00002/*
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
Mike Christieba4ee302010-04-12 18:06:17 +00007 */
8#ifndef _ISCSI_BOOT_SYSFS_
9#define _ISCSI_BOOT_SYSFS_
10
11/*
12 * The text attributes names for each of the kobjects.
13*/
14enum iscsi_boot_eth_properties_enum {
15 ISCSI_BOOT_ETH_INDEX,
16 ISCSI_BOOT_ETH_FLAGS,
17 ISCSI_BOOT_ETH_IP_ADDR,
Hannes Reinecke9a994252016-02-25 09:56:04 -080018 ISCSI_BOOT_ETH_PREFIX_LEN,
Mike Christieba4ee302010-04-12 18:06:17 +000019 ISCSI_BOOT_ETH_SUBNET_MASK,
20 ISCSI_BOOT_ETH_ORIGIN,
21 ISCSI_BOOT_ETH_GATEWAY,
22 ISCSI_BOOT_ETH_PRIMARY_DNS,
23 ISCSI_BOOT_ETH_SECONDARY_DNS,
24 ISCSI_BOOT_ETH_DHCP,
25 ISCSI_BOOT_ETH_VLAN,
26 ISCSI_BOOT_ETH_MAC,
27 /* eth_pci_bdf - this is replaced by link to the device itself. */
28 ISCSI_BOOT_ETH_HOSTNAME,
29 ISCSI_BOOT_ETH_END_MARKER,
30};
31
32enum iscsi_boot_tgt_properties_enum {
33 ISCSI_BOOT_TGT_INDEX,
34 ISCSI_BOOT_TGT_FLAGS,
35 ISCSI_BOOT_TGT_IP_ADDR,
36 ISCSI_BOOT_TGT_PORT,
37 ISCSI_BOOT_TGT_LUN,
38 ISCSI_BOOT_TGT_CHAP_TYPE,
39 ISCSI_BOOT_TGT_NIC_ASSOC,
40 ISCSI_BOOT_TGT_NAME,
41 ISCSI_BOOT_TGT_CHAP_NAME,
42 ISCSI_BOOT_TGT_CHAP_SECRET,
43 ISCSI_BOOT_TGT_REV_CHAP_NAME,
44 ISCSI_BOOT_TGT_REV_CHAP_SECRET,
45 ISCSI_BOOT_TGT_END_MARKER,
46};
47
48enum iscsi_boot_initiator_properties_enum {
49 ISCSI_BOOT_INI_INDEX,
50 ISCSI_BOOT_INI_FLAGS,
51 ISCSI_BOOT_INI_ISNS_SERVER,
52 ISCSI_BOOT_INI_SLP_SERVER,
53 ISCSI_BOOT_INI_PRI_RADIUS_SERVER,
54 ISCSI_BOOT_INI_SEC_RADIUS_SERVER,
55 ISCSI_BOOT_INI_INITIATOR_NAME,
56 ISCSI_BOOT_INI_END_MARKER,
57};
58
David Bondb3c8eb52016-03-23 21:49:26 -040059enum iscsi_boot_acpitbl_properties_enum {
60 ISCSI_BOOT_ACPITBL_SIGNATURE,
61 ISCSI_BOOT_ACPITBL_OEM_ID,
62 ISCSI_BOOT_ACPITBL_OEM_TABLE_ID,
63};
64
Mike Christieba4ee302010-04-12 18:06:17 +000065struct attribute_group;
66
67struct iscsi_boot_kobj {
68 struct kobject kobj;
69 struct attribute_group *attr_group;
70 struct list_head list;
71
72 /*
73 * Pointer to store driver specific info. If set this will
74 * be freed for the LLD when the kobj release function is called.
75 */
76 void *data;
77 /*
78 * Driver specific show function.
79 *
80 * The enum of the type. This can be any value of the above
81 * properties.
82 */
83 ssize_t (*show) (void *data, int type, char *buf);
84
85 /*
86 * Drivers specific visibility function.
87 * The function should return if they the attr should be readable
88 * writable or should not be shown.
89 *
90 * The enum of the type. This can be any value of the above
91 * properties.
92 */
Al Viro587a1f12011-07-23 23:11:19 -040093 umode_t (*is_visible) (void *data, int type);
Mike Christief457a462011-06-24 15:11:53 -050094
95 /*
96 * Driver specific release function.
97 *
98 * The function should free the data passed in.
99 */
100 void (*release) (void *data);
Mike Christieba4ee302010-04-12 18:06:17 +0000101};
102
103struct iscsi_boot_kset {
104 struct list_head kobj_list;
105 struct kset *kset;
106};
107
108struct iscsi_boot_kobj *
109iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
110 void *data,
111 ssize_t (*show) (void *data, int type, char *buf),
Al Viro587a1f12011-07-23 23:11:19 -0400112 umode_t (*is_visible) (void *data, int type),
Mike Christief457a462011-06-24 15:11:53 -0500113 void (*release) (void *data));
Mike Christieba4ee302010-04-12 18:06:17 +0000114
115struct iscsi_boot_kobj *
116iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
117 void *data,
118 ssize_t (*show) (void *data, int type, char *buf),
Al Viro587a1f12011-07-23 23:11:19 -0400119 umode_t (*is_visible) (void *data, int type),
Mike Christief457a462011-06-24 15:11:53 -0500120 void (*release) (void *data));
Mike Christieba4ee302010-04-12 18:06:17 +0000121struct iscsi_boot_kobj *
122iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
123 void *data,
124 ssize_t (*show) (void *data, int type, char *buf),
Al Viro587a1f12011-07-23 23:11:19 -0400125 umode_t (*is_visible) (void *data, int type),
Mike Christief457a462011-06-24 15:11:53 -0500126 void (*release) (void *data));
Mike Christieba4ee302010-04-12 18:06:17 +0000127
David Bondb3c8eb52016-03-23 21:49:26 -0400128struct iscsi_boot_kobj *
129iscsi_boot_create_acpitbl(struct iscsi_boot_kset *boot_kset, int index,
130 void *data,
131 ssize_t (*show)(void *data, int type, char *buf),
132 umode_t (*is_visible)(void *data, int type),
133 void (*release)(void *data));
134
Mike Christieba4ee302010-04-12 18:06:17 +0000135struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
136struct iscsi_boot_kset *iscsi_boot_create_host_kset(unsigned int hostno);
137void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset);
138
139#endif