⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1097-1098.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Linux Complete Command Reference:Special Files:EarthWeb Inc.-</TITLE>

</HEAD>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311046 //-->

<!-- TITLE=Linux Complete Command Reference//-->

<!-- AUTHOR=Red Hat//-->

<!-- PUBLISHER=Macmillan Computer Publishing//-->

<!-- IMPRINT=Sams//-->

<!-- CHAPTER=04 //-->

<!-- PAGES=1063-1102 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->



<P><CENTER>

<a href="1094-1096.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="1099-1101.html">Next</A></CENTER></P>







<A NAME="PAGENUM-1097"><P>Page 1097</P></A>





<H3><A NAME="ch04_ 16">

ioctls

</A></H3>



<P>The driver supports three ioctl requests. Requests not recognized by the

st driver are passed to the scsi driver. The definitions below are from

/usr/include/linux/mtio.h:

</P>



<P><B>

MTIOCTOP: Perform a tape operation

</B></P>



<P>This request takes an argument of type (struct mtop

*). Not all drives support all operations. The driver returns an

EIO error if the drive rejects an operation.

</P>



<!-- CODE //-->

<PRE>

/* Structure for MTIOCTOP _ mag tape op command: */

struct mtop {

short mt_op; /* operations defined below */

int mt_count; /* how many of them */

};

</PRE>

<!-- END CODE //-->



<P>Magnetic tape operations:

</P>



<TABLE>



<TR><TD>

MTBSF

</TD><TD>

Backward space over mt_count filemarks.

</TD></TR><TR><TD>

MTBSFM

</TD><TD>

Backward space over mt_count filemarks. Reposition the tape to the

EOT side of the last filemark.

</TD></TR><TR><TD>

MTBSR

</TD><TD>

Backward space over mt_count records (tape blocks).

</TD></TR><TR><TD>

MTBSS

</TD><TD>

Backward space over mt_count setmarks.

</TD></TR><TR><TD>

MTEOM

</TD><TD>

Go to the end of the recorded media (for appending files).

</TD></TR><TR><TD>

MTERASE

</TD><TD>

Erase tape.

</TD></TR><TR><TD>

MTFSF

</TD><TD>

Forward space over mt_count filemarks.

</TD></TR><TR><TD>

MTFSFM

</TD><TD>

Forward space over mt_count filemarks. Reposition the tape to the

BOT side of the last filemark.

</TD></TR><TR><TD>

MTFSR

</TD><TD>

Forward space over mt_count records (tape blocks).

</TD></TR><TR><TD>

MTFSS

</TD><TD>

Forward space over mt_count setmarks.

</TD></TR><TR><TD>

MTNOP

</TD><TD>

No op; flushes the driver's buffer as a side effect. Should be used

before reading status with MTIOCGET.

</TD></TR><TR><TD>

MTOFFL

</TD><TD>

Rewind and put the drive off line.

</TD></TR><TR><TD>

MTRESET

</TD><TD>

Reset drive.

</TD></TR><TR><TD>

MTRETEN

</TD><TD>

Retention tape.

</TD></TR><TR><TD>

MTREW

</TD><TD>

Rewind.

</TD></TR><TR><TD>

MTSEEK

</TD><TD>

Seek to the tape block number specified in

mt_count. This operation requires either a SCSI-2 drive that supports the

LOCATE command (device-specific address) or a Tandberg-compatible SCSI-1 drive

