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

📄 c-filesys7.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title>    Local File Systems   </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="GuideIX.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-filesys.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-filesys6.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-wfc.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="87252">4.7  &nbsp;&nbsp;The Target Server File System: TSFS</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="87254"> </a>The Target Server File System (TSFS) is a full-featured VxWorks file system, but the files operated on by using the file system are actually located on the host. TSFS uses a WDB driver to transfer requests from the I/O system to the target server. The target server reads the request and executes it using the host file system. Thus when you open a file with TSFS, the file being opened is actually on the host. Future <b class="routine"><i class="routine">read</i></b><b>(&nbsp;)</b> and <b class="routine"><i class="routine">write</i></b><b>(&nbsp;)</b> calls on the file descriptor obtained from the <b class="routine"><i class="routine">open</i></b><b>(&nbsp;)</b> call actually read from and write to the opened host file.</p><dd><p class="Body"><a name="87255"> </a>The TSFS VIO driver is oriented toward file I/O rather than toward console operations as is the Tornado 1.0 VIO driver. TSFS provides all the I/O features that <b class="library">netDrv</b> provides, without requiring any target resource beyond what is already configured to support communication between target and target server. It is possible to access host files randomly without copying the entire file to the target, to load an object module from a virtual file source, and to supply the file name to routines such as <b class="routine"><i class="routine">ld</i></b><b>(&nbsp;)</b>and <b class="routine"><i class="routine">copy</i></b><b>(&nbsp;)</b>. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="87256">How It Works</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="87257"> </a>Two steps are required to configure TSFS. First, TSFS must be included in your VxWorks image. This creates a new file system entry, <b class="file">/tgtsvr</b>. Then the target server must be configured for TSFS, which involves assigning a root directory on your host to TSFS. For example, you could set the TSFS root to <b class="file">c:\windview\logs</b>.</p><dd><p class="Body"><a name="87264"> </a>Having done this, opening the file <b class="file">/tgtsvr/eventLog.wvr</b> from the target causes <b class="file">c:\windview\logs\eventLog.wvr </b>to be opened on the host by the target server. A new file descriptor representing that file is returned to the caller on the target. </p><dd><p class="Body"><a name="87265"> </a>Each I/O request, including <b class="routine"><i class="routine">open</i></b><b>(&nbsp;)</b>, is synchronous; the calling target task is blocked until the operation is complete. This provides flow control not available in the console VIO implementation. In addition, there is no need for WTX protocol requests to be issued to associate the VIO channel with a particular host file; the information is contained in the name of the file. </p><dd><p class="Body"><a name="87266"> </a>Consider a <b class="routine"><i class="routine">read</i></b><b>(&nbsp;)</b> call. The driver transmits the ID of the file (previously established by an <b class="routine"><i class="routine">open</i></b><b>(&nbsp;)</b><b class="routine"><i class="routine"> </i></b>call), the address of the buffer to receive the file data, and the desired length of the read to the target server. The target server responds by issuing the equivalent <b class="routine"><i class="routine">read</i></b><b>(&nbsp;)</b> call on the host and transfers the data read to the target program. The return value of <b class="routine"><i class="routine">read</i></b><b>(&nbsp;)</b><b class="routine"><i class="routine"> </i></b>and any <b class="command">errno</b> that might arise are also relayed to the target, so that the file appears to be local in every way. For detailed information on the supported routines and ioctl requests, see the online reference for <b class="library">wdbTsfsDrv</b> under <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">VxWorks Reference Manual&gt;Libraries</font></b>. </p></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="87270">Socket Support</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="87272"> </a>TSFS sockets are operated on in a similar way to other TSFS files, using <b class="routine"><i class="routine">open</i></b><b>(&nbsp;)</b>, <b class="routine"><i class="routine">close</i></b><b>(&nbsp;)</b>, <b class="routine"><i class="routine">read</i></b><b>(&nbsp;)</b>, <b class="routine"><i class="routine">write</i></b><b>(&nbsp;)</b>, and <b class="routine"><i class="routine">ioctl</i></b><b>(&nbsp;)</b>. To open a TSFS socket use one of the following forms of filename:</p><dl class="margin"><dd><pre class="Code2"><b><a name="87273">"TCP:<i class="textVariable">hostIP</i>:<i class="textVariable">port</i>" "TCP:<i class="textVariable">hostname</i>:<i class="textVariable">port</i>"</a></b></pre></dl><dd><p class="Body"><a name="87274"> </a>The <i class="textVariable">flags</i> and <i class="textVariable">permissions</i> arguments are ignored. The following examples show how to use these filenames:</p><dl class="margin"><dd><pre class="Code2"><b><a name="87275">fd = open("/tgtsvr/TCP:phobos:6164"0,0)&nbsp;&nbsp;&nbsp;&nbsp;/* open socket and connect&nbsp;&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* to server phobos&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/  fd = open("/tgtsvr/TCP:150.50.50.50:6164",0,0)&nbsp;&nbsp;/* open socket and &nbsp;&nbsp;&nbsp;&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*connect to server &nbsp;&nbsp;&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 150.50.50.50&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</a></b></pre></dl><dd><p class="Body"><a name="87276"> </a>The result of this <b class="routine"><i class="routine">open</i></b><b>(&nbsp;)</b> call is to open a TCP socket on the host and connect it to the target server socket at <i class="textVariable">hostname</i> or <i class="textVariable">hostIP</i> awaiting connections on <i class="textVariable">port</i>. The resultant socket is non-blocking. Use <b class="routine"><i class="routine">read</i></b><b>(&nbsp;)</b> and <b class="routine"><i class="routine">write</i></b><b>(&nbsp;)</b> to read and write to the TSFS socket. Because the socket is non-blocking, the <b class="routine"><i class="routine">read</i></b><b>(&nbsp;)</b> call returns immediately with an error and the appropriate <b class="symbol_lc">errno</b> if there is no data available to read from the socket. Ioctls specific to TSFS sockets are discussed in the online reference for <b class="library">wdbTsfsDrv</b> under <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">VxWorks Reference Manual&gt;Libraries</font></b>. This socket configuration allows WindView to use the socket facility without requiring <b class="library">sockLib</b> and the networking modules on the target. </p></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="87280">Error Handling</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="87282"> </a>Errors can arise at various points within TSFS and are reported back to the original caller on the target, along with an appropriate error code. The error code returned is the VxWorks <b class="symbol_lc">errno</b> which most closely matches the error experienced on the host. If a WDB error is encountered, a WDB error message is returned rather than a VxWorks <b class="symbol_lc">errno</b>.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="87284">Security Considerations</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="87286"> </a>While TSFS has much in common with <b class="library">netDrv</b>, the security considerations are different. With TSFS, the host file operations are done on behalf of the user that launched the target server. The user name given to the target as a boot parameter has no effect. In fact, none of the boot parameters have any effect on the access privileges of TSFS. </p><dd><p class="Body"><a name="87287"> </a>In this environment, it is less clear to the user what the privilege restrictions to TSFS actually are, since the user ID and host machine that start the target server may vary from invocation to invocation. In any case, any Tornado tool that connects to a target server which is supporting TSFS has access to any file with the same authorizations as the user that started that target server. For this reason, the target server is locked by default when TSFS is started.</p><dd><p class="Body"><a name="87288"> </a>The options which have been added to the target server startup routine to control target access to host files using TSFS include: </p></dl><dl class="margin"><dd><div class="Item"><a name="87290"> </a><b class="command">-R</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="87291"> </a>set the root of TSFS </div><br><dd><div class="Indent2"><a name="87292"> </a>For example, specifying <b class="command">-R /tftpboot</b> prepends this string to all TSFS file names received by the target server, so that <b class="file">/tgtsvr/etc/passwd</b> maps to <b class="file">/tftpboot/etc/passwd</b>. If <b class="operator">-R</b> is not specified, TSFS is not activated and no TSFS requests from the target will succeed. Restarting the target server without specifying <b class="operator">-R </b>disables TSFS.</div><br></dl></dl><dd><div class="Item"><a name="87294"> </a><b class="command">-RW</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="87295"> </a>make TSFS read-write </div><br><dd><div class="Indent2"><a name="87296"> </a>The target server interprets this option to mean that modifying operations (including file create and delete or write) are authorized. If <b class="command">-RW</b> is not specified, the default is read only and no file modification are allowed.</div><br></dl></dl></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top">

⌨️ 快捷键说明

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