filedisk.c revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
/*
* 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.
*/
#include <sys/sysmacros.h>
#include <sys/pathname.h>
#include <sys/byteorder.h>
#include <stmf.h>
#include <lpif.h>
#include <stmf_sbd.h>
#include <stmf_sbd_ioctl.h>
#include <sbd_impl.h>
typedef struct sbd_filedisk {
char sfd_filename[1];
/*
* sfd_flags
*/
#define SFD_OPENED 0x0001
{
int ret;
return (STMF_FAILURE);
}
return (STMF_SUCCESS);
}
}
return (STMF_FAILURE);
}
return (STMF_SUCCESS);
}
{
int ret;
return (STMF_FAILURE);
}
return (STMF_FAILURE);
do {
break;
}
return (STMF_SUCCESS);
}
{
int rval;
if (rval != 0) {
stmf_trace(0, "filedisk_data_flush: VOP_FSYNC failed");
return (STMF_FAILURE);
}
return (STMF_SUCCESS);
}
/*
* Registers a logical unit. Optionally creates it as well.
*/
{
long nbits;
if (error) {
return (SBD_FILEIO_FAILURE | error);
}
return (SBD_FAILURE);
}
/* Check if this file is already registered */
return (STMF_ALREADY);
}
}
if (error) {
return (SBD_FILEIO_FAILURE | error);
}
if (error) {
goto closeout;
}
/*
* Its a zero byte block or char device. This cannot be
* a raw disk.
*/
ret = SBD_FAILURE;
goto closeout;
}
NULL) != 0) {
nbits = 0;
}
/*
* The expression below is correct only if nbits is
* positive and less than 64.
*/
if (file_size > supported_size) {
rlc->return_code =
ret = SBD_FAILURE;
goto closeout;
}
}
} else {
(file_size - META_DATA_SIZE):0;
}
ret = SBD_FAILURE;
goto closeout;
}
ret = SBD_FAILURE;
goto closeout;
}
}
/*
* If we are only registering LU, then we should use the size
* get from the meta data as the lun_size, but for now, we have to
* temporarily set it to the file size to avoid read failure when
* reading meta data
*/
/*
* avoid read failure with old style LU
*/
goto closeout;
}
}
if (ret == STMF_ALREADY) {
rlc->return_code =
} else if (ret == STMF_INVALID_ARG) {
} else {
}
goto closeout;
}
/*
* The expression below is correct only if nbits is
* positive and less than 64.
*/
(void) sbd_deregister_sst(sst);
rlc->return_code =
ret = SBD_FAILURE;
goto closeout;
}
}
} else {
goto closeout;
}
return (STMF_SUCCESS);
closeout:;
return (ret);
}
{
int lun_registered = 1;
long nbits;
return (SBD_FAILURE);
}
return (SBD_FAILURE);
}
if (sst) {
} else {
/*
* This LUN is not registered, we don't check the file type here
* because meta data should have been created for this file,
* or else, sbd_modify_meta will fail when read the meta data.
*/
lun_registered = 0;
if (error) {
return (SBD_FILEIO_FAILURE | error);
}
if (error) {
goto closeout;
}
sst = sbd_sst_alloc(
/* set this, or else read meta data will fail */
}
if (file_size > supported_size) {
mlc->return_code =
ret = SBD_FAILURE;
goto closeout;
}
}
if (ret != STMF_SUCCESS) {
/* if fail, just restore the old size */
if (ret == STMF_INVALID_ARG) {
}
}
if (lun_registered == 0) {
if (sst)
}
return (ret);
}
void
{
return;
return;
}
/*
* Ideally file should be opened when the lu is onlined but the metadata
* access is needed even if lu is not yet onlined. Until we implement better
* metadata handling routines i.e. allow metadata access even if lu is not
* online, we will open the file during lu register itself.
*/
/* ARGSUSED */
{
#if 0
if (error) {
return (SBD_FILEIO_FAILURE | error);
}
if (error) {
return (SBD_FILEIO_FAILURE | error);
}
#endif
return (STMF_SUCCESS);
}
/* ARGSUSED */
{
#if 0
int flag;
#endif
return (STMF_SUCCESS);
}
{
return (ret);
}
return (STMF_SUCCESS);
}