topo_mod.c (24db4641) topo_mod.c (12cc75c8)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 296 unchanged lines hidden (view full) ---

305 */
306 if (pnode != NULL || auth != NULL || part != NULL || rev != NULL ||
307 serial != NULL || hc_specific != NULL) {
308 if (topo_mod_nvalloc(mod, &args, NV_UNIQUE_NAME) != 0)
309 return (set_fmri_err(mod, EMOD_FMRI_NVL));
310 }
311
312 if (pnode != NULL) {
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 296 unchanged lines hidden (view full) ---

305 */
306 if (pnode != NULL || auth != NULL || part != NULL || rev != NULL ||
307 serial != NULL || hc_specific != NULL) {
308 if (topo_mod_nvalloc(mod, &args, NV_UNIQUE_NAME) != 0)
309 return (set_fmri_err(mod, EMOD_FMRI_NVL));
310 }
311
312 if (pnode != NULL) {
313 if (topo_node_resource(pnode, &pfmri, &err) < 0)
313 if (topo_node_resource(pnode, &pfmri, &err) < 0) {
314 nvlist_free(args);
314 return (set_fmri_err(mod, EMOD_NVL_INVAL));
315 return (set_fmri_err(mod, EMOD_NVL_INVAL));
316 }
315
316 if (nvlist_add_nvlist(args, TOPO_METH_FMRI_ARG_PARENT,
317 pfmri) != 0) {
318 nvlist_free(pfmri);
319 nvlist_free(args);
320 return (set_fmri_err(mod, EMOD_FMRI_NVL));
321 }
322 nvlist_free(pfmri);

--- 371 unchanged lines hidden (view full) ---

694topo_mod_auth(topo_mod_t *mod, tnode_t *pnode)
695{
696 int err;
697 char *prod = NULL;
698 char *csn = NULL;
699 char *server = NULL;
700 nvlist_t *auth;
701
317
318 if (nvlist_add_nvlist(args, TOPO_METH_FMRI_ARG_PARENT,
319 pfmri) != 0) {
320 nvlist_free(pfmri);
321 nvlist_free(args);
322 return (set_fmri_err(mod, EMOD_FMRI_NVL));
323 }
324 nvlist_free(pfmri);

--- 371 unchanged lines hidden (view full) ---

696topo_mod_auth(topo_mod_t *mod, tnode_t *pnode)
697{
698 int err;
699 char *prod = NULL;
700 char *csn = NULL;
701 char *server = NULL;
702 nvlist_t *auth;
703
704 if ((err = topo_mod_nvalloc(mod, &auth, NV_UNIQUE_NAME)) != 0) {
705 (void) topo_mod_seterrno(mod, EMOD_FMRI_NVL);
706 return (NULL);
707 }
708
702 (void) topo_prop_get_string(pnode, FM_FMRI_AUTHORITY,
703 FM_FMRI_AUTH_PRODUCT, &prod, &err);
704 (void) topo_prop_get_string(pnode, FM_FMRI_AUTHORITY,
705 FM_FMRI_AUTH_CHASSIS, &csn, &err);
706 (void) topo_prop_get_string(pnode, FM_FMRI_AUTHORITY,
707 FM_FMRI_AUTH_SERVER, &server, &err);
708
709 /*

--- 5 unchanged lines hidden (view full) ---

715 csn = topo_mod_csn(mod);
716 if (server == NULL) {
717 server = topo_mod_server(mod);
718 }
719
720 /*
721 * No luck, return NULL
722 */
709 (void) topo_prop_get_string(pnode, FM_FMRI_AUTHORITY,
710 FM_FMRI_AUTH_PRODUCT, &prod, &err);
711 (void) topo_prop_get_string(pnode, FM_FMRI_AUTHORITY,
712 FM_FMRI_AUTH_CHASSIS, &csn, &err);
713 (void) topo_prop_get_string(pnode, FM_FMRI_AUTHORITY,
714 FM_FMRI_AUTH_SERVER, &server, &err);
715
716 /*

--- 5 unchanged lines hidden (view full) ---

722 csn = topo_mod_csn(mod);
723 if (server == NULL) {
724 server = topo_mod_server(mod);
725 }
726
727 /*
728 * No luck, return NULL
729 */
723 if (!prod && !server && !csn)
730 if (!prod && !server && !csn) {
731 nvlist_free(auth);
724 return (NULL);
732 return (NULL);
725
726 if ((err = topo_mod_nvalloc(mod, &auth, NV_UNIQUE_NAME)) != 0) {
727 (void) topo_mod_seterrno(mod, EMOD_FMRI_NVL);
728 return (NULL);
729 }
730
733 }
734
735 err = 0;
731 if (prod != NULL) {
732 err |= nvlist_add_string(auth, FM_FMRI_AUTH_PRODUCT, prod);
733 topo_mod_strfree(mod, prod);
734 }
735 if (server != NULL) {
736 err |= nvlist_add_string(auth, FM_FMRI_AUTH_SERVER, server);
737 topo_mod_strfree(mod, server);
738 }

--- 27 unchanged lines hidden ---
736 if (prod != NULL) {
737 err |= nvlist_add_string(auth, FM_FMRI_AUTH_PRODUCT, prod);
738 topo_mod_strfree(mod, prod);
739 }
740 if (server != NULL) {
741 err |= nvlist_add_string(auth, FM_FMRI_AUTH_SERVER, server);
742 topo_mod_strfree(mod, server);
743 }

--- 27 unchanged lines hidden ---