/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <dirent.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <synch.h>
#include <unistd.h>
#include <fcntl.h>
#include "libdiskmgt.h"
#include "disks_private.h"
/*
* The list of filesystem heuristic programs.
*/
struct heuristic {
char *prog;
char *type;
};
struct vfstab_list {
char *special;
char *mountp;
};
static int initialized = 0;
static int load_heuristics();
static int load_vfstab();
/*
* Use the heuristics to check for a filesystem on the slice.
*/
int
{
int found = 0;
*errp = 0;
return (0);
}
/*
* We get the list of heuristic programs one time.
*/
(void) mutex_lock(&init_lock);
if (!initialized) {
*errp = load_heuristics();
if (*errp == 0) {
initialized = 1;
}
}
(void) mutex_unlock(&init_lock);
/* Run each of the heuristics. */
found = 1;
}
}
if (*errp != 0)
return (found);
/*
* Second heuristic used is the check for an entry in vfstab
*/
(void) mutex_lock(&vfstab_lock);
*errp = load_vfstab();
}
if (*errp == 0) {
found = 1;
}
}
}
(void) mutex_unlock(&vfstab_lock);
return (found);
}
static int
{
int loc;
case 0:
/* child process */
closefrom(1);
_exit(1);
break;
case -1:
return (0);
default:
/* parent process */
break;
}
return (1);
}
return (0);
}
/*
* Create a list of filesystem heuristic programs.
*/
static int
{
/* skip known dirs */
continue;
}
/*
* Skip checking for ZFS filesystems. We know that
* inuse_zpool() will have already been called, which does a
* better job of checking anyway. More importantly, an unused
* hot spare will still claim to have a ZFS filesystem because
* it doesn't do the same level of checks.
*/
continue;
continue;
}
return (ENOMEM);
}
return (ENOMEM);
}
return (ENOMEM);
}
}
break;
}
}
}
}
}
return (0);
}
static int
{
if (status != 0) {
return (status);
}
}
status = 0;
}
return (status);
}
static int
{
return (ENOMEM);
}
return (ENOMEM);
}
return (ENOMEM);
}
} else {
}
vfstab_listp = vfsp;
return (0);
}
static void
{
}
vfstab_listp = NULL;
}