/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Two output fields under the -i option will always be
* output as zero, since they are not supported by Sun:
* Software version, and
* Drive id number.
* AT&T filled these 2 fields with data from their "pdsector",
* which Sun doesn't support per se.
*/
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/efi_partition.h>
#include <errno.h>
/*
* Standard I/O file descriptors.
*/
static void usage(void);
int
{
char *device;
iflg = 0;
pflg = 0;
errflg = 0;
switch (c) {
case 'i':
iflg++;
break;
case 'p':
pflg++;
break;
case '?':
errflg++;
break;
default:
errflg++;
break;
}
if (errflg)
usage();
}
usage();
}
if (iflg) {
"This operation is not supported on EFI labeled devices");
} else {
"Unable to read Disk geometry");
}
}
}
if (pflg)
return (0);
}
static void
{
int i;
int slice;
if (i < 0)
(void) printf("%s\t%0lx\t%0lx\t%llu\t%llu\t%x\t%x\n",
} else if ((slice == VT_ENOTSUP) &&
(void) printf("%s\t%lx\t%lx\t%lld\t%lld\t%hx\t%hx\n",
} else {
}
}
static void
{
int i;
/*
* unsigned int version = 0;
* unsigned int driveid = 0;
*/
nopartitions = 0;
sectorcyl = 0;
bytes = 0;
/*
* these are not supported by Sun.
*
* driveid = osect0->newsect0.pdinfo.driveid;
* version = osect0->newsect0.pdinfo.version;
*/
for (i = 0; i < V_NUMPAR; i++) {
nopartitions++;
}
/*
* (void) printf("%s %0x %0x %d %d %d\n",
* device, version, driveid, sectorcyl, bytes, nopartitions);
*/
(void) printf("%s %0x %0x %d %d %d\n",
}
/*
* readvtoc()
*
* Read a partition map.
*/
static int
{
int retval;
switch (retval) {
case (VT_ERROR):
case (VT_EIO):
case (VT_EINVAL):
}
return (retval);
}
/*
* warn()
*
* Print an error message. Always returns -1.
*/
static int
{
return (-1);
}
static void
usage(void)
{
" devinfo -i device \n");
exit(2);
}