summaryrefslogtreecommitdiff
path: root/usr/src/lib/libscf
diff options
context:
space:
mode:
authorstevep <none@none>2008-02-19 10:33:55 -0800
committerstevep <none@none>2008-02-19 10:33:55 -0800
commitc0889d7a91fa87e1cb7ef4457629b0cb51d47b50 (patch)
tree6d61969fd57b6c78ff2948c9d41b3c23f674ca34 /usr/src/lib/libscf
parent81d97edfb9c61e08bc3e3776a29b9d7d0e87e574 (diff)
downloadillumos-joyent-c0889d7a91fa87e1cb7ef4457629b0cb51d47b50.tar.gz
6351623 Initial manifest-import is slow
Diffstat (limited to 'usr/src/lib/libscf')
-rw-r--r--usr/src/lib/libscf/common/lowlevel.c49
-rw-r--r--usr/src/lib/libscf/common/mapfile-vers1
-rw-r--r--usr/src/lib/libscf/inc/libscf_priv.h13
3 files changed, 63 insertions, 0 deletions
diff --git a/usr/src/lib/libscf/common/lowlevel.c b/usr/src/lib/libscf/common/lowlevel.c
index a9265f9c1c..4c25197400 100644
--- a/usr/src/lib/libscf/common/lowlevel.c
+++ b/usr/src/lib/libscf/common/lowlevel.c
@@ -6860,6 +6860,55 @@ _scf_request_backup(scf_handle_t *h, const char *name)
return (SCF_SUCCESS);
}
+/*
+ * Request svc.configd daemon to switch repository database.
+ *
+ * Can fail:
+ *
+ * _NOT_BOUND handle is not bound
+ * _CONNECTION_BROKEN server is not reachable
+ * _INTERNAL file operation error
+ * the server response is too big
+ * _PERMISSION_DENIED not enough privileges to do request
+ * _BACKEND_READONLY backend is not writable
+ * _BACKEND_ACCESS backend access fails
+ * _NO_RESOURCES svc.configd is out of memory
+ */
+int
+_scf_repository_switch(scf_handle_t *h, int scf_sw)
+{
+ struct rep_protocol_switch_request request;
+ struct rep_protocol_response response;
+ int r;
+
+ /*
+ * Setup request protocol and make door call
+ * Hold rh_lock lock before handle_next_changeid call
+ */
+ (void) pthread_mutex_lock(&h->rh_lock);
+
+ request.rpr_flag = scf_sw;
+ request.rpr_request = REP_PROTOCOL_SWITCH;
+ request.rpr_changeid = handle_next_changeid(h);
+
+ r = make_door_call(h, &request, sizeof (request),
+ &response, sizeof (response));
+
+ (void) pthread_mutex_unlock(&h->rh_lock);
+
+ if (r < 0) {
+ DOOR_ERRORS_BLOCK(r);
+ }
+
+ /*
+ * Pass protocol error up
+ */
+ if (response.rpr_response != REP_PROTOCOL_SUCCESS)
+ return (scf_set_error(proto_error(response.rpr_response)));
+
+ return (SCF_SUCCESS);
+}
+
int
_scf_pg_is_read_protected(const scf_propertygroup_t *pg, boolean_t *out)
{
diff --git a/usr/src/lib/libscf/common/mapfile-vers b/usr/src/lib/libscf/common/mapfile-vers
index 898e8307ac..315e24d9e8 100644
--- a/usr/src/lib/libscf/common/mapfile-vers
+++ b/usr/src/lib/libscf/common/mapfile-vers
@@ -234,6 +234,7 @@ SUNWprivate_1.1 {
scf_simple_handle_destroy;
gen_filenms_from_fmri;
_scf_pg_is_read_protected;
+ _scf_repository_switch;
local:
*;
};
diff --git a/usr/src/lib/libscf/inc/libscf_priv.h b/usr/src/lib/libscf/inc/libscf_priv.h
index 39c92d20b7..67c966715f 100644
--- a/usr/src/lib/libscf/inc/libscf_priv.h
+++ b/usr/src/lib/libscf/inc/libscf_priv.h
@@ -281,6 +281,14 @@ int scf_set_count_property(scf_transaction_t *, char *, uint64_t, boolean_t);
#define SCF_WALK_NOINSTANCE 0x10
#define SCF_WALK_EXPLICIT 0x20
+/*
+ * The default locations of the repository dbs
+ */
+#define REPOSITORY_DB "/etc/svc/repository.db"
+#define NONPERSIST_DB "/etc/svc/volatile/svc_nonpersist.db"
+#define FAST_REPOSITORY_DB "/etc/svc/volatile/fast_repository.db"
+
+
typedef struct scf_walkinfo {
const char *fmri;
scf_scope_t *scope;
@@ -308,6 +316,11 @@ scf_error_t scf_walk_fmri(scf_handle_t *, int, char **, int,
int _scf_request_backup(scf_handle_t *, const char *);
/*
+ * Repository switch client
+ */
+int _scf_repository_switch(scf_handle_t *, int);
+
+/*
* Determines whether a property group requires authorization to read; this
* does not in any way reflect whether the caller has that authorization.
* To determine that, the caller must attempt to read the value of one of the