45 static conerr_t |
45 static conerr_t |
46 maperr(scf_error_t e) |
46 maperr(scf_error_t e) |
47 { |
47 { |
48 switch (e) { |
48 switch (e) { |
49 case SCF_ERROR_NONE: |
49 case SCF_ERROR_NONE: |
50 return (ce_ok); |
50 return (CE_OK); |
51 case SCF_ERROR_PERMISSION_DENIED: |
51 case SCF_ERROR_PERMISSION_DENIED: |
52 return (ce_priv); |
52 return (CE_PRIV); |
53 default: |
53 default: |
54 return (ce_system); |
54 return (CE_SYSTEM); |
55 } |
55 } |
56 } |
56 } |
57 |
57 |
58 conerr_t |
58 conerr_t |
59 smfu_get_property(char *fmri, char *pgname, char *propname, char *value, |
59 smfu_get_property(char *fmri, char *pgname, char *propname, char *value, |
60 size_t n) |
60 size_t n) |
61 { |
61 { |
62 conerr_t err = ce_ok; |
62 conerr_t err = CE_OK; |
63 scf_handle_t *scfhandle = handle_create(); |
63 scf_handle_t *scfhandle = handle_create(); |
64 scf_service_t *service = scf_service_create(scfhandle); |
64 scf_service_t *service = scf_service_create(scfhandle); |
65 scf_instance_t *instance = scf_instance_create(scfhandle); |
65 scf_instance_t *instance = scf_instance_create(scfhandle); |
66 scf_propertygroup_t *pg = scf_pg_create(scfhandle); |
66 scf_propertygroup_t *pg = scf_pg_create(scfhandle); |
67 scf_property_t *prop = scf_property_create(scfhandle); |
67 scf_property_t *prop = scf_property_create(scfhandle); |
68 scf_iter_t *iter = scf_iter_create(scfhandle); |
68 scf_iter_t *iter = scf_iter_create(scfhandle); |
69 scf_value_t *val = scf_value_create(scfhandle); |
69 scf_value_t *val = scf_value_create(scfhandle); |
70 |
70 |
71 if (scfhandle == NULL || service == NULL || instance == NULL || |
71 if (scfhandle == NULL || service == NULL || instance == NULL || |
72 pg == NULL || prop == NULL || iter == NULL || val == NULL) { |
72 pg == NULL || prop == NULL || iter == NULL || val == NULL) { |
73 err = ce_nomem; |
73 err = CE_NOMEM; |
74 goto out; |
74 goto out; |
75 } |
75 } |
76 |
76 |
77 if (scf_handle_decode_fmri(scfhandle, fmri, NULL, service, instance, |
77 if (scf_handle_decode_fmri(scfhandle, fmri, NULL, service, instance, |
78 NULL, NULL, 0) != SCF_SUCCESS) { |
78 NULL, NULL, 0) != SCF_SUCCESS) { |
112 } |
112 } |
113 |
113 |
114 conerr_t |
114 conerr_t |
115 smfu_set_property(char *fmri, char *pgname, char *propname, char *value) |
115 smfu_set_property(char *fmri, char *pgname, char *propname, char *value) |
116 { |
116 { |
117 conerr_t err = ce_ok; |
117 conerr_t err = CE_OK; |
118 scf_handle_t *scfhandle = handle_create(); |
118 scf_handle_t *scfhandle = handle_create(); |
119 scf_service_t *service = scf_service_create(scfhandle); |
119 scf_service_t *service = scf_service_create(scfhandle); |
120 scf_instance_t *instance = scf_instance_create(scfhandle); |
120 scf_instance_t *instance = scf_instance_create(scfhandle); |
121 scf_propertygroup_t *pg = scf_pg_create(scfhandle); |
121 scf_propertygroup_t *pg = scf_pg_create(scfhandle); |
122 scf_property_t *prop = scf_property_create(scfhandle); |
122 scf_property_t *prop = scf_property_create(scfhandle); |
126 scf_type_t type; |
126 scf_type_t type; |
127 |
127 |
128 if (scfhandle == NULL || service == NULL || instance == NULL || |
128 if (scfhandle == NULL || service == NULL || instance == NULL || |
129 pg == NULL || prop == NULL || tx == NULL || ent == NULL || |
129 pg == NULL || prop == NULL || tx == NULL || ent == NULL || |
130 val == NULL) { |
130 val == NULL) { |
131 err = ce_nomem; |
131 err = CE_NOMEM; |
132 goto out; |
132 goto out; |
133 } |
133 } |
134 |
134 |
135 if (scf_handle_decode_fmri(scfhandle, fmri, NULL, service, instance, |
135 if (scf_handle_decode_fmri(scfhandle, fmri, NULL, service, instance, |
136 NULL, NULL, 0) != SCF_SUCCESS) { |
136 NULL, NULL, 0) != SCF_SUCCESS) { |