249 topo_mod_dprintf(mod, "disk_set_props: "
250 "set serial error %s\n", topo_strerror(err));
251 goto error;
252 }
253 if (dnode->ddn_firm && (topo_prop_set_string(dtn, TOPO_PGROUP_STORAGE,
254 TOPO_STORAGE_FIRMWARE_REV, TOPO_PROP_IMMUTABLE,
255 dnode->ddn_firm, &err) != 0)) {
256 topo_mod_dprintf(mod, "disk_set_props: "
257 "set firm error %s\n", topo_strerror(err));
258 goto error;
259 }
260 if (dnode->ddn_cap && (topo_prop_set_string(dtn, TOPO_PGROUP_STORAGE,
261 TOPO_STORAGE_CAPACITY, TOPO_PROP_IMMUTABLE,
262 dnode->ddn_cap, &err) != 0)) {
263 topo_mod_dprintf(mod, "disk_set_props: "
264 "set cap error %s\n", topo_strerror(err));
265 goto error;
266 }
267 err = 0;
268
269 out: if (fmri)
270 nvlist_free(fmri);
271 if (label)
272 topo_mod_strfree(mod, label);
273 if (asru)
274 nvlist_free(asru);
275 return (err);
276
277 error: err = topo_mod_seterrno(mod, err);
278 goto out;
279 }
280
281 /*
282 * Trim leading and trailing whitespace from the string.
283 */
284 static char *
285 disk_trim_whitespace(topo_mod_t *mod, const char *begin)
286 {
287 const char *end;
288 char *buf;
289 size_t count;
290
291 if (begin == NULL)
292 return (NULL);
293
|
249 topo_mod_dprintf(mod, "disk_set_props: "
250 "set serial error %s\n", topo_strerror(err));
251 goto error;
252 }
253 if (dnode->ddn_firm && (topo_prop_set_string(dtn, TOPO_PGROUP_STORAGE,
254 TOPO_STORAGE_FIRMWARE_REV, TOPO_PROP_IMMUTABLE,
255 dnode->ddn_firm, &err) != 0)) {
256 topo_mod_dprintf(mod, "disk_set_props: "
257 "set firm error %s\n", topo_strerror(err));
258 goto error;
259 }
260 if (dnode->ddn_cap && (topo_prop_set_string(dtn, TOPO_PGROUP_STORAGE,
261 TOPO_STORAGE_CAPACITY, TOPO_PROP_IMMUTABLE,
262 dnode->ddn_cap, &err) != 0)) {
263 topo_mod_dprintf(mod, "disk_set_props: "
264 "set cap error %s\n", topo_strerror(err));
265 goto error;
266 }
267 err = 0;
268
269 out:
270 nvlist_free(fmri);
271 if (label)
272 topo_mod_strfree(mod, label);
273 nvlist_free(asru);
274 return (err);
275
276 error: err = topo_mod_seterrno(mod, err);
277 goto out;
278 }
279
280 /*
281 * Trim leading and trailing whitespace from the string.
282 */
283 static char *
284 disk_trim_whitespace(topo_mod_t *mod, const char *begin)
285 {
286 const char *end;
287 char *buf;
288 size_t count;
289
290 if (begin == NULL)
291 return (NULL);
292
|