(Tandberg, Archive Viper, Wangtek,&#133;). The block number should be one that

was previously returned by MTIOCPOS because the number is device-specific.

</TD></TR><TR><TD>

MTSETBLK

</TD><TD>

Set the drive's block length to the value specified in

mt_count. A block length of zero sets the drive to variable block size mode.

</TD></TR><TR><TD>

MTSETDENSITY

</TD><TD>

Set the tape density to the code in

mt_count. Some useful density 

codes are

</TD></TR><TR><TD>

</TD><TD>

<!-- CODE //-->

<PRE>

18 0x00 Implicit 0x11 QIC-525

0x04 QIC-11 0x12 QIC-1350

0x05 QIC-24 0x13 DDS

0x0F QIC-120 0x14 Exabyte EXB-8200

0x10 QIC-150 0x15 Exabyte EXB-8500

</PRE>

<!-- END CODE //-->

</TD></TR><TR><TD>

MTWEOF

</TD><TD>

Write mt_count filemarks.

</TD></TR><TR><TD>

MTWSM

</TD><TD>

Write mt_count setmarks.

</TD></TR></TABLE>



<A NAME="PAGENUM-1098"><P>Page 1098</P></A>



<TABLE>



<TR><TD>

MTSETDRVBUFFER

</TD><TD>

Set various drive and driver options according to bits encoded

in mt_count. These consist of the drive's buffering mode, six Boolean

driver options, and the buffer write threshold. These parameters are

initialized only when the device is first detected. The settings persist when the

device is closed and reopened. A single operation can affect just the

buffering mode, just the Boolean options, or just the write threshold.

</TD></TR><TR><TD>

</TD><TD>

A value having zeros in the high-order 4 bits will be used to set the

drive's buffering mode. The buffering modes are:

</TD></TR><TR><TD>

</TD><TD>

<!-- CODE //-->

<PRE>

0     The drive will not report GOOD status on write commands

      until the data blocks are actually written to the medium.

1     The drive may report GOOD status on write commands as

      soon as all the data has been transferred to the drive's

      internal buffer.

2     The drive may report GOOD status on write commands as

      soon as all the data has been transferred to the drive's internal

      buffer and all buffered data from different initiators has

      been successfully written to the medium.

</PRE>

<!-- END CODE //-->

</TD></TR><TR><TD>

</TD><TD>

To control the write threshold, the value in

mt_count must include the constant

MT_ST_WRITE_THRESHOLD logically ORed with a block count in

the low 28 bits. The block count refers to 1024-byte blocks, not the

physical block size on the tape. The threshold cannot exceed the driver's

internal buffer size (see the description).

</TD></TR><TR><TD>

</TD><TD>

To set and clear the Boolean options, the value in

mt_count must include the constant MT_ST_BOOLEANS logically ORed with whatever

combination of the following options is desired. Any options not specified are set

false. The Boolean options are

</TD></TR><TR><TD>

MT_ST_BUFFER_WRITES

</TD><TD>

(Default: true) Buffer all write operations. If this option is false and

the drive uses a fixed block size, then all write operations must be for

a multiple of the block size. This option must be set false to write

reliable multi-volume archives.

</TD></TR><TR><TD>

MT_ST_ASYNC_WRITES

</TD><TD>

(Default: true) When this options is true, write operations

return immediately without waiting for the data to be transferred to the drive

if the data fits into the driver's buffer. The write threshold determines

how full the buffer must be before a new SCSI write command is issued.

Any errors reported by the drive will be held until the next operation.

This option must be set false to write reliable multi-volume archives.

</TD></TR><TR><TD>

MT_ST_READ_AHEAD

</TD><TD>

(Default: true) This option causes the driver to provide read

buffering and read-ahead. If this option is false and the drive uses a fixed block

size, then all read operations must be for a multiple of the block size.

</TD></TR><TR><TD>

MT_ST_TWO_FM

</TD><TD>

(Default: false) This option modifies the driver behavior when a file

is closed. The normal action is to write a single filemark. If the option

is true, the driver will write two filemarks and backspace over the <BR>

second one.

</TD></TR><TR><TD>

</TD><TD>

Note that this option should not be set true for QIC tape drives

because they are unable to overwrite a filemark. These drives detect the end

of recorded data by testing for blank tape rather than two

consecutive filemarks.

</TD></TR><TR><TD>

MT_ST_DEBUGGING

</TD><TD>

(Default: false) This option turns on various debugging messages

from the driver (effective only if the driver was compiled with

DEBUG defined).

</TD></TR><TR><TD>

MT_ST_FAST_EOM

</TD><TD>

(Default: false) This option causes the

MTEOM operation to be sent directly to the drive, potentially speeding up the operation but causing the

driver

</TD></TR></TABLE>







<P><CENTER>

<a href="1094-1096.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="1099-1101.html">Next</A></CENTER></P>







</td>
</tr>
</table>

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -