📄 netdrv.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/netDrv.html - generated by refgen from netDrv.c --> <title> netDrv </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual : Libraries</i></a></p></blockquote><h1>netDrv</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>netDrv</strong> - network remote file I/O driver </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./netDrv.html#netDrv">netDrv</a></i>( )</b> - install the network remote file driver<br><b><i><a href="./netDrv.html#netDevCreate">netDevCreate</a></i>( )</b> - create a remote file device<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This driver provides facilities for accessing files transparently over thenetwork via FTP or RSH. By creating a network device with <b><i><a href="./netDrv.html#netDevCreate">netDevCreate</a></i>( )</b>,files on a remote UNIX machine may be accessed as if they were local.<p>When a remote file is opened, the entire file is copied over the networkto a local buffer. When a remote file is created, an empty local bufferis opened. Any reads, writes, or <b><i><a href="./ioLib.html#ioctl">ioctl</a></i>( )</b> calls are performed on the localcopy of the file. If the file was opened with the flags <b>O_WRONLY</b> or <b>O_RDWR</b>and modified, the local copy is sent back over the network to the UNIXmachine when the file is closed.<p>Note that this copying of the entire file back and forth can make <b><a href="./netDrv.html#top">netDrv</a></b>devices awkward to use. A preferable mechanism is NFS as provided bynfsDrv.<p></blockquote><h4>USER-CALLABLE ROUTINES</h4><blockquote><p>Most of the routines in this driver are accessible only through the I/Osystem. However, two routines must be called directly: <b><i><a href="./netDrv.html#netDrv">netDrv</a></i>( )</b> toinitialize the driver and <b><i><a href="./netDrv.html#netDevCreate">netDevCreate</a></i>( )</b> to create devices.<p></blockquote><h4>FILE OPERATIONS</h4><blockquote><p>This driver supports the creation, deletion, opening, reading,writing, and appending of files. The renaming of files is notsupported.<p></blockquote><h4>INITIALIZATION</h4><blockquote><p>Before using the driver, it must be initialized by calling the routine<b><i><a href="./netDrv.html#netDrv">netDrv</a></i>( )</b>. This routine should be called only once, before any reads,writes, or <b><i><a href="./netDrv.html#netDevCreate">netDevCreate</a></i>( )</b> calls. Initialization is performedautomatically when the configuration macro <b>INCLUDE_NETWORK</b> is defined.<p></blockquote><h4>CREATING NETWORK DEVICES</h4><blockquote><p>To access files on a remote host, a network device must be created bycalling <b><i><a href="./netDrv.html#netDevCreate">netDevCreate</a></i>( )</b>. The arguments to <b><i><a href="./netDrv.html#netDevCreate">netDevCreate</a></i>( )</b> are the name ofthe device, the name of the host the device will access, and the remotefile access protocol to be used -- RSH or FTP. By convention, a networkdevice name is the remote machine name followed by a colon ":". Forexample, for a UNIX host on the network "wrs", files can be accessed bycreating a device called "wrs:". For more information, see the manual entry for <b><i><a href="./netDrv.html#netDevCreate">netDevCreate</a></i>( )</b>.<p></blockquote><h4>IOCTL FUNCTIONS</h4><blockquote><p>The network driver responds to the following <b><i><a href="./ioLib.html#ioctl">ioctl</a></i>( )</b> functions:<dl><dt><b>FIOGETNAME</b><dd>Gets the file name of the file descriptor <i>fd</i> and copies it to the buffer specified by <i>nameBuf</i>:<pre> status = ioctl (fd, FIOGETNAME, &nameBuf);</pre><dt><b>FIONREAD</b><dd>Copies to <i>nBytesUnread</i> the number of bytes remaining in the filespecified by <i>fd</i>:<pre> status = ioctl (fd, FIONREAD, &nBytesUnread);</pre><dt><b>FIOSEEK</b><dd>Sets the current byte offset in the file to the position specified by<i>newOffset</i>. If the seek goes beyond the end-of-file, the file grows.The end-of-file pointer changes to the new position, and the new space isfilled with zeroes:<pre> status = ioctl (fd, FIOSEEK, newOffset);</pre><dt><b>FIOWHERE</b><dd>Returns the current byte position in the file.This is the byte offset of the next byte to be read or written.It takes no additional argument:<pre> position = ioctl (fd, FIOWHERE, 0);</pre><dt><b>FIOFSTATGET</b><dd>Gets file status information. The argument <i>statStruct</i> is a pointerto a stat structure that is filled with data describing the specifiedfile. Normally, the <b><i><a href="./dirLib.html#stat">stat</a></i>( )</b> or <b><i><a href="./dirLib.html#fstat">fstat</a></i>( )</b> routine is used to obtain fileinformation, rather than using the FIOFSTATGET function directly.<b><a href="./netDrv.html#top">netDrv</a></b> only fills in three fields of the stat structure: st_dev,st_mode, and st_size. st_mode is always filled with <b>S_IFREG</b>.<pre> struct stat statStruct; fd = open ("file", O_RDONLY); status = ioctl (fd, FIOFSTATGET, &statStruct);</pre> </dl></blockquote><h4>LIMITATIONS</h4><blockquote><p><p>The <b><a href="./netDrv.html#top">netDrv</a></b> implementation strategy implies that directories cannotalways be distinguished from plain files. Thus, <b><i><a href="./dirLib.html#opendir">opendir</a></i>( )</b> does notwork for directories mounted on <b><a href="./netDrv.html#top">netDrv</a></b> devices, and <b><i><a href="./usrLib.html#ll">ll</a></i>( )</b> does not flagsubdirectories with the label "DIR" in listings from <b><a href="./netDrv.html#top">netDrv</a></b> devices.<p>When the access method is FTP, operations can only be done on files thatthe FTP server allows to download. In particular it is not possible tostat a directory, doing so will result in "<i>dirname</i>: not a plain file"error.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>netDrv.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netDrv.html#top">netDrv</a></b>, <b><a href="./remLib.html#top">remLib</a></b>, <b><a href="./netLib.html#top">netLib</a></b>, <b><a href="./sockLib.html#top">sockLib</a></b>, <b><i><a href="./hostLib.html#hostAdd">hostAdd</a></i>( )</b>, <i>VxWorks Programmer's Guide: Network</i><hr><a name="netDrv"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>netDrv</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>netDrv</i>( )</strong> - install the network remote file driver</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS netDrv (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initializes and installs the network driver.It must be called before other network remote file functions are performed.It is called automatically when the configuration macro <b>INCLUDE_NETWORK</b>is defined.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netDrv.html#top">netDrv</a></b><hr><a name="netDevCreate"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>netDevCreate</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>netDevCreate</i>( )</strong> - create a remote file device</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS netDevCreate ( char * devName, /* name of device to create */ char * host, /* host this device will talk to */ int protocol /* remote file access protocol 0 = RSH, 1 = FTP */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine creates a remote file device. Normally, a network device iscreated for each remote machine whose files are to be accessed. Byconvention, a network device name is the remote machine name followed by acolon ":". For example, for a UNIX host on the network whose name is"wrs", files can be accessed by creating a device called "wrs:". Filescan be accessed via RSH as follows:<p><pre> netDevCreate ("wrs:", "wrs", rsh);</pre>The file /usr/dog on the UNIX system "wrs" can now be accessed as"wrs:/usr/dog" via RSH.<p>Before creating a device, the host must have already been created with<b><i><a href="./hostLib.html#hostAdd">hostAdd</a></i>( )</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netDrv.html#top">netDrv</a></b>, <b><i><a href="./hostLib.html#hostAdd">hostAdd</a></i>( )</b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -