2 * Export the iSCSI boot info to userland via sysfs.
4 * Copyright (C) 2010 Red Hat, Inc. All rights reserved.
5 * Copyright (C) 2010 Mike Christie
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
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.
16 #ifndef _ISCSI_BOOT_SYSFS_
17 #define _ISCSI_BOOT_SYSFS_
20 * The text attributes names for each of the kobjects.
22 enum iscsi_boot_eth_properties_enum
{
25 ISCSI_BOOT_ETH_IP_ADDR
,
26 ISCSI_BOOT_ETH_SUBNET_MASK
,
27 ISCSI_BOOT_ETH_ORIGIN
,
28 ISCSI_BOOT_ETH_GATEWAY
,
29 ISCSI_BOOT_ETH_PRIMARY_DNS
,
30 ISCSI_BOOT_ETH_SECONDARY_DNS
,
34 /* eth_pci_bdf - this is replaced by link to the device itself. */
35 ISCSI_BOOT_ETH_HOSTNAME
,
36 ISCSI_BOOT_ETH_END_MARKER
,
39 enum iscsi_boot_tgt_properties_enum
{
42 ISCSI_BOOT_TGT_IP_ADDR
,
45 ISCSI_BOOT_TGT_CHAP_TYPE
,
46 ISCSI_BOOT_TGT_NIC_ASSOC
,
48 ISCSI_BOOT_TGT_CHAP_NAME
,
49 ISCSI_BOOT_TGT_CHAP_SECRET
,
50 ISCSI_BOOT_TGT_REV_CHAP_NAME
,
51 ISCSI_BOOT_TGT_REV_CHAP_SECRET
,
52 ISCSI_BOOT_TGT_END_MARKER
,
55 enum iscsi_boot_initiator_properties_enum
{
58 ISCSI_BOOT_INI_ISNS_SERVER
,
59 ISCSI_BOOT_INI_SLP_SERVER
,
60 ISCSI_BOOT_INI_PRI_RADIUS_SERVER
,
61 ISCSI_BOOT_INI_SEC_RADIUS_SERVER
,
62 ISCSI_BOOT_INI_INITIATOR_NAME
,
63 ISCSI_BOOT_INI_END_MARKER
,
66 struct attribute_group
;
68 struct iscsi_boot_kobj
{
70 struct attribute_group
*attr_group
;
71 struct list_head list
;
74 * Pointer to store driver specific info. If set this will
75 * be freed for the LLD when the kobj release function is called.
79 * Driver specific show function.
81 * The enum of the type. This can be any value of the above
84 ssize_t (*show
) (void *data
, int type
, char *buf
);
87 * Drivers specific visibility function.
88 * The function should return if they the attr should be readable
89 * writable or should not be shown.
91 * The enum of the type. This can be any value of the above
94 mode_t (*is_visible
) (void *data
, int type
);
97 * Driver specific release function.
99 * The function should free the data passed in.
101 void (*release
) (void *data
);
104 struct iscsi_boot_kset
{
105 struct list_head kobj_list
;
109 struct iscsi_boot_kobj
*
110 iscsi_boot_create_initiator(struct iscsi_boot_kset
*boot_kset
, int index
,
112 ssize_t (*show
) (void *data
, int type
, char *buf
),
113 mode_t (*is_visible
) (void *data
, int type
),
114 void (*release
) (void *data
));
116 struct iscsi_boot_kobj
*
117 iscsi_boot_create_ethernet(struct iscsi_boot_kset
*boot_kset
, int index
,
119 ssize_t (*show
) (void *data
, int type
, char *buf
),
120 mode_t (*is_visible
) (void *data
, int type
),
121 void (*release
) (void *data
));
122 struct iscsi_boot_kobj
*
123 iscsi_boot_create_target(struct iscsi_boot_kset
*boot_kset
, int index
,
125 ssize_t (*show
) (void *data
, int type
, char *buf
),
126 mode_t (*is_visible
) (void *data
, int type
),
127 void (*release
) (void *data
));
129 struct iscsi_boot_kset
*iscsi_boot_create_kset(const char *set_name
);
130 struct iscsi_boot_kset
*iscsi_boot_create_host_kset(unsigned int hostno
);
131 void iscsi_boot_destroy_kset(struct iscsi_boot_kset
*boot_kset
);