Print this page
4095 minor cleanup up libshare
*** 22,31 ****
--- 22,35 ----
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+ /*
+ * Copyright (c) 2013 RackTop Systems.
+ */
+
/* helper functions for using libscf with sharemgr */
#include <libscf.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
*** 41,52 ****
#include <sys/time.h>
#include <libintl.h>
ssize_t scf_max_name_len;
extern struct sa_proto_plugin *sap_proto_list;
! extern sa_handle_impl_t get_handle_for_root(xmlNodePtr);
! static void set_transaction_tstamp(sa_handle_impl_t);
/*
* The SMF facility uses some properties that must exist. We want to
* skip over these when processing protocol options.
*/
static char *skip_props[] = {
--- 45,56 ----
#include <sys/time.h>
#include <libintl.h>
ssize_t scf_max_name_len;
extern struct sa_proto_plugin *sap_proto_list;
! extern sa_handle_t get_handle_for_root(xmlNodePtr);
! static void set_transaction_tstamp(sa_handle_t);
/*
* The SMF facility uses some properties that must exist. We want to
* skip over these when processing protocol options.
*/
static char *skip_props[] = {
*** 95,105 ****
* Must be called before using any of the SCF functions. Called by
* sa_init() during the API setup.
*/
scfutilhandle_t *
! sa_scf_init(sa_handle_impl_t ihandle)
{
scfutilhandle_t *handle;
scf_max_name_len = scf_limit(SCF_LIMIT_MAX_NAME_LENGTH);
if (scf_max_name_len <= 0)
--- 99,109 ----
* Must be called before using any of the SCF functions. Called by
* sa_init() during the API setup.
*/
scfutilhandle_t *
! sa_scf_init(sa_handle_t ihandle)
{
scfutilhandle_t *handle;
scf_max_name_len = scf_limit(SCF_LIMIT_MAX_NAME_LENGTH);
if (scf_max_name_len <= 0)
*** 139,149 ****
goto err;
handle->scf_state = SCH_STATE_INIT;
if (sa_get_instance(handle, "default") != SA_OK) {
sa_group_t defgrp;
! defgrp = sa_create_group((sa_handle_t)ihandle, "default", NULL);
/* Only NFS enabled for "default" group. */
if (defgrp != NULL)
(void) sa_create_optionset(defgrp, "nfs");
}
--- 143,153 ----
goto err;
handle->scf_state = SCH_STATE_INIT;
if (sa_get_instance(handle, "default") != SA_OK) {
sa_group_t defgrp;
! defgrp = sa_create_group(ihandle, "default", NULL);
/* Only NFS enabled for "default" group. */
if (defgrp != NULL)
(void) sa_create_optionset(defgrp, "nfs");
}
*** 1347,1357 ****
* Commit the changes that were added to the transaction in the
* handle. Do all necessary cleanup.
*/
int
! sa_end_transaction(scfutilhandle_t *handle, sa_handle_impl_t sahandle)
{
int ret = SA_OK;
if (handle == NULL || handle->trans == NULL || sahandle == NULL) {
ret = SA_SYSTEM_ERR;
--- 1351,1361 ----
* Commit the changes that were added to the transaction in the
* handle. Do all necessary cleanup.
*/
int
! sa_end_transaction(scfutilhandle_t *handle, sa_handle_t sahandle)
{
int ret = SA_OK;
if (handle == NULL || handle->trans == NULL || sahandle == NULL) {
ret = SA_SYSTEM_ERR;
*** 1390,1400 ****
*
* After a successful transaction commit, update the timestamp of the
* last transaction. This lets us detect changes from other processes.
*/
static void
! set_transaction_tstamp(sa_handle_impl_t sahandle)
{
char tstring[32];
struct timeval tv;
scfutilhandle_t *scfhandle;
--- 1394,1404 ----
*
* After a successful transaction commit, update the timestamp of the
* last transaction. This lets us detect changes from other processes.
*/
static void
! set_transaction_tstamp(sa_handle_t sahandle)
{
char tstring[32];
struct timeval tv;
scfutilhandle_t *scfhandle;
*** 1774,1786 ****
sa_free_share_description(description);
}
}
/* Make sure we cleanup the transaction */
if (ret == SA_OK) {
! sa_handle_impl_t sahandle;
! sahandle = (sa_handle_impl_t)
! sa_find_group_handle(group);
if (sahandle != NULL)
ret = sa_end_transaction(handle,
sahandle);
else
ret = SA_SYSTEM_ERR;
--- 1778,1789 ----
sa_free_share_description(description);
}
}
/* Make sure we cleanup the transaction */
if (ret == SA_OK) {
! sa_handle_t sahandle;
! sahandle = sa_find_group_handle(group);
if (sahandle != NULL)
ret = sa_end_transaction(handle,
sahandle);
else
ret = SA_SYSTEM_ERR;