Lines Matching refs:ret
60 int ret = 0; in srpt_GetConfig() local
71 ret = stmfGetProviderDataProt(SRPT_PROV_NAME, &cfg_nv, in srpt_GetConfig()
74 if (ret == STMF_STATUS_SUCCESS) { in srpt_GetConfig()
75 ret = 0; in srpt_GetConfig()
76 } else if (ret == STMF_ERROR_NOT_FOUND) { in srpt_GetConfig()
78 ret = nvlist_alloc(&cfg_nv, NV_UNIQUE_NAME, 0); in srpt_GetConfig()
79 if (ret != 0) { in srpt_GetConfig()
80 return (ret); in srpt_GetConfig()
83 ret = nvlist_alloc(&hcanv, NV_UNIQUE_NAME, 0); in srpt_GetConfig()
84 if (ret == 0) { in srpt_GetConfig()
85 ret = nvlist_add_nvlist(cfg_nv, SRPT_PROP_HCALIST, in srpt_GetConfig()
87 if (ret != 0) { in srpt_GetConfig()
91 if (ret != 0) { in srpt_GetConfig()
95 } else if (ret == STMF_ERROR_NOMEM) { in srpt_GetConfig()
96 ret = ENOMEM; in srpt_GetConfig()
98 ret = EINVAL; in srpt_GetConfig()
104 return (ret); in srpt_GetConfig()
125 int ret = 0; in srpt_SetConfig() local
127 ret = stmfSetProviderDataProt(SRPT_PROV_NAME, cfg, in srpt_SetConfig()
130 if (ret == STMF_STATUS_SUCCESS) { in srpt_SetConfig()
131 ret = 0; in srpt_SetConfig()
132 } else if (ret == STMF_ERROR_NOMEM) { in srpt_SetConfig()
133 ret = ENOMEM; in srpt_SetConfig()
134 } else if (ret == STMF_ERROR_PROV_DATA_STALE) { in srpt_SetConfig()
135 ret = ECANCELED; /* could be a better errno */ in srpt_SetConfig()
137 ret = EINVAL; in srpt_SetConfig()
140 return (ret); in srpt_SetConfig()
160 int ret; in srpt_GetDefaultState() local
169 ret = srpt_GetConfig(&cfgnv, &token); in srpt_GetDefaultState()
170 if (ret != 0) { in srpt_GetDefaultState()
171 return (ret); in srpt_GetDefaultState()
175 ret = nvlist_lookup_boolean_value(cfgnv, in srpt_GetDefaultState()
178 if (ret == ENOENT) { in srpt_GetDefaultState()
179 ret = 0; in srpt_GetDefaultState()
184 return (ret); in srpt_GetDefaultState()
204 int ret; in srpt_SetDefaultState() local
208 ret = srpt_GetConfig(&cfgnv, &token); in srpt_SetDefaultState()
209 if (ret != 0) { in srpt_SetDefaultState()
210 return (ret); in srpt_SetDefaultState()
214 ret = nvlist_alloc(&cfgnv, NV_UNIQUE_NAME, 0); in srpt_SetDefaultState()
215 if (ret != 0) { in srpt_SetDefaultState()
216 return (ret); in srpt_SetDefaultState()
220 ret = nvlist_add_boolean_value(cfgnv, SRPT_PROP_DEFAULT_ENABLED, in srpt_SetDefaultState()
223 if (ret == 0) { in srpt_SetDefaultState()
224 ret = srpt_SetConfig(cfgnv, token); in srpt_SetDefaultState()
229 return (ret); in srpt_SetDefaultState()
249 int ret; in srpt_SetTargetState() local
261 ret = srpt_NormalizeGuid(hca_guid, guid, sizeof (guid), &hcaguid); in srpt_SetTargetState()
262 if (ret != 0) { in srpt_SetTargetState()
263 return (ret); in srpt_SetTargetState()
266 ret = srpt_GetConfig(&cfgnv, &token); in srpt_SetTargetState()
267 if (ret != 0) { in srpt_SetTargetState()
268 return (ret); in srpt_SetTargetState()
272 ret = nvlist_lookup_nvlist(cfgnv, SRPT_PROP_HCALIST, &hcalist); in srpt_SetTargetState()
273 if (ret != 0) { in srpt_SetTargetState()
275 return (ret); in srpt_SetTargetState()
278 ret = nvlist_lookup_nvlist(hcalist, guid, &hcanv); in srpt_SetTargetState()
279 if (ret == ENOENT) { in srpt_SetTargetState()
281 ret = nvlist_alloc(&hcanv, NV_UNIQUE_NAME, 0); in srpt_SetTargetState()
282 if (ret == 0) { in srpt_SetTargetState()
283 ret = nvlist_add_uint64(hcanv, SRPT_PROP_GUID, hcaguid); in srpt_SetTargetState()
287 if (ret == 0) { in srpt_SetTargetState()
288 ret = nvlist_add_boolean_value(hcanv, SRPT_PROP_ENABLED, in srpt_SetTargetState()
292 if (ret == 0) { in srpt_SetTargetState()
293 ret = nvlist_add_nvlist(hcalist, guid, hcanv); in srpt_SetTargetState()
296 if (ret == 0) { in srpt_SetTargetState()
297 ret = srpt_SetConfig(cfgnv, token); in srpt_SetTargetState()
302 return (ret); in srpt_SetTargetState()
322 int ret; in srpt_GetTargetState() local
334 ret = srpt_NormalizeGuid(hca_guid, guid, sizeof (guid), NULL); in srpt_GetTargetState()
335 if (ret != 0) { in srpt_GetTargetState()
336 return (ret); in srpt_GetTargetState()
339 ret = srpt_GetConfig(&cfgnv, &token); in srpt_GetTargetState()
340 if (ret != 0) { in srpt_GetTargetState()
341 return (ret); in srpt_GetTargetState()
345 ret = nvlist_lookup_nvlist(cfgnv, SRPT_PROP_HCALIST, &hcalist); in srpt_GetTargetState()
346 if (ret != 0) { in srpt_GetTargetState()
348 return (ret); in srpt_GetTargetState()
358 ret = nvlist_lookup_nvlist(hcalist, guid, &hcanv); in srpt_GetTargetState()
359 if (ret == 0) { in srpt_GetTargetState()
360 ret = nvlist_lookup_boolean_value(hcanv, SRPT_PROP_ENABLED, in srpt_GetTargetState()
364 if (ret == ENOENT) { in srpt_GetTargetState()
367 ret = 0; in srpt_GetTargetState()
372 return (ret); in srpt_GetTargetState()
393 int ret; in srpt_ResetTarget() local
403 ret = srpt_NormalizeGuid(hca_guid, guid, sizeof (guid), NULL); in srpt_ResetTarget()
404 if (ret != 0) { in srpt_ResetTarget()
405 return (ret); in srpt_ResetTarget()
408 ret = srpt_GetConfig(&cfgnv, &token); in srpt_ResetTarget()
409 if (ret != 0) { in srpt_ResetTarget()
410 return (ret); in srpt_ResetTarget()
414 ret = nvlist_lookup_nvlist(cfgnv, SRPT_PROP_HCALIST, &hcalist); in srpt_ResetTarget()
415 if (ret != 0) { in srpt_ResetTarget()
417 return (ret); in srpt_ResetTarget()
424 if (ret == 0) { in srpt_ResetTarget()
425 ret = srpt_SetConfig(cfgnv, token); in srpt_ResetTarget()
431 return (ret); in srpt_ResetTarget()