📄 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.htm"><i>VxWorks API Reference : OS 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><a href="./netDrv.html#netDrv">netDrv</a>( )</b> - install the network remote file driver<br><b><a href="./netDrv.html#netDevCreate">netDevCreate</a>( )</b> - create a remote file device<br><b><a href="./netDrv.html#netDevCreate2">netDevCreate2</a>( )</b> - create a remote file device with fixed buffer size<br><b><a href="./netDrv.html#netDrvDebugLevelSet">netDrvDebugLevelSet</a>( )</b> - set the debug level of the <b><a href="./netDrv.html#top">netDrv</a></b> library routines<br><b><a href="./netDrv.html#netDrvFileDoesNotExistInstall">netDrvFileDoesNotExistInstall</a>( )</b> - install an applette to test if the file exists<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><a href="./netDrv.html#netDevCreate">netDevCreate</a>( )</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><a href="./ioLib.html#ioctl">ioctl</a>( )</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 by<b><a href="./nfsDrv.html#top">nfsDrv</a></b>.<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><a href="./netDrv.html#netDrv">netDrv</a>( )</b> toinitialize the driver and <b><a href="./netDrv.html#netDevCreate">netDevCreate</a>( )</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><a href="./netDrv.html#netDrv">netDrv</a>( )</b>. This routine should be called only once, before any reads,writes, <b><a href="./netDrv.html#netDevCreate">netDevCreate</a>( )</b>, or <b><a href="./netDrv.html#netDevCreate2">netDevCreate2</a>( )</b> calls. Initialization isperformed automatically when <b>INCLUDE_NET_DRV</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><a href="./netDrv.html#netDevCreate">netDevCreate</a>( )</b> or <b><a href="./netDrv.html#netDevCreate2">netDevCreate2</a>( )</b>. The arguments to <b><a href="./netDrv.html#netDevCreate">netDevCreate</a>( )</b>are the name of the device, the name of the host the device will access,and the remote file access protocol to be used -- RSH or FTP.The arguments to <b><a href="./netDrv.html#netDevCreate2">netDevCreate2</a>( )</b> are ones described above and a size ofbuffer used in the network device as a fourth argument.By convention, a network device name is the remote machine name followedby a colon ":". For example, for a UNIX host on the network "wrs", filescan be accessed by creating a device called "wrs:". For more information,see the manual entry for <b><a href="./netDrv.html#netDevCreate">netDevCreate</a>( )</b> and <b><a href="./netDrv.html#netDevCreate2">netDevCreate2</a>( )</b>.<p></blockquote><h4>IOCTL FUNCTIONS</h4><blockquote><p>The network driver responds to the following <b><a href="./ioLib.html#ioctl">ioctl</a>( )</b> functions:<dl><dt><b>FIOGETNAME</b><dd>Gets the file name of the file descriptor <i>fd</i> and copies it to the bufferspecified 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><a href="./dirLib.html#stat">stat</a>( )</b> or <b><a href="./dirLib.html#fstat">fstat</a>( )</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: <b>st_dev</b>,<b>st_mode</b>, and <b>st_size</b>. <b>st_mode</b> 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>The <b><a href="./netDrv.html#top">netDrv</a></b> implementation strategy implies that directories cannotalways be distinguished from plain files. Thus, <b><a href="./dirLib.html#opendir">opendir</a>( )</b> does notwork for directories mounted on <b><a href="./netDrv.html#top">netDrv</a></b> devices, and <b><a href="./usrFsLib.html#ll">ll</a>( )</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 to<b>stat</b> 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="./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><a href="./hostLib.html#hostAdd">hostAdd</a>( )</b><p><hr><a name="netDrv"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>netDrv( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>netDrv( )</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 <b>INCLUDE_NET_DRV</b> is defined.<p></blockquote><h4>VXWORKS AE PROTECTION DOMAINS</h4><blockquote><p>Under VxWorks AE, you can call this function from within the kernel protection domain only. This restriction does not apply under non-AE versions of VxWorks. <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.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>netDevCreate( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>netDevCreate( )</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><a href="./hostLib.html#hostAdd">hostAdd</a>( )</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><a href="./hostLib.html#hostAdd">hostAdd</a>( )</b><hr><a name="netDevCreate2"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>netDevCreate2( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>netDevCreate2( )</strong> - create a remote file device with fixed buffer size</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS netDevCreate2 ( 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 */ UINT bufSize /* size of buffer in NET_FD */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine creates a remote file device, just like <b><a href="./netDrv.html#netDevCreate">netDevCreate</a>( )</b>, but it allowsvery large files to be accessed without loading the entire file to memory.The fourth parameter <i>bufSize</i> specifies the amount of memory. If the <i>bufSize</i> is zero, then the behavior is exactly the same as <b><a href="./netDrv.html#netDevCreate">netDevCreate</a>( )</b>. If <i>bufSize</i>is not zero, the following restrictions apply:<p><table></tr><tr valign=top><td>- <b>O_RDONLY</b>, <b>O_WRONLY</b> open modes are supported, but not <b>O_RDWR</b> open mode.<td></tr><tr valign=top><td>- seek is supported in <b>O_RDONLY</b> open mode, but not in <b>O_WRONLY</b> open mode.<td></tr><tr valign=top><td>- backward seek will be slow if it is beyond the buffer.<td></table></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><a href="./netDrv.html#netDevCreate">netDevCreate</a>( )</b><hr><a name="netDrvDebugLevelSet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>netDrvDebugLevelSet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>netDrvDebugLevelSet( )</strong> - set the debug level of the <b><a href="./netDrv.html#top">netDrv</a></b> library routines</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS netDrvDebugLevelSet ( UINT32 debugLevel /* NETDRV_DEBUG_OFF, NETDRV_DEBUG_ERRORS, */ /* NETDRV_DEBUG_ALL */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine enables the debugging of calls to the net driver. The argument<b>NETLIB_DEBUG_ERRORS</b> will display only error messages to the console. The argument <b>NETLIB_DEBUG_ALL</b> will display warnings and errors to the console.<p></blockquote><h4>RETURNS </h4><blockquote><p>OK, or ERROR if the debug level is invalid</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netDrv.html#top">netDrv</a></b><hr><a name="netDrvFileDoesNotExistInstall"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>netDrvFileDoesNotExistInstall( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>netDrvFileDoesNotExistInstall( )</strong> - install an applette to test if the file exists</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS netDrvFileDoesNotExistInstall ( FUNCPTR pAppletteRtn /* Function that returns TRUE or FALSE */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>Install a function which will test if a given file exists.<p>The <i>pAppletteRtn</i> argument provides a routine using the following interface:<pre>STATUS appletteRoutine ( char *filename, /* file name queried */ char *response /* server response string */ )</pre>The <b><a href="./netDrv.html#top">netDrv</a></b> routine calls the applette routine during an open with <b>O_CREAT</b>specified. The system will perform an NLST command and then use the applette routine to parse the response. The routine compensates for server responseimplementaion variations. The applette should return <b>OK</b> if the file is not found and <b>ERROR</b> if the file is found.<p></blockquote><h4>RETURNS </h4><blockquote><p>OK, installation successful; ERROR, installation error.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netDrv.html#top">netDrv</a></b>, <b><a href="./ioLib.html#open">open</a>( )</b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -