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
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24 /*
25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 */
27
28
29 /*
30 * XML document manipulation routines
31 *
32 * These routines provide translation to and from the internal representation to
33 * XML. Directionally-oriented verbs are with respect to the external source,
34 * so lxml_get_service() fetches a service from the XML file into the
35 * internal representation.
36 */
37
38 #include <libxml/parser.h>
39 #include <libxml/xinclude.h>
40
41 #include <assert.h>
42 #include <ctype.h>
43 #include <errno.h>
44 #include <libintl.h>
45 #include <libscf.h>
3300 }
3301
3302 if (lxml_get_template(i, cursor) != 0)
3303 return (-1);
3304 break;
3305 case SC_NOTIFICATION_PARAMETERS:
3306 if (lxml_get_notification_parameters(i, cursor) != 0)
3307 return (-1);
3308 break;
3309 default:
3310 uu_die(gettext(
3311 "illegal element \"%s\" on instance \"%s\"\n"),
3312 cursor->name, i->sc_name);
3313 break;
3314 }
3315 }
3316
3317 return (0);
3318 }
3319
3320 /* ARGSUSED1 */
3321 static int
3322 lxml_get_single_instance(entity_t *entity, xmlNodePtr si)
3323 {
3324 pgroup_t *pg;
3325 property_t *p;
3326 int r;
3327
3328 pg = internal_pgroup_find_or_create(entity, (char *)scf_pg_general,
3329 (char *)scf_group_framework);
3330
3331 p = internal_property_create(SCF_PROPERTY_SINGLE_INSTANCE,
3332 SCF_TYPE_BOOLEAN, 1, (uint64_t)1);
3333
3334 r = internal_attach_property(pg, p);
3335 if (r != 0) {
3336 internal_property_free(p);
3337 return (-1);
3338 }
3339
3340 return (0);
3341 }
3342
|
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
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24 /*
25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 * Copyright 2019 Joyent, Inc.
27 */
28
29
30 /*
31 * XML document manipulation routines
32 *
33 * These routines provide translation to and from the internal representation to
34 * XML. Directionally-oriented verbs are with respect to the external source,
35 * so lxml_get_service() fetches a service from the XML file into the
36 * internal representation.
37 */
38
39 #include <libxml/parser.h>
40 #include <libxml/xinclude.h>
41
42 #include <assert.h>
43 #include <ctype.h>
44 #include <errno.h>
45 #include <libintl.h>
46 #include <libscf.h>
3301 }
3302
3303 if (lxml_get_template(i, cursor) != 0)
3304 return (-1);
3305 break;
3306 case SC_NOTIFICATION_PARAMETERS:
3307 if (lxml_get_notification_parameters(i, cursor) != 0)
3308 return (-1);
3309 break;
3310 default:
3311 uu_die(gettext(
3312 "illegal element \"%s\" on instance \"%s\"\n"),
3313 cursor->name, i->sc_name);
3314 break;
3315 }
3316 }
3317
3318 return (0);
3319 }
3320
3321 /*
3322 * Unimplemented and obsolete, but we still process it for compatibility
3323 * purposes.
3324 */
3325 static int
3326 lxml_get_single_instance(entity_t *entity, xmlNodePtr si __unused)
3327 {
3328 pgroup_t *pg;
3329 property_t *p;
3330 int r;
3331
3332 pg = internal_pgroup_find_or_create(entity, (char *)scf_pg_general,
3333 (char *)scf_group_framework);
3334
3335 p = internal_property_create(SCF_PROPERTY_SINGLE_INSTANCE,
3336 SCF_TYPE_BOOLEAN, 1, (uint64_t)1);
3337
3338 r = internal_attach_property(pg, p);
3339 if (r != 0) {
3340 internal_property_free(p);
3341 return (-1);
3342 }
3343
3344 return (0);
3345 }
3346
|