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