diff options
Diffstat (limited to 'drivers/target/sbp/sbp_target.c')
-rw-r--r-- | drivers/target/sbp/sbp_target.c | 87 |
1 files changed, 38 insertions, 49 deletions
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index 0edf320fb685..35f7d31b29d2 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c | |||
@@ -35,8 +35,6 @@ | |||
35 | #include <target/target_core_base.h> | 35 | #include <target/target_core_base.h> |
36 | #include <target/target_core_backend.h> | 36 | #include <target/target_core_backend.h> |
37 | #include <target/target_core_fabric.h> | 37 | #include <target/target_core_fabric.h> |
38 | #include <target/target_core_fabric_configfs.h> | ||
39 | #include <target/configfs_macros.h> | ||
40 | #include <asm/unaligned.h> | 38 | #include <asm/unaligned.h> |
41 | 39 | ||
42 | #include "sbp_target.h" | 40 | #include "sbp_target.h" |
@@ -2111,24 +2109,21 @@ static void sbp_drop_tport(struct se_wwn *wwn) | |||
2111 | kfree(tport); | 2109 | kfree(tport); |
2112 | } | 2110 | } |
2113 | 2111 | ||
2114 | static ssize_t sbp_wwn_show_attr_version( | 2112 | static ssize_t sbp_wwn_version_show(struct config_item *item, char *page) |
2115 | struct target_fabric_configfs *tf, | ||
2116 | char *page) | ||
2117 | { | 2113 | { |
2118 | return sprintf(page, "FireWire SBP fabric module %s\n", SBP_VERSION); | 2114 | return sprintf(page, "FireWire SBP fabric module %s\n", SBP_VERSION); |
2119 | } | 2115 | } |
2120 | 2116 | ||
2121 | TF_WWN_ATTR_RO(sbp, version); | 2117 | CONFIGFS_ATTR_RO(sbp_wwn_, version); |
2122 | 2118 | ||
2123 | static struct configfs_attribute *sbp_wwn_attrs[] = { | 2119 | static struct configfs_attribute *sbp_wwn_attrs[] = { |
2124 | &sbp_wwn_version.attr, | 2120 | &sbp_wwn_attr_version, |
2125 | NULL, | 2121 | NULL, |
2126 | }; | 2122 | }; |
2127 | 2123 | ||
2128 | static ssize_t sbp_tpg_show_directory_id( | 2124 | static ssize_t sbp_tpg_directory_id_show(struct config_item *item, char *page) |
2129 | struct se_portal_group *se_tpg, | ||
2130 | char *page) | ||
2131 | { | 2125 | { |
2126 | struct se_portal_group *se_tpg = to_tpg(item); | ||
2132 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2127 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2133 | struct sbp_tport *tport = tpg->tport; | 2128 | struct sbp_tport *tport = tpg->tport; |
2134 | 2129 | ||
@@ -2138,11 +2133,10 @@ static ssize_t sbp_tpg_show_directory_id( | |||
2138 | return sprintf(page, "%06x\n", tport->directory_id); | 2133 | return sprintf(page, "%06x\n", tport->directory_id); |
2139 | } | 2134 | } |
2140 | 2135 | ||
2141 | static ssize_t sbp_tpg_store_directory_id( | 2136 | static ssize_t sbp_tpg_directory_id_store(struct config_item *item, |
2142 | struct se_portal_group *se_tpg, | 2137 | const char *page, size_t count) |
2143 | const char *page, | ||
2144 | size_t count) | ||
2145 | { | 2138 | { |
2139 | struct se_portal_group *se_tpg = to_tpg(item); | ||
2146 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2140 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2147 | struct sbp_tport *tport = tpg->tport; | 2141 | struct sbp_tport *tport = tpg->tport; |
2148 | unsigned long val; | 2142 | unsigned long val; |
@@ -2166,20 +2160,18 @@ static ssize_t sbp_tpg_store_directory_id( | |||
2166 | return count; | 2160 | return count; |
2167 | } | 2161 | } |
2168 | 2162 | ||
2169 | static ssize_t sbp_tpg_show_enable( | 2163 | static ssize_t sbp_tpg_enable_show(struct config_item *item, char *page) |
2170 | struct se_portal_group *se_tpg, | ||
2171 | char *page) | ||
2172 | { | 2164 | { |
2165 | struct se_portal_group *se_tpg = to_tpg(item); | ||
2173 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2166 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2174 | struct sbp_tport *tport = tpg->tport; | 2167 | struct sbp_tport *tport = tpg->tport; |
2175 | return sprintf(page, "%d\n", tport->enable); | 2168 | return sprintf(page, "%d\n", tport->enable); |
2176 | } | 2169 | } |
2177 | 2170 | ||
2178 | static ssize_t sbp_tpg_store_enable( | 2171 | static ssize_t sbp_tpg_enable_store(struct config_item *item, |
2179 | struct se_portal_group *se_tpg, | 2172 | const char *page, size_t count) |
2180 | const char *page, | ||
2181 | size_t count) | ||
2182 | { | 2173 | { |
2174 | struct se_portal_group *se_tpg = to_tpg(item); | ||
2183 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2175 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2184 | struct sbp_tport *tport = tpg->tport; | 2176 | struct sbp_tport *tport = tpg->tport; |
2185 | unsigned long val; | 2177 | unsigned long val; |
@@ -2219,29 +2211,28 @@ static ssize_t sbp_tpg_store_enable( | |||
2219 | return count; | 2211 | return count; |
2220 | } | 2212 | } |
2221 | 2213 | ||
2222 | TF_TPG_BASE_ATTR(sbp, directory_id, S_IRUGO | S_IWUSR); | 2214 | CONFIGFS_ATTR(sbp_tpg_, directory_id); |
2223 | TF_TPG_BASE_ATTR(sbp, enable, S_IRUGO | S_IWUSR); | 2215 | CONFIGFS_ATTR(sbp_tpg_, enable); |
2224 | 2216 | ||
2225 | static struct configfs_attribute *sbp_tpg_base_attrs[] = { | 2217 | static struct configfs_attribute *sbp_tpg_base_attrs[] = { |
2226 | &sbp_tpg_directory_id.attr, | 2218 | &sbp_tpg_attr_directory_id, |
2227 | &sbp_tpg_enable.attr, | 2219 | &sbp_tpg_attr_enable, |
2228 | NULL, | 2220 | NULL, |
2229 | }; | 2221 | }; |
2230 | 2222 | ||
2231 | static ssize_t sbp_tpg_attrib_show_mgt_orb_timeout( | 2223 | static ssize_t sbp_tpg_attrib_mgt_orb_timeout_show(struct config_item *item, |
2232 | struct se_portal_group *se_tpg, | ||
2233 | char *page) | 2224 | char *page) |
2234 | { | 2225 | { |
2226 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2235 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2227 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2236 | struct sbp_tport *tport = tpg->tport; | 2228 | struct sbp_tport *tport = tpg->tport; |
2237 | return sprintf(page, "%d\n", tport->mgt_orb_timeout); | 2229 | return sprintf(page, "%d\n", tport->mgt_orb_timeout); |
2238 | } | 2230 | } |
2239 | 2231 | ||
2240 | static ssize_t sbp_tpg_attrib_store_mgt_orb_timeout( | 2232 | static ssize_t sbp_tpg_attrib_mgt_orb_timeout_store(struct config_item *item, |
2241 | struct se_portal_group *se_tpg, | 2233 | const char *page, size_t count) |
2242 | const char *page, | ||
2243 | size_t count) | ||
2244 | { | 2234 | { |
2235 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2245 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2236 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2246 | struct sbp_tport *tport = tpg->tport; | 2237 | struct sbp_tport *tport = tpg->tport; |
2247 | unsigned long val; | 2238 | unsigned long val; |
@@ -2264,20 +2255,19 @@ static ssize_t sbp_tpg_attrib_store_mgt_orb_timeout( | |||
2264 | return count; | 2255 | return count; |
2265 | } | 2256 | } |
2266 | 2257 | ||
2267 | static ssize_t sbp_tpg_attrib_show_max_reconnect_timeout( | 2258 | static ssize_t sbp_tpg_attrib_max_reconnect_timeout_show(struct config_item *item, |
2268 | struct se_portal_group *se_tpg, | ||
2269 | char *page) | 2259 | char *page) |
2270 | { | 2260 | { |
2261 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2271 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2262 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2272 | struct sbp_tport *tport = tpg->tport; | 2263 | struct sbp_tport *tport = tpg->tport; |
2273 | return sprintf(page, "%d\n", tport->max_reconnect_timeout); | 2264 | return sprintf(page, "%d\n", tport->max_reconnect_timeout); |
2274 | } | 2265 | } |
2275 | 2266 | ||
2276 | static ssize_t sbp_tpg_attrib_store_max_reconnect_timeout( | 2267 | static ssize_t sbp_tpg_attrib_max_reconnect_timeout_store(struct config_item *item, |
2277 | struct se_portal_group *se_tpg, | 2268 | const char *page, size_t count) |
2278 | const char *page, | ||
2279 | size_t count) | ||
2280 | { | 2269 | { |
2270 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2281 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2271 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2282 | struct sbp_tport *tport = tpg->tport; | 2272 | struct sbp_tport *tport = tpg->tport; |
2283 | unsigned long val; | 2273 | unsigned long val; |
@@ -2300,20 +2290,19 @@ static ssize_t sbp_tpg_attrib_store_max_reconnect_timeout( | |||
2300 | return count; | 2290 | return count; |
2301 | } | 2291 | } |
2302 | 2292 | ||
2303 | static ssize_t sbp_tpg_attrib_show_max_logins_per_lun( | 2293 | static ssize_t sbp_tpg_attrib_max_logins_per_lun_show(struct config_item *item, |
2304 | struct se_portal_group *se_tpg, | ||
2305 | char *page) | 2294 | char *page) |
2306 | { | 2295 | { |
2296 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2307 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2297 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2308 | struct sbp_tport *tport = tpg->tport; | 2298 | struct sbp_tport *tport = tpg->tport; |
2309 | return sprintf(page, "%d\n", tport->max_logins_per_lun); | 2299 | return sprintf(page, "%d\n", tport->max_logins_per_lun); |
2310 | } | 2300 | } |
2311 | 2301 | ||
2312 | static ssize_t sbp_tpg_attrib_store_max_logins_per_lun( | 2302 | static ssize_t sbp_tpg_attrib_max_logins_per_lun_store(struct config_item *item, |
2313 | struct se_portal_group *se_tpg, | 2303 | const char *page, size_t count) |
2314 | const char *page, | ||
2315 | size_t count) | ||
2316 | { | 2304 | { |
2305 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2317 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2306 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2318 | struct sbp_tport *tport = tpg->tport; | 2307 | struct sbp_tport *tport = tpg->tport; |
2319 | unsigned long val; | 2308 | unsigned long val; |
@@ -2330,14 +2319,14 @@ static ssize_t sbp_tpg_attrib_store_max_logins_per_lun( | |||
2330 | return count; | 2319 | return count; |
2331 | } | 2320 | } |
2332 | 2321 | ||
2333 | TF_TPG_ATTRIB_ATTR(sbp, mgt_orb_timeout, S_IRUGO | S_IWUSR); | 2322 | CONFIGFS_ATTR(sbp_tpg_attrib_, mgt_orb_timeout); |
2334 | TF_TPG_ATTRIB_ATTR(sbp, max_reconnect_timeout, S_IRUGO | S_IWUSR); | 2323 | CONFIGFS_ATTR(sbp_tpg_attrib_, max_reconnect_timeout); |
2335 | TF_TPG_ATTRIB_ATTR(sbp, max_logins_per_lun, S_IRUGO | S_IWUSR); | 2324 | CONFIGFS_ATTR(sbp_tpg_attrib_, max_logins_per_lun); |
2336 | 2325 | ||
2337 | static struct configfs_attribute *sbp_tpg_attrib_attrs[] = { | 2326 | static struct configfs_attribute *sbp_tpg_attrib_attrs[] = { |
2338 | &sbp_tpg_attrib_mgt_orb_timeout.attr, | 2327 | &sbp_tpg_attrib_attr_mgt_orb_timeout, |
2339 | &sbp_tpg_attrib_max_reconnect_timeout.attr, | 2328 | &sbp_tpg_attrib_attr_max_reconnect_timeout, |
2340 | &sbp_tpg_attrib_max_logins_per_lun.attr, | 2329 | &sbp_tpg_attrib_attr_max_logins_per_lun, |
2341 | NULL, | 2330 | NULL, |
2342 | }; | 2331 | }; |
2343 | 2332 | ||