/*
* 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
*/
/*
*/
#include <fcntl.h>
#include <libdevinfo.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <unistd.h>
#include <devid.h>
#include <dirent.h>
#include <sys/efi_partition.h>
#include "libdiskmgt.h"
#include "disks_private.h"
#include "partition.h"
inuse_fs, /* fs should always be last */
};
descriptor_t **
int *errp)
{
return (NULL);
}
switch (type) {
case DM_MEDIA:
case DM_PARTITION:
}
return (NULL);
}
/*
* For media, just get the slices, but for a partition, it must be a solaris
* partition and if there are active partitions, it must be the active one.
*/
descriptor_t **
{
/* Just check the first drive name. */
*errp = 0;
return (libdiskmgt_empty_desc_array(errp));
}
}
nvlist_t *
{
int fd;
return (NULL);
}
return (NULL);
}
}
if (fd >= 0) {
}
return (attrs);
}
/*
* Look for the slice by the slice devpath.
*/
{
int locked;
if (*errp != 0)
break;
mname[0] = 0;
break;
}
}
return (des);
}
/* ARGSUSED */
descriptor_t **
{
}
char *
{
}
nvlist_t *
{
char *str;
if (stat_type != DM_SLICE_STAT_USE) {
return (NULL);
}
*errp = 0;
return (NULL);
}
return (NULL);
}
/* if no cluster use, check for a use of the local name */
int fd;
}
if (fd >= 0) {
}
if (snum >= 0) {
sizeof (localpath));
return (NULL);
}
break;
}
}
}
}
}
return (stats);
}
/*
* A slice descriptor points to a disk, the name is the devpath and the
* secondary name is the media name.
*/
int
{
int error = 0;
int locked;
dp = cache_get_disklist();
}
return (error);
}
/* convert rdsk paths to dsk paths */
void
{
char *strp;
/* not rdsk, check for floppy */
}
strp++; /* move ptr to the r in rdsk or rdiskette */
/* move the succeeding chars over by one */
do {
strp++;
} while (*strp);
}
}
/*
*/
static int
{
int i;
int error;
if (error != 0) {
return (error);
}
break;
}
}
return (0);
}
/* return 1 if the slice descriptor is still valid, 0 if not. */
static int
{
/* First verify the media name for removable media */
return (0);
}
if (mname[0] == 0) {
} else {
}
}
/*
* We could verify the slice is still there, but other code down the
* line already does these checks (e.g. see get_attrs).
*/
return (1);
}
/* convert dsk paths to rdsk paths */
static void
{
char *slashp;
/* make sure there is enough room to add the r to dsk */
return;
}
/* not dsk, check for floppy */
}
char *endp;
/* move the succeeding chars over by one */
do {
endp--;
}
}
static int
{
int status;
int error;
int cooked_fd;
int mntpnt = 0;
if (fd < 0) {
return (ENODEV);
}
/* First make sure media is inserted and spun up. */
return (ENODEV);
}
return (ENOMEM);
}
}
if (data_format == FMT_UNKNOWN) {
return (ENODEV);
}
}
/* check the slice */
if (data_format == FMT_VTOC) {
return (ENODEV);
}
} else { /* data_format == FMT_EFI */
return (ENODEV);
}
}
/* the slice exists */
if (data_format == FMT_EFI) {
}
return (ENOMEM);
}
if (data_format == FMT_VTOC) {
return (ENOMEM);
}
!= 0) {
return (ENOMEM);
}
!= 0) {
return (ENOMEM);
}
!= 0) {
return (ENOMEM);
}
} else { /* data_format == FMT_EFI */
return (ENOMEM);
}
return (ENOMEM);
}
return (ENOMEM);
}
return (ENOMEM);
}
return (ENOMEM);
}
}
sizeof (struct uuid))) {
return (ENOMEM);
}
}
if (data_format == FMT_EFI) {
}
if (error != 0) {
return (error);
}
mntpnt = 1;
}
/*
* Some extra attrs for cluster slices.
*
* get localname and possible mnt point for localpath
*/
localpath[0] = 0;
/* determine the slice number for this path */
int sfd;
&dkinfo) >= 0) {
}
}
}
sizeof (localpath));
localpath) != 0) {
return (ENOMEM);
}
if (mntpnt == 0) {
&error)) {
if (error != 0) {
return (error);
}
}
}
break;
}
}
}
return (ENOMEM);
}
}
/*
* We need to open the cooked slice (not the raw one) to get the
* correct devid. Also see if we need to read the localpath for the
* cluster disk, since the minor name is unavailable for the did pseudo
* device.
*/
if (localpath[0] != 0) {
} else {
}
if (cooked_fd >= 0) {
int no_mem = 0;
char *minor;
char *devidstr;
!= 0) {
if (nvlist_add_string(attrs,
DM_DEVICEID, devidstr) != 0) {
no_mem = 1;
}
}
}
}
if (no_mem) {
return (ENOMEM);
}
}
return (0);
}
static descriptor_t **
{
int fd;
int status;
int cnt;
int pos;
return (NULL);
}
} else {
*errp = 0;
return (libdiskmgt_empty_desc_array(errp));
}
/* count the number of slices */
/* allocate the array for the descriptors */
if (data_format == FMT_EFI) {
}
return (NULL);
}
/* get the media name from the descriptor */
} else {
/* must be a DM_PARTITION */
}
pos = 0;
int slice_num;
/* can't get slicenum, so no need to keep trying the drive */
if (slice_num == -1) {
break;
}
if (data_format == FMT_VTOC) {
continue;
}
} else { /* data_format == FMT_EFI */
continue;
}
}
media_name, errp);
if (*errp != 0) {
if (data_format == FMT_EFI) {
}
return (NULL);
}
pos++;
}
if (data_format == FMT_EFI) {
}
*errp = 0;
return (slices);
}
static int
{
/* check if we already determined the devpath slice number */
int fd;
}
}
}
}
static int
{
int error = 0;
/* Just check the first drive name. */
return (0);
}
mname[0] = 0;
int slice_num;
/* can't get slicenum, so no need to keep trying the drive */
if (slice_num == -1) {
break;
}
if (data_format == FMT_UNKNOWN) {
int fd;
int status;
} else if (status == VT_ENOTSUP &&
}
}
}
/* can't get slice data, so no need to keep trying the drive */
if (data_format == FMT_UNKNOWN) {
break;
}
if (data_format == FMT_VTOC) {
continue;
}
} else { /* data_format == FMT_EFI */
continue;
}
}
if (error != 0) {
break;
}
}
if (data_format == FMT_EFI) {
}
return (error);
}
/*
* Just look for the name on the devpaths we have cached. Return 1 if we
* find the name and the size of that slice is non-zero.
*/
static int
{
int slice_num;
int fd;
int status;
/* found it */
break;
}
}
break;
}
}
*errp = 0;
return (0);
}
/*
* If we found a match on the name we now have to check that this
* slice really exists (non-0 size).
*/
/* can't get slicenum, so no slice */
if (slice_num == -1) {
return (1);
}
return (1);
}
} else {
return (1);
}
if (data_format == FMT_VTOC) {
*errp = 0;
return (1);
}
} else { /* data_format == FMT_EFI */
*errp = 0;
return (1);
}
}
return (1);
}