vttest.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 (c) 1994 by Sun Microsystems, Inc.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Program to test the operation of the Volume Test Driver
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <stropts.h>
#include <poll.h>
#include <errno.h>
#include <values.h>
#include "voltestdrv.h"
#define VTBASENAME "/dev/vt/"
#define VOLBASE "/vol"
#define RDSK "rdsk"
static char *prog_name;
extern int errno;
static int verbose = 0;
#define DEF_NMINORS 1
struct vt_data {
void *vd_label;
char *vd_name;
};
void
{
extern char *optarg;
static void usage(void);
static void read_test_vt(struct vt_data *);
static void write_test_vt(struct vt_data *);
int c;
int nminors = DEF_NMINORS;
int readtest = 0;
int writetest = 0;
int nchildren = 0;
int err;
int fd;
int unit;
char namebuf[80];
/* process arguments */
switch (c) {
case 'b':
break;
case 'n':
break;
case 'r':
readtest++;
break;
case 'w':
writetest++;
break;
case 'v':
verbose++;
break;
default:
usage();
exit(-1);
}
}
exit(-1);
}
vtdata =
perror("malloc");
exit(-1);
}
/* build up the mapping in the vt driver */
perror("malloc");
exit(-1);
}
/*
* This is a bit of an ugly hack here... I make sure
* that name is always a multiple of sizeof (int) so
* that the checking below is easier.
*/
perror("malloc");
exit(-1);
}
/*
* another ugly hack. I happen to know that volume
* management is going to call a device with a label
* that right here.
*/
perror("malloc");
exit(-1);
}
if (err) {
} else {
exit(-1);
}
}
}
/*
* now that we have the mapping, we figure out the "tag".
* We'll use the dev_t of the device in /vol just
* so we can track down problems easier.
*/
sleep(2);
continue;
}
exit(-1);
}
if (err == -1) {
exit(-1);
}
}
/* run all the tests */
if (readtest) {
}
if (err == -1) {
perror("fork");
break;
} else {
nchildren++;
}
}
if (writetest) {
}
if (err == -1) {
perror("fork");
break;
} else {
nchildren++;
}
}
}
}
static void
usage()
{
}
#define TBUFSIZ 1024
static void
{
int fd;
int i, n;
int len;
sleep(2);
continue;
}
exit(-1);
}
for (;;) {
if (n < 0) {
exit(-1);
}
if (n / sizeof (int) != TBUFSIZ) {
}
"label not right, wanted %s, got %s\n",
exit(-1);
}
i = len / sizeof (int);
} else {
i = 0;
}
for (; i < TBUFSIZ; i++) {
"read error on %s wanted 0x%x got 0x%x\n",
}
}
bytecnt += n;
if (bytecnt >= bytes_to_xfer) {
if (verbose) {
}
exit(0);
}
}
}
static void
{
int fd;
int i, n;
sleep(2);
continue;
}
exit(-1);
}
for (i = 0; i < TBUFSIZ; i++)
for (;;) {
if (n < 0) {
exit(-1);
}
if (n / sizeof (int) != TBUFSIZ) {
}
bytecnt += n;
if (bytecnt >= bytes_to_xfer) {
if (verbose) {
}
exit(0);
}
}
}
#define POLLTIMEOUT 100
#define MAXPOLLFD 5
static void
{
static void getstatus(int);
int npollfd = 0;
int i, n;
int pid;
int status;
npollfd++;
#ifdef notdef
#endif
while (1) {
for (i = 0; n && i < npollfd; i++) {
}
}
--nchildren;
#ifdef notdef
#endif
if (nchildren == 0) {
break;
}
}
}
}
static void
{
static void process_status(struct vt_status *);
extern int errno;
while (1) {
if (errno != EWOULDBLOCK) {
perror("ioctl");
}
return;
}
}
}
static void
{
case VSE_WRTERR:
printf("write error on unit %d, expected 0x%x, got 0x%x\n",
break;
}
}