dm_request.c revision d1d2228c6cf3ec632d28262810ab7902932a5d33
/*
* 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 <thread.h>
#include <ctype.h>
#include <synch.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stropts.h>
#include <errno.h>
#include <string.h>
#include <syslog.h>
#include <fcntl.h>
#include <pthread.h>
#include <mms_list.h>
#include <dmd_impl.h>
#include <dm_impl.h>
#include <dm_msg.h>
#include <mms_trace.h>
#include <mms_dmd.h>
#include <dm_proto.h>
#include <mms_strapp.h>
void
dm_get_request(void)
{
/*
* Get request from driver
*/
/*
* No request, process error
*/
return;
}
}
void
dm_proc_request(void)
{
int rc = 0;
char dbuf[4096];
dm_msg_destroy(); /* cleanup any left over msg */
}
sizeof (dbuf));
/*
* Save I/O counts
*/
/*
* If not an open or close request and not in user data,
* then allow only status requests.
*/
"file not positioned correctly"));
goto done;
}
}
}
switch (req->drm_req_type) {
case DRM_REQ_MTIOCTOP:
"Got request DRM_REQ_MTIOCTOP"));
break;
case DRM_REQ_MTIOCLTOP:
"Got request DRM_REQ_MTIOCLTOP"));
break;
case DRM_REQ_OPEN:
"Got open request DRM_REQ_OPEN"));
break;
case DRM_REQ_CLOSE:
"Got close request DRM_REQ_CLOSE"));
break;
case DRM_REQ_READ:
"Got read request DRM_REQ_READ"));
break;
case DRM_REQ_READ_TM:
"Got read FM request DRM_REQ_READ_TM"));
break;
case DRM_REQ_READ_ERR:
"Got read ERR request DRM_REQ_READ_ERR"));
break;
case DRM_REQ_WRITE:
"Got write request DRM_REQ_WRITE"));
break;
case DRM_REQ_WRITE0:
"Got write0 request DRM_REQ_WRITE0"));
break;
case DRM_REQ_WRITE_ERR:
"Got write err request DRM_REQ_WRITE_ERR"));
break;
case DRM_REQ_MTGET:
"Got request DRM_REQ_MTGET"));
break;
case DRM_REQ_CLRERR:
"Got request DRM_REQ_CLRERR"));
break;
case DRM_REQ_BLK_LIMIT:
"Got request MMS_REQ_BLK_LIMIT"));
break;
}
break;
case DRM_REQ_GET_POS:
"Got request MMS_REQ_GET_POS"));
break;
case DRM_REQ_MTGETPOS:
"Got request MMS_REQ_GET_POS"));
break;
case DRM_REQ_MTRESTPOS:
"Got request MMS_REQ_GET_POS"));
break;
case DRM_REQ_LOCATE:
"Got request MMS_REQ_LOCATE"));
break;
case DRM_REQ_GET_CAPACITY:
"Got request MMS_REQ_GET_CAPACITY"));
break;
case DRM_REQ_UPT_CAPACITY:
"Got request MMS_REQ_UPT_CAPACITY"));
rc = dm_ioctl_upt_capacity();
break;
case DRM_REQ_SET_DENSITY:
"Got request MMS_REQ_SET_DENSITY"));
rc = dm_ioctl_set_density();
break;
case DRM_REQ_GET_DENSITY:
"Got request MMS_REQ_GET_DENSITY"));
break;
default:
break;
}
done:
dm_msg_destroy(); /* clean up left over msg */
/*
* If at EOF and don't have a valid EOF position, then get it.
*/
(void) dm_get_eof_pos();
}
"At EOF"));
}
"Fatal error occured"));
}
"Catch next read"));
} else {
"Catch next write"));
}
"Notify read in effect"));
}
"Notify write in effect"));
}
}
if (rep.drm_rep_rc == 0) {
/* Opened successfully */
}
}
}
int
{
int rc = 0;
case MTREW:
case MTRETEN:
rc = dm_ioctl_rewind();
break;
case MTSEEK:
break;
case MTTELL:
if (rc) {
}
break;
case MTFSF:
break;
case MTFSR:
break;
case MTBSF:
break;
case MTBSR:
break;
case MTWEOF:
break;
case MTEOM:
rc = dm_goto_eof();
break;
case MTSRSZ:
/*
* You're allowed to set any record size any time.
*/
break;
case MTGRSZ:
break;
}
if (rc) {
}
break;
default:
break;
}
return (rc);
}
int
{
int newfile = 0;
int rc = 0;
char *user;
/*
* Must be attached to open
*/
/* Not attached */
"Drive not attached"));
goto fatal;
}
"Target ID mismatch, requested %lld, have %d",
goto fatal;
}
/* Return EBUSY if already opened */
if (wka->dm_app_pid) {
goto fatal;
}
/*
* Save application's pid and user name
*/
goto fatal;
}
/*
* Check user authentication
*/
if (dm_chk_dev_auth(user) != 0) {
"User %s is not authorized to use MMS",
user));
goto fatal;
}
/* Cartridge is not loaded */
"Cartridge %s, Volume %s not loaded",
goto fatal;
}
/*
* Check MMS mode
*/
/* In raw mode */
if (rc < 0) {
goto fatal;
}
if (DRV_CALL(drv_bind_raw_dev,
DM_MSG_PREPEND(("Cannot set raw mode: %s: ",
goto fatal;
}
/* The entire tape is user data in non MMS mode */
/*
* Set the bit format
*/
if (dm_update_bitformat()) {
DM_MSG_PREPEND(("update bit format error: "));
goto fatal;
}
return (0);
}
/*
* MMS mode
*/
/*
* Save open flags
*/
/*
*/
}
"on mount command overrides readonly option"));
}
}
}
/*
* Set disposition of file
*/
}
}
/*
* Save current tape position before validation. We may have to
* return to this position if the rest of open fails.
*/
DM_MSG_PREPEND(("unable to get current position: "));
goto fatal;
}
/*
* Determine if a new file should be created
*/
} else {
}
if (rc != 0) {
goto fatal;
}
if (newfile &&
/* Readonly is for old only */
"cannot write to readonly"));
goto fatal;
}
/*
* Set record format
*/
} else {
}
if (newfile) {
/* Turn off append */
/*
* Check expiration date.
*/
if (dm_validate_xdate() != 0) {
DM_MSG_PREPEND(("Existing file not expired: "));
/* Existing file not expired */
goto fatal;
}
}
if (dm_set_label_blksize() != 0) {
DM_MSG_PREPEND(("Set label blksize error: "));
goto fatal;
}
/*
* If mounted tape is NL, then decide whether to
* write new label to AL.
*/
/* Don't write new label */
goto fatal;
}
}
/*
* If creating the first file, rewind
* to BOM and set density and create
* VOL1 again
*/
if (DRV_CALL(drv_rewind, ())) {
goto fatal;
}
mnt_density->sym_code)) != 0) {
goto fatal;
}
}
if (dm_create_vol1() != 0) {
goto fatal;
}
} else {
/* fseq != 1 */
goto fatal;
}
}
/* Create file, write hdr label */
if (dm_create_hdr1() != 0) {
goto fatal;
}
if (dm_create_hdr2() != 0) {
goto fatal;
}
goto fatal;
}
if (dm_get_bof_pos() != 0) {
goto fatal;
}
}
/*
* File must be validated by now
*/
"Unable to validate filename"));
goto fatal;
}
/*
* Validated and not in user data, then
* position file to BOF
*/
DM_MSG_PREPEND(("spacing to user data error: "));
goto fatal;
}
if (dm_get_bof_pos() != 0) {
DM_MSG_PREPEND(("cannot get bof position: "));
goto fatal;
}
}
/*
* Must be in user data now
*/
"Unable to reach user data in file"));
goto fatal;
}
/*
* Must have BOF position
*/
"Unable to get BOF position"));
goto fatal;
}
/*
* Get EOF position from MM
*/
if (newfile) {
/* ignore send error */
(void) dm_send_eof_pos();
if (dm_show_eof_pos() != 0) {
}
}
/*
* Position in the file
*/
if (newfile == 0) {
if (dm_open_pos() != 0) {
/* Error */
DM_MSG_PREPEND(("unable to reposition file: "));
goto fatal;
}
}
/*
* Now that the file is positioned correctly, reset the disposition
* so that open flags will be used.
*/
/*
* Switch to user's file
*/
if (DRV_CALL(drv_bind_raw_dev,
wka->dm_app_pid = 0;
goto fatal;
}
/*
* Set up file blksize, density and compression
*/
if (dm_set_file_blksize(-1) != 0) {
/*
* Rebind to target base
*/
DM_MSG_PREPEND(("set file blocksize error: "));
if (DRV_CALL(drv_rebind_target, ()) != 0) {
"Rebind base device error: %s",
}
goto fatal;
}
/*
* Set the bit format
*/
if (dm_update_bitformat() != 0) {
DM_MSG_PREPEND(("unable to update bit format: "));
goto fatal;
}
if (rc == 0) {
/* Successfully positioned, turn off append */
}
return (rc);
wka->dm_app_pid = 0;
(void) dm_set_label_blksize();
return (rc);
}
int
dm_open_labeled(int *newfile)
{
/*
* Position to the file seq
*/
if (dm_pos_fseq() != 0) {
return (EIO);
}
/*
* We must be at the file requested by the user
*/
"Unable to reach requested file"));
return (EIO);
}
/*
* Determine if a new file will be created
*/
*newfile = 0;
/*
* Create a new file
*/
*newfile = 1;
if (DRV_CALL(drv_rewind, ()) != 0 ||
DRV_LOGICAL_CROSS_TM)) != 0) {
DM_MSG_PREPEND(("unable to "
"position cartridge: "));
return (EIO);
}
} else {
if (dm_rewind_file() != 0 ||
DM_MSG_PREPEND(("unable to "
"position cartridge: "));
return (EIO);
}
}
}
if (dm_validate_fname() != 0) {
return (ENOENT);
}
}
} else {
/*
* Writing over an existing file
*/
/* Not in user data and validate filename */
if (dm_validate_fname() != 0) {
return (EACCES);
}
}
}
}
/*
* Set up blocksize
*/
} else {
}
return (0);
}
int
dm_open_nonlabeled(int *newfile)
{
/*
* Mounted cartridge is NL
* If mount option is AL, then create label if not done already
*/
/* Can only create fseq 1 */
return (ENOENT);
}
/*
* Must create a new file
*/
*newfile = 1;
/*
* Set up blocksize
*/
}
return (0);
}
int
dm_validate_xdate(void)
{
int curdate;
int xdate;
int tmp;
int i;
char lxdate[7];
/* nonlabeled */
return (0);
}
/* No expiration date used */
return (0);
}
/*
* If date is invalid, then ignore
*/
goto invalid_xdate;
}
for (i = 0; i < 5; i++) {
goto invalid_xdate;
}
}
goto invalid_xdate;
}
/* Don't validate expiration date */
return (0);
}
/*
* Get expiration date since 1900
*/
if (lxdate[0] == '0') {
/* years since 1900 */
xdate += 100000;
}
/*
* Get current date since 1900
*/
/* file not expired */
"Existing file not expired: "
"expiration date = %s", lxdate));
return (-1);
} else {
/* File expired */
return (0);
}
return (0);
}
/*
* Currently, only one file is supported on each volume, so fseq can only be 1.
*/
int
dm_pos_fseq(void)
{
/* Tape not positioned */
if (DRV_CALL(drv_rewind, ()) != 0) {
return (EIO);
}
return (EIO);
}
}
}
/* Already positioned to file */
return (0);
}
/*
* We don't support fseq > 1 for the time being
*/
return (EINVAL);
}
return (0);
}
int
dm_get_bof_pos(void)
{
"Not at BOF. Can't get BOF position"));
return (EACCES);
}
return (EIO);
}
return (0);
}
int
dm_get_eof_pos(void)
{
"not at EOF. cannot get EOF position"));
return (EACCES);
}
return (EIO);
}
return (0);
}
int
dm_open_pos(void)
{
/*
* Must be in uset data to do positioning at open
*/
"Not in user data. Can't do open position"));
return (EACCES);
}
/*
* Must have BOF position
*/
"Don't have BOF position. " "Can't do open position"));
return (EACCES);
}
return (EIO);
}
/* Go to eof */
return (dm_goto_eof());
}
return (0);
}
int
dm_goto_eof(void)
{
int rc;
return (EIO);
}
/*
* Must be in user data to go to EOF
*/
"Not in user data. Can't go to EOF"));
return (EACCES);
}
return (EIO);
}
/*
* If eof position is valid, then locate to it
*/
if (dm_set_label_blksize()) {
return (EIO);
}
goto repos;
}
/*
* If this is really EOF, then the next block must be a
* tapemark followed by the trailor label.
*/
/* Could not space 1 block */
/* We're at EOF if we hit EOM or blank check */
goto done;
}
/*
* Hit a tapemark, read the next block to see if it is a
* trailor label.
*/
/*
* We're at EOF if we hit EOM or
* blank check
*/
goto done;
} else {
/* other error */
goto repos;
}
}
/*
* Read an 80 byte record
*/
if (dm_verify_trailor_label(buf) == 0) {
if (DRV_CALL(drv_locate,
(&drv->drv_eof_pos)) != 0) {
/*
* Can't reposition
* to EOF
*/
goto repos;
}
goto done;
}
} else {
/* All errors, do it the hard way */
goto repos;
}
} else {
/* Skipped a block, this is not EOF for sure */
goto repos;
}
/*
* Don't find trailor label.
* Return to where we started and try to locate EOF
* the hard way.
*/
return (EIO);
}
buf[0] = '\0';
return (EIO);
}
}
/*
* Eof position is not valid, find eof the hard way
*/
if (dm_set_label_blksize()) {
return (EIO);
}
for (;;) {
/* We're at EOF if we hit EOM or blank check */
goto done;
}
goto err;
}
/*
* Try to read the next block to see if it is a trailor label.
* Skip over any tapemark we encounter
*/
/* We're at EOF if we hit EOM or blank check */
DRV_CALL(drv_clrerr, ());
goto done;
/* Hit a tapemark */
continue; /* Check for eof label */
} else if (rc > 0) {
/* Read a short block */
continue;
} else {
/* other error */
goto err;
}
}
if (rc != 80) {
/* Read a short block */
continue;
}
/*
* Read an 80 byte record
*/
if (dm_verify_trailor_label(buf) != 0) {
/* Invalid label structure */
goto err;
}
break;
}
}
/*
* We've read a trailor label. Position to the end of user data.
*/
goto err;
}
done:
"Set file blksize error"));
goto err;
}
if (dm_get_eof_pos()) {
goto err;
}
}
return (0);
err:
/*
* Error going to EOF, reposition to where we started and return error
*/
DRV_CALL(drv_clrerr, ());
"Set file blksize error"));
}
return (EIO);
}
int
dm_verify_trailor_label(char *buf)
{
/*
* EOF1 does not match HDR1
*/
"EOF1 label does not match HDR1 label"));
return (-1);
}
/*
* EOV1 does not match HDR1
*/
"EOV1 label does not match HDR1 label"));
return (-1);
}
}
return (0);
}
int
dm_chk_eof(void)
{
int rc;
return (EIO);
}
/* We're at EOF if we hit EOM or blank check */
if (dm_get_eof_pos()) {
} else {
rc = 0;
}
} else {
/* Other error */
DRV_CALL(drv_clrerr, ());
}
} else if (rc >= 80 &&
rc = 0;
}
return (rc);
}
int
dm_validate_fname(void)
{
int rc;
char tmp[18];
if (rc != 80 ||
"invalid header label structure, no HDR1"));
return (EINVAL);
}
}
/*
* Validate filename
*/
/* validate filename */
/* Mismatch filename */
"filename mismatch: "
} else {
/* File verified */
}
} else {
/* File verified */
}
/*
* HDR2 is optional
*/
/*
* HDR2 optional. If no HDR2, then there must be a tapemark.
*/
return (0);
}
if (rc != 80 ||
"invalid header label structure, "
"invalid HDR2"));
return (EIO);
}
} else {
}
/* Label created by MMS */
sizeof (hdr2->hdr2_blksize));
} else {
/* Label not created by MMS */
}
}
}
return (0);
}
int
dm_close(void)
{
/*
* In MMS mode, terminate the tape if necessary
*/
(void) dm_get_eof_pos();
}
/*
* Ignore error since there isn't anything
* we can do except get it recorded.
*/
(void) dm_terminate_file();
}
/* Rewind at close */
}
}
}
/*
* Rebind to target base
*/
if (DRV_CALL(drv_rebind_target, ()) != 0) {
}
dm_clear_dev();
}
}
wka->dm_app_pid = 0;
return (0);
}
/*
* Terminate a acrtridge by writing either two tapemarks or trailor labels
*/
int
dm_terminate_file(void)
{
int rc = 0;
int i;
/*
* At EOF now
*/
/*
* Must be in user data to terminate file
*/
return (EACCES);
}
/*
* Must have set DRV_TERM_FILE to terminate a file
*/
"DRV_TERM_FILE not set. Can't terminate file"));
}
/*
* Save EOF pos
*/
(void) dm_get_eof_pos();
/*
* Save capacity of cartridge
*/
return (EIO);
}
/* write 2 tapemarks to terminate a NL tape */
for (i = 0; i < 2; i++) {
DRV_CALL(drv_clrerr, ());
continue;
}
break;
}
if (i == 2) {
}
} else {
/*
*/
rc = dm_create_trailor_lbls();
}
/*
* Reposition to the end of user data
*/
if (rc != 0) {
DRV_CALL(drv_clrerr, ());
}
}
"Set file blksize error"));
}
if (rc == 0) {
/*
* Successfully wrote trailor labels and return to end of
* user data. We'er at EOF.
*/
}
return (rc);
}
int
dm_create_trailor_lbls(void)
{
int i;
for (i = 0; i < 2; i++) {
}
continue;
}
break;
}
if (i == 2) {
return (EIO);
}
if (dm_set_label_blksize() != 0) {
return (EIO);
}
for (i = 0; i < 2; i++) {
if (dm_create_eof1() != 0) {
continue;
}
break;
}
if (i == 2) {
return (EIO);
}
for (i = 0; i < 2; i++) {
if (dm_create_eof2() != 0) {
continue;
}
break;
}
if (i == 2) {
return (EIO);
}
for (i = 0; i < 2; i++) {
continue;
}
break;
}
if (i == 2) {
return (EIO);
}
return (0);
}
/*
* dm_read and dm_write are entered because we asked for it
*/
int
{
return (EIO);
}
/*
* The previous movement command was an output command.
* Let the driver fail this read.
*/
return (0);
}
/*
* Notify when switching to output
*/
return (0);
}
int
{
char buf[4096];
/*
* Hit a tapemark.
* Check to see if we reached EOF
*/
/*
* Alway cross TM to check trailor labels
*/
}
if (dm_set_label_blksize()) {
goto err;
}
goto err;
}
goto err;
}
}
} else if (dm_chk_eof() == 0) {
goto err;
}
(void) dm_get_eof_pos();
}
/* Not at EOF */
}
}
"Set file blksize error"));
goto err;
}
err:
"Set file blksize error"));
}
return (EIO);
}
int
{
DRV_CALL(drv_proc_error, ());
/* set DriveBroken to "yes" */
(void) dm_send_drive_broken();
/* Set CartridgeMediaError to "yes" */
(void) dm_send_cartridge_media_error();
}
}
int
{
return (EIO);
}
/*
* Readonly, can't write to it
*/
return (EACCES);
}
/*
* DRV_UPDATE_EOF_POS is only set when valid eof flag is updated
*/
(void) dm_send_eof_pos();
}
/*
* Notify when switching to input
*/
}
return (0);
}
int
{
/*
* Notify when switching to input
*/
}
int
{
DRV_CALL(drv_proc_error, ());
/* set DriveBroken to "yes" */
(void) dm_send_drive_broken();
/* Set CartridgeMediaError to "yes" */
(void) dm_send_cartridge_media_error();
}
}
int
dm_create_vol1(void)
{
char *vp;
char *buf;
} else {
}
"%-6.6s", vp);
"Unable to write VOL1 label"));
return (EIO);
}
return (0);
}
int
dm_create_hdr1(void)
{
char *buf;
char *tmp;
/*
* Get creation date
*/
} else {
}
/*
* Get expiration date
*/
if (drv->drv_retention == 0) {
/* Don't use expiration date */
/* Never expires */
} else {
/* expire time */
} else {
}
}
return (EIO);
}
return (0);
}
int
dm_create_hdr2(void)
{
char *buf;
} else {
}
/*
* Put file blksize in label
*/
} else {
}
return (EIO);
}
return (0);
}
int
dm_create_eof1(void)
{
char *buf;
sizeof (eof1->eof1_cdate));
sizeof (eof1->eof1_xdate));
return (EIO);
}
return (0);
}
int
dm_create_eof2(void)
{
char *buf;
} else {
}
} else {
}
return (EIO);
}
return (0);
}
int
dm_rewind_file(void)
{
/*
* Must be in user data to rewind
*/
return (EACCES);
}
/*
* Must have valid BOF position
*/
"Don't have BOF position. Can't rewind file"));
return (EACCES);
}
/* Already at BOF */
return (0);
}
return (EIO);
}
/* Hit a TM */
/* Did not hit BOM. Must be an error */
return (EIO);
}
} else {
/* Not at BOF */
return (EIO);
}
return (0);
}
int
{
int rc = 0;
return (rc);
}
int
{
/* If tape moved since last signal, get new status */
}
}
return (0);
}
int
dm_ioctl_rewind(void)
{
int rc = 0;
return (EIO);
}
if (dm_terminate_file() != 0) {
}
}
rc = dm_rewind_file();
return (rc);
}
int
dm_ioctl_fsf(int count)
{
int rc = 0;
char buf[80];
int bytes;
int i;
return (EIO);
}
if (dm_set_label_blksize()) {
return (EIO);
}
for (i = 0; i < count; i++) {
break;
}
/*
* Try to read the next block to see if it is a trailor label.
*/
/* Read trailor label */
/* Reposition to EOF */
(void) dm_get_eof_pos();
break;
}
}
if (bytes > 0) {
/*
* Read something other than a label
*/
if (i == (count - 1)) {
/*
* Spaced requested TM
*/
(1, DRV_LOGICAL_CROSS_TM));
}
break;
/* Read another tapemark */
if (i == (count - 1)) {
/*
* Spaced requested TM
*/
break;
} else {
i++; /* skipped another TM */
}
continue; /* try to read label again */
} else if (rc < 0) {
/* Hit EOM or blank check */
if (dm_get_eof_pos()) {
goto done;
}
break;
} else {
/* Other error */
goto done;
}
} else {
/*
* Some unknown error
*/
break;
}
}
/*
* Done if we are at EOF
*/
break;
}
}
done:
"Set file blksize error"));
}
return (rc);
}
int
dm_ioctl_fsb(int count)
{
int rc = 0;
return (EIO);
}
if (dm_set_label_blksize()) {
return (EIO);
}
/*
* Hit a tapemark.
* Check to see if we reached EOF
*/
/* passed EOF position */
}
} else if (dm_chk_eof() == 0) {
/* Not at EOF, check if at EOF */
}
/*
* If at EOF, and don't have EOF position, get it
*/
(void) dm_get_eof_pos();
}
} else {
/*
* If not at EOF, must have hit a TM
*/
/*
*/
/* Not MMS TM, then do not cross TM */
(1, ~DRV_LOGICAL_CROSS_TM));
}
}
}
}
"Set file blksize error"));
}
return (rc);
}
int
dm_ioctl_bsf(int count)
{
int rc = 0;
int i;
return (EIO);
}
if (dm_terminate_file() != 0) {
}
}
for (i = 0; i < count; i++) {
break;
}
}
}
return (rc);
}
int
dm_ioctl_bsb(int count)
{
int cross;
int resid = 0;
int flags;
int rc = 0;
int err = 0;
return (EIO);
}
if (dm_terminate_file() != 0) {
return (EIO);
}
}
} else {
}
/* Hit a tapemark */
/* Failed to reposition */
} else {
}
}
}
}
return (rc);
}
int
dm_ioctl_seek(int count)
{
int rc = 0;
return (EIO);
}
if (dm_terminate_file() != 0) {
return (EIO);
}
}
if (rc) {
}
return (rc);
}
int
dm_ioctl_wtm(int count)
{
int rc = 0;
int resid = 0;
return (EIO);
}
/*
* Readonly, can't write to it
*/
if (count > 0) {
return (EACCES);
}
}
if (count > 0) {
/* Terminate file if writing TM to tape */
}
}
/* Wrote some TM */
}
return (rc);
}
int
{
int rc;
if (rc) {
return (rc);
}
} else {
}
return (0);
}
int
{
return (EIO);
}
return (EIO);
}
return (0);
}
int
{
return (EIO);
}
return (EIO);
}
return (0);
}
int
{
return (EIO);
}
return (EIO);
}
return (0);
}
int
{
int rc = 0;
return (EIO);
}
blkno));
return (EINVAL);
}
if (dm_terminate_file() != 0) {
}
}
}
return (rc);
}
int
{
int rc = 0;
}
return (rc);
}
int
dm_ioctl_upt_capacity(void)
{
int rc = 0;
if (dm_update_capacity() != 0) {
}
return (rc);
}
int
dm_ioctl_set_density(void)
{
int rc = 0;
return (EIO);
}
if (DRV_CALL(drv_set_density,
}
}
return (rc);
}
int
{
int rc = 0;
int den;
} else {
}
return (rc);
}
void
dm_clear_dev(void)
{
int i;
/*
* Get rid of all attentions
*/
for (i = 0; i < 10; i++) {
}
}
int
dm_set_label_blksize(void)
{
if (DRV_CALL(drv_set_blksize, (0)) != 0) {
return (EIO);
}
if (DRV_CALL(drv_set_compression, (0)) != 0) {
return (EIO);
}
return (0);
}
int
{
int rc;
int comp;
int bz;
return (EIO);
}
/*
* If blksize == -1, determine the blocksize.
* If blksize >= 0, use blksize
*/
if (blksize == -1) {
if (drv->drv_file_blksize <= 0) {
}
} else {
bz = 0;
}
} else {
}
/*
* Set tape compression
*/
return (EIO);
comp));
return (EIO);
} else {
}
}