blob: 10923d7304863cad64b4da5349c3db03f47d9b13 [file] [log] [blame]
Mike Christieba4ee302010-04-12 18:06:17 +00001/*
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/*
20 * The text attributes names for each of the kobjects.
21*/
22enum iscsi_boot_eth_properties_enum {
23 ISCSI_BOOT_ETH_INDEX,
24 ISCSI_BOOT_ETH_FLAGS,
25 ISCSI_BOOT_ETH_IP_ADDR,
Hannes Reinecke9a994252016-02-25 09:56:04 -080026 ISCSI_BOOT_ETH_PREFIX_LEN,
Mike Christieba4ee302010-04-12 18:06:17 +000027 ISCSI_BOOT_ETH_SUBNET_MASK,
28 ISCSI_BOOT_ETH_ORIGIN,
29 ISCSI_BOOT_ETH_GATEWAY,
30 ISCSI_BOOT_ETH_PRIMARY_DNS,
31 ISCSI_BOOT_ETH_SECONDARY_DNS,
32 ISCSI_BOOT_ETH_DHCP,
33 ISCSI_BOOT_ETH_VLAN,
34 ISCSI_BOOT_ETH_MAC,
35 /* eth_pci_bdf - this is replaced by link to the device itself. */
36 ISCSI_BOOT_ETH_HOSTNAME,
37 ISCSI_BOOT_ETH_END_MARKER,
38};
39
40enum iscsi_boot_tgt_properties_enum {
41 ISCSI_BOOT_TGT_INDEX,
42 ISCSI_BOOT_TGT_FLAGS,
43 ISCSI_BOOT_TGT_IP_ADDR,
44 ISCSI_BOOT_TGT_PORT,
45 ISCSI_BOOT_TGT_LUN,
46 ISCSI_BOOT_TGT_CHAP_TYPE,
47 ISCSI_BOOT_TGT_NIC_ASSOC,
48 ISCSI_BOOT_TGT_NAME,
49 ISCSI_BOOT_TGT_CHAP_NAME,
50 ISCSI_BOOT_TGT_CHAP_SECRET,
51 ISCSI_BOOT_TGT_REV_CHAP_NAME,
52 ISCSI_BOOT_TGT_REV_CHAP_SECRET,
53 ISCSI_BOOT_TGT_END_MARKER,
54};
55
56enum iscsi_boot_initiator_properties_enum {
57 ISCSI_BOOT_INI_INDEX,
58 ISCSI_BOOT_INI_FLAGS,
59 ISCSI_BOOT_INI_ISNS_SERVER,
60 ISCSI_BOOT_INI_SLP_SERVER,
61 ISCSI_BOOT_INI_PRI_RADIUS_SERVER,
62 ISCSI_BOOT_INI_SEC_RADIUS_SERVER,
63 ISCSI_BOOT_INI_INITIATOR_NAME,
64 ISCSI_BOOT_INI_END_MARKER,
65};
66
David Bondb3c8eb52016-03-23 21:49:26 -040067enum iscsi_boot_acpitbl_properties_enum {
68 ISCSI_BOOT_ACPITBL_SIGNATURE,
69 ISCSI_BOOT_ACPITBL_OEM_ID,
70 ISCSI_BOOT_ACPITBL_OEM_TABLE_ID,
71};
72
Mike Christieba4ee302010-04-12 18:06:17 +000073struct attribute_group;
74
75struct iscsi_boot_kobj {
76 struct kobject kobj;
77 struct attribute_group *attr_group;
78 struct list_head list;
79
80 /*
81 * Pointer to store driver specific info. If set this will
82 * be freed for the LLD when the kobj release function is called.
83 */
84 void *data;
85 /*
86 * Driver specific show function.
87 *
88 * The enum of the type. This can be any value of the above
89 * properties.
90 */
91 ssize_t (*show) (void *data, int type, char *buf);
92
93 /*
94 * Drivers specific visibility function.
95 * The function should return if they the attr should be readable
96 * writable or should not be shown.
97 *
98 * The enum of the type. This can be any value of the above
99 * properties.
100 */
Al Viro587a1f12011-07-23 23:11:19 -0400101 umode_t (*is_visible) (void *data, int type);
Mike Christief457a462011-06-24 15:11:53 -0500102
103 /*
104 * Driver specific release function.
105 *
106 * The function should free the data passed in.
107 */
108 void (*release) (void *data);
Mike Christieba4ee302010-04-12 18:06:17 +0000109};
110
111struct iscsi_boot_kset {
112 struct list_head kobj_list;
113 struct kset *kset;
114};
115
116struct iscsi_boot_kobj *
117iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
118 void *data,
119 ssize_t (*show) (void *data, int type, char *buf),
Al Viro587a1f12011-07-23 23:11:19 -0400120 umode_t (*is_visible) (void *data, int type),
Mike Christief457a462011-06-24 15:11:53 -0500121 void (*release) (void *data));
Mike Christieba4ee302010-04-12 18:06:17 +0000122
123struct iscsi_boot_kobj *
124iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
125 void *data,
126 ssize_t (*show) (void *data, int type, char *buf),
Al Viro587a1f12011-07-23 23:11:19 -0400127 umode_t (*is_visible) (void *data, int type),
Mike Christief457a462011-06-24 15:11:53 -0500128 void (*release) (void *data));
Mike Christieba4ee302010-04-12 18:06:17 +0000129struct iscsi_boot_kobj *
130iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
131 void *data,
132 ssize_t (*show) (void *data, int type, char *buf),
Al Viro587a1f12011-07-23 23:11:19 -0400133 umode_t (*is_visible) (void *data, int type),
Mike Christief457a462011-06-24 15:11:53 -0500134 void (*release) (void *data));
Mike Christieba4ee302010-04-12 18:06:17 +0000135
David Bondb3c8eb52016-03-23 21:49:26 -0400136struct iscsi_boot_kobj *
137iscsi_boot_create_acpitbl(struct iscsi_boot_kset *boot_kset, int index,
138 void *data,
139 ssize_t (*show)(void *data, int type, char *buf),
140 umode_t (*is_visible)(void *data, int type),
141 void (*release)(void *data));
142
Mike Christieba4ee302010-04-12 18:06:17 +0000143struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
144struct iscsi_boot_kset *iscsi_boot_create_host_kset(unsigned int hostno);
145void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset);
146
147#endif