/*
*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>
#include <libscf.h>
/*
* Name: enable_local_fs
* Description: If the SMF service system/filesystem/local:default is not
* enabled, then this function enables the service, so that,
* all the local filesystems are mounted.
* Arguments: None
* Returns: B_TRUE on success; B_FALSE on error.
*/
enable_local_fs(void)
{
char *cur_smf_state;
int i;
if (fs_temporarily_enabled) {
return (B_TRUE);
}
!= 0) {
return (B_FALSE);
}
== 0) {
return (B_TRUE);
!= 0) {
return (B_FALSE);
}
} else {
return (B_FALSE);
}
for (i = 0; i < MAX_TRY; i++) {
== 0) {
if (fs_enabled_here) {
}
return (B_TRUE);
} else if ((strcmp(cur_smf_state,
SCF_STATE_STRING_OFFLINE) == 0) ||
(void) sleep(1);
} else {
return (B_FALSE);
}
} else {
return (B_FALSE);
}
}
return (B_FALSE);
}
/*
* Name: restore_local_fs
* Description: If the SMF service system/filesystem/local:default was
* enabled using enable_local_fs(), then this function disables
* the service.
* Arguments: None
* Returns: B_TRUE on success; B_FALSE on error.
*/
restore_local_fs(void)
{
int i;
char *cur_smf_state;
if (!fs_temporarily_enabled) {
return (B_TRUE);
}
return (B_FALSE);
}
for (i = 0; i < MAX_TRY; i++) {
== 0) {
break;
}
(void) sleep(1);
} else {
return (B_FALSE);
}
}
return (!fs_temporarily_enabled);
}