/*
* Copyright (c) 2002 Maxim Sobolev
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
__FBSDID("$FreeBSD$");
#include "stand.h"
struct split_file
{
};
static int splitfs_close(struct open_file *f);
"split",
};
static void
{
int i;
}
}
}
static int
{
int i;
for (i = 0;; i++) {
break;
return (errno);
if (i == NTRIES)
return (EIO);
printf("\nInsert disk labelled %s and press any key...",
getchar();
putchar('\n');
}
return (0);
}
static int
{
int conffd;
/* Have to be in "just read it" mode */
return(EPERM);
/* If the name already ends in `.split', ignore it */
return(ENOENT);
/* Construct new name */
/* Try to open the configuration file */
if (conffd == -1)
return(ENOENT);
printf("splitfs_open: stat failed\n");
return(ENOENT);
}
printf("splitfs_open: not a file\n");
return(EISDIR); /* best guess */
}
/* Allocate a split_file structure, populate it from the config file */
cp++;
if (*cp != '\0') {
*cp = '\0';
cp++;
}
cp++;
if (*cp == '\0')
}
return(ENOENT);
}
if (errno != 0) {
return(ENOENT);
}
/* Looks OK, we'll take it */
return (0);
}
static int
{
int fd;
}
static int
{
totread = 0;
do {
/* Error? */
if (nread == -1)
return (errno);
break;
/* Close previous slice */
return (errno);
if (errno)
return (errno);
}
return (0);
}
static off_t
{
int nread;
switch (where) {
case SEEK_SET:
break;
case SEEK_CUR:
break;
case SEEK_END:
panic("splitfs_seek: SEEK_END not supported");
break;
default:
return (-1);
}
if (seek_by > 0) {
/*
* Seek forward - implemented using splitfs_read(), because otherwise we'll be
* unable to detect that we have crossed slice boundary and hence
* unable to do a long seek crossing that boundary.
*/
void *tmp;
return (-1);
}
nread = 0;
resid = 0;
/* Error or EOF */
break;
}
if (errno != 0)
return (-1);
}
if (seek_by != 0) {
/* Seek backward or seek past the boundary of the last slice */
panic("splitfs_seek: can't seek past the beginning of the slice");
if (new_pos < 0) {
return (-1);
}
}
}
static int
{
int result;
/* stat as normal, but indicate that size is unknown */
return (result);
}