Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Export the iSCSI boot info to userland via sysfs.
0004  *
0005  * Copyright (C) 2010 Red Hat, Inc.  All rights reserved.
0006  * Copyright (C) 2010 Mike Christie
0007  */
0008 #ifndef _ISCSI_BOOT_SYSFS_
0009 #define _ISCSI_BOOT_SYSFS_
0010 
0011 /*
0012  * The text attributes names for each of the kobjects.
0013 */
0014 enum iscsi_boot_eth_properties_enum {
0015     ISCSI_BOOT_ETH_INDEX,
0016     ISCSI_BOOT_ETH_FLAGS,
0017     ISCSI_BOOT_ETH_IP_ADDR,
0018     ISCSI_BOOT_ETH_PREFIX_LEN,
0019     ISCSI_BOOT_ETH_SUBNET_MASK,
0020     ISCSI_BOOT_ETH_ORIGIN,
0021     ISCSI_BOOT_ETH_GATEWAY,
0022     ISCSI_BOOT_ETH_PRIMARY_DNS,
0023     ISCSI_BOOT_ETH_SECONDARY_DNS,
0024     ISCSI_BOOT_ETH_DHCP,
0025     ISCSI_BOOT_ETH_VLAN,
0026     ISCSI_BOOT_ETH_MAC,
0027     /* eth_pci_bdf - this is replaced by link to the device itself. */
0028     ISCSI_BOOT_ETH_HOSTNAME,
0029     ISCSI_BOOT_ETH_END_MARKER,
0030 };
0031 
0032 enum iscsi_boot_tgt_properties_enum {
0033     ISCSI_BOOT_TGT_INDEX,
0034     ISCSI_BOOT_TGT_FLAGS,
0035     ISCSI_BOOT_TGT_IP_ADDR,
0036     ISCSI_BOOT_TGT_PORT,
0037     ISCSI_BOOT_TGT_LUN,
0038     ISCSI_BOOT_TGT_CHAP_TYPE,
0039     ISCSI_BOOT_TGT_NIC_ASSOC,
0040     ISCSI_BOOT_TGT_NAME,
0041     ISCSI_BOOT_TGT_CHAP_NAME,
0042     ISCSI_BOOT_TGT_CHAP_SECRET,
0043     ISCSI_BOOT_TGT_REV_CHAP_NAME,
0044     ISCSI_BOOT_TGT_REV_CHAP_SECRET,
0045     ISCSI_BOOT_TGT_END_MARKER,
0046 };
0047 
0048 enum iscsi_boot_initiator_properties_enum {
0049     ISCSI_BOOT_INI_INDEX,
0050     ISCSI_BOOT_INI_FLAGS,
0051     ISCSI_BOOT_INI_ISNS_SERVER,
0052     ISCSI_BOOT_INI_SLP_SERVER,
0053     ISCSI_BOOT_INI_PRI_RADIUS_SERVER,
0054     ISCSI_BOOT_INI_SEC_RADIUS_SERVER,
0055     ISCSI_BOOT_INI_INITIATOR_NAME,
0056     ISCSI_BOOT_INI_END_MARKER,
0057 };
0058 
0059 enum iscsi_boot_acpitbl_properties_enum {
0060     ISCSI_BOOT_ACPITBL_SIGNATURE,
0061     ISCSI_BOOT_ACPITBL_OEM_ID,
0062     ISCSI_BOOT_ACPITBL_OEM_TABLE_ID,
0063 };
0064 
0065 struct attribute_group;
0066 
0067 struct iscsi_boot_kobj {
0068     struct kobject kobj;
0069     struct attribute_group *attr_group;
0070     struct list_head list;
0071 
0072     /*
0073      * Pointer to store driver specific info. If set this will
0074      * be freed for the LLD when the kobj release function is called.
0075      */
0076     void *data;
0077     /*
0078      * Driver specific show function.
0079      *
0080      * The enum of the type. This can be any value of the above
0081      * properties.
0082      */
0083     ssize_t (*show) (void *data, int type, char *buf);
0084 
0085     /*
0086      * Drivers specific visibility function.
0087      * The function should return if they the attr should be readable
0088      * writable or should not be shown.
0089      *
0090      * The enum of the type. This can be any value of the above
0091      * properties.
0092      */
0093     umode_t (*is_visible) (void *data, int type);
0094 
0095     /*
0096      * Driver specific release function.
0097      *
0098      * The function should free the data passed in.
0099      */
0100     void (*release) (void *data);
0101 };
0102 
0103 struct iscsi_boot_kset {
0104     struct list_head kobj_list;
0105     struct kset *kset;
0106 };
0107 
0108 struct iscsi_boot_kobj *
0109 iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
0110                 void *data,
0111                 ssize_t (*show) (void *data, int type, char *buf),
0112                 umode_t (*is_visible) (void *data, int type),
0113                 void (*release) (void *data));
0114 
0115 struct iscsi_boot_kobj *
0116 iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
0117                void *data,
0118                ssize_t (*show) (void *data, int type, char *buf),
0119                umode_t (*is_visible) (void *data, int type),
0120                void (*release) (void *data));
0121 struct iscsi_boot_kobj *
0122 iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
0123              void *data,
0124              ssize_t (*show) (void *data, int type, char *buf),
0125              umode_t (*is_visible) (void *data, int type),
0126              void (*release) (void *data));
0127 
0128 struct iscsi_boot_kobj *
0129 iscsi_boot_create_acpitbl(struct iscsi_boot_kset *boot_kset, int index,
0130               void *data,
0131               ssize_t (*show)(void *data, int type, char *buf),
0132               umode_t (*is_visible)(void *data, int type),
0133               void (*release)(void *data));
0134 
0135 struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
0136 struct iscsi_boot_kset *iscsi_boot_create_host_kset(unsigned int hostno);
0137 void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset);
0138 
0139 #endif