/*
* 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
*/
/*
*/
/*
* preenlib interface for SVM.
*
* On startup fsck attempts to check filesystems in parallel. However
* running mutiple fscks on the same disk at the same time
* significantly degrades the performance. fsck code avoids such
* behavior. To analyse such patterns it needs the physical disk
* instance. preen_build_devs provides that information for
* filesystems that are on top of metadevices.
*/
#include <ctype.h>
#include <meta.h>
#include <limits.h>
#include <zone.h>
#include <sdssc.h>
/*
* Macros to produce a quoted string containing the value of a
* preprocessor macro. For example, if SIZE is defined to be 256,
* VAL2STR(SIZE) is "256". This is used to construct format
* strings for scanf-family functions below.
*/
#define QUOTE(x) #x
static int is_blank(char *);
/*
* is_blank() returns 1 (true) if a line specified is composed of
* whitespace characters only. otherwise, it returns 0 (false).
*
* Note. the argument (line) must be null-terminated.
*/
static int
{
return (0);
return (1);
}
static int
{
int entry;
int found = 0;
int status = 0;
return (-1);
}
/* cut off comments starting with '#' */
*cp = '\0';
/* ignore comment or blank lines */
continue;
/* sanity-check */
status = -1;
}
found = 1;
break;
}
}
/*
* if no match is found return -1
*/
if (found == 0)
status = -1;
return (status);
}
/*
* This routine is called from preenlib the first time. It is then
* recursively called through preen_subdev.
*
* The argument passed in (uname) starts with the special device from
* names.
*/
void
char *uname, /* name of metadevice */
void *dp /* magic info */
)
{
mdnamelist_t *p;
char *tmpstr;
/*
* The rest of the code in this library can't work within a
* non-global zone so we just return the top level metadevice back
* to be fscked.
*/
if (getzoneid() != GLOBAL_ZONEID) {
return;
}
return;
return;
/*
* If the path passed in is not a metadevice, then add that
* device to the list (preen_addunit) since it has to be a
* physical device.
*/
return;
}
/*
* Bind to the cluster library
*/
if (sdssc_bind_library() == SDSSC_ERROR)
return;
ep_valid = 1;
goto out;
}
/*
* parse the path name to get the diskset name.
*/
ep_valid = 1;
goto out;
}
/* check for ownership */
/*
* Don't own the set but we are here implies
* that this is a clustered proxy device. Simply add
* the unit.
*/
ep_valid = 1;
goto out;
}
/*
* get list of underlying physical devices.
*/
ep_valid = 1;
goto out;
}
goto out;
}
ep_valid = 1;
goto out;
}
ep_valid = 1;
goto out;
}
/* gather and add the underlying devs */
int fd;
char *devname;
/*
* we don't want to use the rname anymore because
* that may have changed. Use the device id information
* to find the correct ctd name and open based on that.
* If there isn't a devid or we have a did device, then
* use the rname. In clustering, it's corrected for us.
* If no devid it's at least worth a try.
*/
if (md_did)
} else {
/*
* SunCluster did devices may be found
* in the replica with minor names of
* the form 14,14s1,blk. NULL out the
* rightmost ',' in this case so that we
* end up with a usable mname.
*/
*tmpstr = '\0';
}
} else {
}
/*
* We need to make sure we call this with a specific
* mname (raw mname) so that we get the exact slice
* with the given device id. Otherwise we could try
* to open a slice that doesn't really exist.
*/
ep_valid = 1;
goto out;
}
}
/* get device name and (real) cinfo */
ep_valid = 1;
/*
* We need to scan all sub devices even if some fail
* since exit here would end up in not finishing fsck
* on all devices and prevent us from going into
* multiuser mode.
*/
continue;
}
ep_valid = 1;
/* Continue here too. See comment from before */
continue;
}
/*
* preen_subdev fails when the device name has been
* resolved to the physical layer. Hence it is added
* to preen_addunit.
*/
}
}
/* cleanup, if we fail, just add this composite device to the list */
out:
if (ep_valid != 0) {
mdclrerror(&status);
}
}