Newer
Older
UbixOS / doc / html / ubixfs_8c-source.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>UbixOS V2: src/sys/ubixfs/ubixfs.c Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
  <ul>
    <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="dirs.html"><span>Directories</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
  </ul></div>
<div class="tabs">
  <ul>
    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
    <li><a href="globals.html"><span>Globals</span></a></li>
  </ul></div>
<div class="nav">
<a class="el" href="dir_897b6a2d7bab147dd1db58381aad3984.html">src</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_832905b1f7f5feaf61a306b40c0ac817.html">sys</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_74196872fc832845f1a07f1162e5c554.html">ubixfs</a></div>
<h1>ubixfs.c</h1><a href="ubixfs_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*****************************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment"> Copyright (c) 2002-2004 The UbixOS Project</span>
<a name="l00003"></a>00003 <span class="comment"> All rights reserved.</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment"> Redistribution and use in source and binary forms, with or without modification, are</span>
<a name="l00006"></a>00006 <span class="comment"> permitted provided that the following conditions are met:</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment"> Redistributions of source code must retain the above copyright notice, this list of</span>
<a name="l00009"></a>00009 <span class="comment"> conditions, the following disclaimer and the list of authors.  Redistributions in binary</span>
<a name="l00010"></a>00010 <span class="comment"> form must reproduce the above copyright notice, this list of conditions, the following</span>
<a name="l00011"></a>00011 <span class="comment"> disclaimer and the list of authors in the documentation and/or other materials provided</span>
<a name="l00012"></a>00012 <span class="comment"> with the distribution. Neither the name of the UbixOS Project nor the names of its</span>
<a name="l00013"></a>00013 <span class="comment"> contributors may be used to endorse or promote products derived from this software</span>
<a name="l00014"></a>00014 <span class="comment"> without specific prior written permission.</span>
<a name="l00015"></a>00015 <span class="comment"></span>
<a name="l00016"></a>00016 <span class="comment"> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY</span>
<a name="l00017"></a>00017 <span class="comment"> EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF</span>
<a name="l00018"></a>00018 <span class="comment"> MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL</span>
<a name="l00019"></a>00019 <span class="comment"> THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
<a name="l00020"></a>00020 <span class="comment"> SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT</span>
<a name="l00021"></a>00021 <span class="comment"> OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span>
<a name="l00022"></a>00022 <span class="comment"> HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR</span>
<a name="l00023"></a>00023 <span class="comment"> TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span>
<a name="l00024"></a>00024 <span class="comment"> SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00025"></a>00025 <span class="comment"></span>
<a name="l00026"></a>00026 <span class="comment"> $Id: ubixfs_8c-source.html 88 2016-01-12 00:11:29Z reddawg $</span>
<a name="l00027"></a>00027 <span class="comment"></span>
<a name="l00028"></a>00028 <span class="comment">*****************************************************************************************/</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;<a class="code" href="ubixfs_8h.html">ubixfs/ubixfs.h</a>&gt;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;<a class="code" href="dirCache_8h.html">ubixfs/dirCache.h</a>&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;<a class="code" href="vfs_8h.html">vfs/vfs.h</a>&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;<a class="code" href="types_8h.html">ubixos/types.h</a>&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;<a class="code" href="sched_8h.html">ubixos/sched.h</a>&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;<a class="code" href="kpanic_8h.html">ubixos/kpanic.h</a>&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;<a class="code" href="exec_8h.html">ubixos/exec.h</a>&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;<a class="code" href="kmalloc_8h.html">lib/kmalloc.h</a>&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;<a class="code" href="lib_2string_8h.html">lib/string.h</a>&gt;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &lt;<a class="code" href="kprintf_8h.html">lib/kprintf.h</a>&gt;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include &lt;<a class="code" href="assert_8h.html">assert.h</a>&gt;</span>
<a name="l00041"></a>00041 
<a name="l00042"></a>00042 <span class="comment">/* Static defines */</span>
<a name="l00043"></a>00043 <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="ubixfs_8c.html#ec127f9c4f26d2021e637f5f92ef8e12">ubixfs_loadData</a>(<a class="code" href="structfileDescriptorStruct.html">fileDescriptor</a> *fd,<span class="keywordtype">char</span> *data,<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> size,<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> batIndex);
<a name="l00044"></a>00044 
<a name="l00045"></a>00045   
<a name="l00046"></a><a class="code" href="ubixfs_8c.html#0ab17f87a44bc7bb7ee3c76262f80e94">00046</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="ubixfs_8c.html#0ab17f87a44bc7bb7ee3c76262f80e94">openFileUbixFS</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="structfile.html">file</a>, <a class="code" href="structfileDescriptorStruct.html">fileDescriptor</a> *fd) {
<a name="l00047"></a>00047   <span class="comment">//int x = 0;</span>
<a name="l00048"></a>00048 <span class="comment">/* mji  struct directoryEntry *dirEntry = (struct directoryEntry *)kmalloc(0x4000); */</span>
<a name="l00049"></a>00049   <span class="keyword">struct </span><a class="code" href="structcacheNode.html">cacheNode</a> * <a class="code" href="structcacheNode.html">cacheNode</a> = <a class="code" href="types_8h.html#070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00050"></a>00050   <span class="comment">//struct directoryEntry * dirEntry = NULL;</span>
<a name="l00051"></a>00051   <span class="keyword">struct </span><a class="code" href="structubixFSInfo.html">ubixFSInfo</a> *fsInfo = fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a>;
<a name="l00052"></a>00052   
<a name="l00053"></a>00053 
<a name="l00054"></a>00054   
<a name="l00055"></a>00055 <span class="comment">/* kprintf("openFileUbixFS(%s), cwd: %s\n", file, _current-&gt;oInfo.cwd); */</span>
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <span class="comment">//if (fsInfo-&gt;dirCache == NULL) kprintf("dirCache is null!\n");</span>
<a name="l00058"></a>00058   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd);
<a name="l00059"></a>00059   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>);
<a name="l00060"></a>00060   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>);
<a name="l00061"></a>00061   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>);
<a name="l00062"></a>00062   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#6caf84418059d0121e76d873e305ddcb">read</a>);
<a name="l00063"></a>00063   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fsInfo);
<a name="l00064"></a>00064   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>);
<a name="l00065"></a>00065   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(file);
<a name="l00066"></a>00066   
<a name="l00067"></a>00067   <span class="keywordflow">if</span> ((fd-&gt;<a class="code" href="structfileDescriptorStruct.html#8c43ddd6ff5fd5383bcdde5896846e98">mode</a> &amp; <a class="code" href="vfs_8h.html#e8e814536103f514b8460ec7a0fc4553">fileRead</a>) == <a class="code" href="vfs_8h.html#e8e814536103f514b8460ec7a0fc4553">fileRead</a>) {
<a name="l00068"></a>00068     <span class="keywordflow">do</span> {
<a name="l00069"></a>00069       cacheNode = <a class="code" href="dirCache_8h.html#d136be51f0e49671914a4f0db3bb2314">ubixfs_cacheFind</a>(fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>,(<span class="keywordtype">char</span> *) file);
<a name="l00070"></a>00070       <span class="keywordflow">if</span> (cacheNode == <a class="code" href="types_8h.html#070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>) <span class="keywordflow">return</span> 0;
<a name="l00071"></a>00071       <span class="keywordflow">if</span> (cacheNode-&gt;<a class="code" href="structcacheNode.html#8b26b1b3dbe3f8cb72627e09e6c8e353">present</a> == 1) <span class="keywordflow">break</span>;
<a name="l00072"></a>00072       <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(cacheNode-&gt;<a class="code" href="structcacheNode.html#81d33d36c4163308906d9a48ea0f9eab">size</a>);
<a name="l00073"></a>00073       <span class="keywordflow">if</span> (*cacheNode-&gt;<a class="code" href="structcacheNode.html#81d33d36c4163308906d9a48ea0f9eab">size</a> != 0 &amp;&amp; cacheNode-&gt;<a class="code" href="structcacheNode.html#42813fa0cdcca6ca1e6772bd20a9c321">info</a> == <a class="code" href="types_8h.html#070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>) {
<a name="l00074"></a>00074         <span class="comment">//kprintf("caching name(size): %s(%d)\n",cacheNode-&gt;name,*cacheNode-&gt;size);</span>
<a name="l00075"></a>00075         cacheNode-&gt;<a class="code" href="structcacheNode.html#42813fa0cdcca6ca1e6772bd20a9c321">info</a> = <a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(<a class="code" href="ubixfs_8h.html#bd7a711afb8ae672c3e08a9308d06c5b">UBIXFS_ALIGN</a>(*cacheNode-&gt;<a class="code" href="structcacheNode.html#81d33d36c4163308906d9a48ea0f9eab">size</a>));
<a name="l00076"></a>00076         fd-&gt;<a class="code" href="structfileDescriptorStruct.html#97eb3dcefe53610658dc341ca449e290">size</a> = *cacheNode-&gt;<a class="code" href="structcacheNode.html#81d33d36c4163308906d9a48ea0f9eab">size</a>; 
<a name="l00077"></a>00077         <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(cacheNode-&gt;<a class="code" href="structcacheNode.html#a3fa99dfac99663d5448d74594120521">startCluster</a>);
<a name="l00078"></a>00078         <a class="code" href="ubixfs_8c.html#ec127f9c4f26d2021e637f5f92ef8e12">ubixfs_loadData</a>(fd,
<a name="l00079"></a>00079                         cacheNode-&gt;<a class="code" href="structcacheNode.html#42813fa0cdcca6ca1e6772bd20a9c321">info</a>,
<a name="l00080"></a>00080                         *cacheNode-&gt;<a class="code" href="structcacheNode.html#81d33d36c4163308906d9a48ea0f9eab">size</a>,
<a name="l00081"></a>00081                         *cacheNode-&gt;<a class="code" href="structcacheNode.html#a3fa99dfac99663d5448d74594120521">startCluster</a>);
<a name="l00082"></a>00082         cacheNode-&gt;<a class="code" href="structcacheNode.html#8b26b1b3dbe3f8cb72627e09e6c8e353">present</a> = 1;
<a name="l00083"></a>00083       } <span class="comment">/* if */</span>
<a name="l00084"></a>00084     } <span class="keywordflow">while</span>(1);
<a name="l00085"></a>00085 
<a name="l00086"></a>00086     <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(cacheNode);
<a name="l00087"></a>00087     <span class="keywordflow">if</span> (cacheNode == <a class="code" href="types_8h.html#070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>) <span class="keywordflow">return</span> 0; <span class="comment">/* this should be caught above */</span>
<a name="l00088"></a>00088 
<a name="l00089"></a>00089     fd-&gt;<a class="code" href="structfileDescriptorStruct.html#74b5825aa688ae7936fc0492743ae372">start</a>    = *cacheNode-&gt;<a class="code" href="structcacheNode.html#a3fa99dfac99663d5448d74594120521">startCluster</a>;
<a name="l00090"></a>00090     fd-&gt;<a class="code" href="structfileDescriptorStruct.html#97eb3dcefe53610658dc341ca449e290">size</a>     = *cacheNode-&gt;<a class="code" href="structcacheNode.html#81d33d36c4163308906d9a48ea0f9eab">size</a>;
<a name="l00091"></a>00091     fd-&gt;<a class="code" href="structfileDescriptorStruct.html#11626b5d99a5da968f43bc37d2591c5c">perms</a>    = *cacheNode-&gt;<a class="code" href="structcacheNode.html#1eccf5ffd0b1a3479e0e630373cff5af">permissions</a>;
<a name="l00092"></a>00092     fd-&gt;<a class="code" href="structfileDescriptorStruct.html#0222d37f7abbfbf02d84c98a9a532c33">cacheNode</a> = cacheNode; <span class="comment">/* Directory Start Sector */</span>
<a name="l00093"></a>00093     <span class="comment">/*</span>
<a name="l00094"></a>00094 <span class="comment">    if (cacheNode-&gt;size != 0x0 &amp;&amp; cacheNode-&gt;info == NULL) {</span>
<a name="l00095"></a>00095 <span class="comment">      cacheNode-&gt;info = kmalloc(UBIXFS_ALIGN(*cacheNode-&gt;size));</span>
<a name="l00096"></a>00096 <span class="comment">      ubixfs_loadData(fd,cacheNode-&gt;info,cacheNode-&gt;size,cacheNode-&gt;startCluster);</span>
<a name="l00097"></a>00097 <span class="comment">      cacheNode-&gt;present = 0x1;</span>
<a name="l00098"></a>00098 <span class="comment">      }</span>
<a name="l00099"></a>00099 <span class="comment">     */</span>
<a name="l00100"></a>00100     <span class="keywordflow">return</span>(0<a class="code" href="ap-boot_8S.html#1a3ac2137e21f6f0d400f1996914dd19">x1</a>);
<a name="l00101"></a>00101   } 
<a name="l00102"></a>00102   <span class="keywordflow">else</span> 
<a name="l00103"></a>00103     <span class="keywordflow">if</span> ((fd-&gt;<a class="code" href="structfileDescriptorStruct.html#8c43ddd6ff5fd5383bcdde5896846e98">mode</a> &amp; <a class="code" href="vfs_8h.html#4898b5a1a1daebda9d11b4afde062e5c">fileWrite</a>) == <a class="code" href="vfs_8h.html#4898b5a1a1daebda9d11b4afde062e5c">fileWrite</a>) {
<a name="l00104"></a>00104 <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"Ouch! in filewrite!\n"</span>);
<a name="l00105"></a>00105 <span class="preprocessor">#if 0</span>
<a name="l00106"></a>00106 <span class="preprocessor"></span>      fd-&gt;<a class="code" href="structfileDescriptorStruct.html#74b5825aa688ae7936fc0492743ae372">start</a>    = dirEntry-&gt;startCluster;
<a name="l00107"></a>00107       fd-&gt;<a class="code" href="structfileDescriptorStruct.html#97eb3dcefe53610658dc341ca449e290">size</a>     = dirEntry-&gt;size;
<a name="l00108"></a>00108       fd-&gt;<a class="code" href="structfileDescriptorStruct.html#11626b5d99a5da968f43bc37d2591c5c">perms</a>    = dirEntry-&gt;permissions;
<a name="l00109"></a>00109      <span class="comment">// fd-&gt;dirBlock = 0x0; /* Directory Start Sector */</span>
<a name="l00110"></a>00110 <span class="preprocessor">#endif</span>
<a name="l00111"></a>00111 <span class="preprocessor"></span>      <span class="keywordflow">return</span>(0<a class="code" href="ap-boot_8S.html#1a3ac2137e21f6f0d400f1996914dd19">x1</a>);
<a name="l00112"></a>00112     }
<a name="l00113"></a>00113     
<a name="l00114"></a>00114   <span class="keywordflow">return</span> 0;
<a name="l00115"></a>00115 
<a name="l00116"></a>00116   }
<a name="l00117"></a>00117 
<a name="l00118"></a><a class="code" href="ubixfs_8c.html#4c7f9c50f698ab4cdde8655aaf6363aa">00118</a> <span class="keywordtype">int</span> <a class="code" href="ubixfs_8h.html#4c7f9c50f698ab4cdde8655aaf6363aa">writeFileByte</a>(<span class="keywordtype">int</span> ch, <a class="code" href="structfileDescriptorStruct.html">fileDescriptor</a> *fd, <span class="keywordtype">long</span> offset) {
<a name="l00119"></a>00119 
<a name="l00120"></a>00120   <span class="keywordtype">int</span> blockCount = 0x0,batIndex = 0x0,batIndexPrev = 0x0;
<a name="l00121"></a>00121   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> i = 0x0;
<a name="l00122"></a>00122   <span class="keyword">struct </span><a class="code" href="structdirectoryEntry.html">directoryEntry</a> *dirEntry = 0x0;
<a name="l00123"></a>00123   <span class="keyword">struct </span><a class="code" href="structubixFSInfo.html">ubixFSInfo</a> *fsInfo = <a class="code" href="types_8h.html#070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00124"></a>00124 
<a name="l00125"></a>00125   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd);
<a name="l00126"></a>00126   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>);
<a name="l00127"></a>00127   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>);
<a name="l00128"></a>00128 
<a name="l00129"></a>00129   batIndexPrev = fd-&gt;<a class="code" href="structfileDescriptorStruct.html#74b5825aa688ae7936fc0492743ae372">start</a>;
<a name="l00130"></a>00130   fsInfo = fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a>;
<a name="l00131"></a>00131 
<a name="l00132"></a>00132   <span class="comment">/* Find Out How Many Blocks Long This File Is */</span>
<a name="l00133"></a>00133   blockCount = (offset/4096);
<a name="l00134"></a>00134   
<a name="l00135"></a>00135   <span class="comment">/* Find The Block If It Doesn't Exist We Will Have To Allocate One */</span>
<a name="l00136"></a>00136   <span class="keywordflow">for</span> (i=0x0; i &lt;= fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].<a class="code" href="structubixDiskLabel_1_1ubixPartitions.html#6a02392928bd127ff780dd656dc88203">pBatSize</a>;
<a name="l00137"></a>00137        i++) {
<a name="l00138"></a>00138     batIndex = fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[batIndexPrev].<a class="code" href="structblockAllocationTableEntry.html#db5281b505d283f4d43d09e327b63c63">nextBlock</a>;
<a name="l00139"></a>00139     if (batIndex == 0x0) {
<a name="l00140"></a>00140       <span class="keywordflow">break</span>;
<a name="l00141"></a>00141       }
<a name="l00142"></a>00142     batIndexPrev = batIndex;
<a name="l00143"></a>00143     }
<a name="l00144"></a>00144 
<a name="l00145"></a>00145   <span class="keywordflow">if</span> ((offset%4096 == 0) &amp;&amp; (fd-&gt;<a class="code" href="structfileDescriptorStruct.html#dd78e2b569c4813dc1b171f4203f3e6b">status</a> == <a class="code" href="vfs_8h.html#a461f4419baab36cdd1143cd0fe66e0e">fdRead</a>)) {
<a name="l00146"></a>00146       fd-&gt;<a class="code" href="structfileDescriptorStruct.html#dd78e2b569c4813dc1b171f4203f3e6b">status</a> = <a class="code" href="vfs_8h.html#249a3d8cdfed3302062ad215b95a4294">fdOpen</a>;
<a name="l00147"></a>00147       }    
<a name="l00148"></a>00148 
<a name="l00149"></a>00149   <span class="comment">/* If batIndex == 0x0 Then We Must Allocate A New Block */</span>
<a name="l00150"></a>00150   <span class="keywordflow">if</span> (batIndex == 0x0) {
<a name="l00151"></a>00151     <span class="keywordflow">for</span> (i=1;i &lt; fsInfo-&gt;batEntries;i++) {
<a name="l00152"></a>00152       <span class="keywordflow">if</span> (fsInfo-&gt;blockAllocationTable[i].attributes == 0x0) {
<a name="l00153"></a>00153         fsInfo-&gt;blockAllocationTable[batIndexPrev].nextBlock = i;
<a name="l00154"></a>00154         fsInfo-&gt;blockAllocationTable[batIndex].nextBlock     = -1;
<a name="l00155"></a>00155         batIndex  = i;
<a name="l00156"></a>00156         fd-&gt;start = i;
<a name="l00157"></a>00157         <span class="keywordflow">break</span>;
<a name="l00158"></a>00158         }
<a name="l00159"></a>00159       }
<a name="l00160"></a>00160     <span class="comment">/* fd-&gt;mp-&gt;drive-&gt;read(fd-&gt;mp-&gt;drive-&gt;driveInfoStruct,diskLabel-&gt;partitions[0].pOffset+blockAllocationTable[batIndex].realSector,8,fd-&gt;buffer); */</span>
<a name="l00161"></a>00161     fd-&gt;buffer[offset-(blockCount*4096)] = ch;
<a name="l00162"></a>00162     fd-&gt;mp-&gt;device-&gt;devInfo-&gt;write(fd-&gt;mp-&gt;device-&gt;devInfo-&gt;info,fd-&gt;buffer,fd-&gt;mp-&gt;diskLabel-&gt;partitions[fd-&gt;mp-&gt;partition].pOffset+fsInfo-&gt;blockAllocationTable[batIndex].realSector,8);
<a name="l00163"></a>00163     }
<a name="l00164"></a>00164   <span class="keywordflow">else</span> {
<a name="l00165"></a>00165     <span class="keywordflow">if</span> (fd-&gt;status != <a class="code" href="vfs_8h.html#a461f4419baab36cdd1143cd0fe66e0e">fdRead</a>) {    
<a name="l00166"></a>00166       fd-&gt;mp-&gt;device-&gt;devInfo-&gt;read(fd-&gt;mp-&gt;device-&gt;devInfo-&gt;info,fd-&gt;buffer,fd-&gt;mp-&gt;diskLabel-&gt;partitions[fd-&gt;mp-&gt;partition].pOffset+fsInfo-&gt;blockAllocationTable[batIndex].realSector,8);
<a name="l00167"></a>00167       fd-&gt;status = <a class="code" href="vfs_8h.html#a461f4419baab36cdd1143cd0fe66e0e">fdRead</a>;
<a name="l00168"></a>00168       }
<a name="l00169"></a>00169     fd-&gt;buffer[offset-(blockCount*4096)] = ch;
<a name="l00170"></a>00170     fd-&gt;mp-&gt;device-&gt;devInfo-&gt;write(fd-&gt;mp-&gt;device-&gt;devInfo-&gt;info,fd-&gt;buffer,fd-&gt;mp-&gt;diskLabel-&gt;partitions[fd-&gt;mp-&gt;partition].pOffset+fsInfo-&gt;blockAllocationTable[batIndex].realSector,8);
<a name="l00171"></a>00171     }    
<a name="l00172"></a>00172   <span class="keywordflow">if</span> ((<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)offset &gt; fd-&gt;size) {
<a name="l00173"></a>00173     fd-&gt;size = offset;
<a name="l00174"></a>00174     dirEntry = (<span class="keyword">struct </span><a class="code" href="structdirectoryEntry.html">directoryEntry</a> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(4096);
<a name="l00175"></a>00175   <span class="comment">/*</span>
<a name="l00176"></a>00176 <span class="comment">    fd-&gt;mp-&gt;device-&gt;devInfo-&gt;read(fd-&gt;mp-&gt;device-&gt;devInfo-&gt;info,dirEntry,(fd-&gt;mp-&gt;diskLabel-&gt;partitions[fd-&gt;mp-&gt;partition].pOffset+fsInfo-&gt;blockAllocationTable[fd-&gt;dirBlock].realSector),8);</span>
<a name="l00177"></a>00177 <span class="comment">  */</span>
<a name="l00178"></a>00178     <span class="keywordflow">for</span> (i=0x0;i&lt;(4096/<span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structdirectoryEntry.html">directoryEntry</a>));i++) {
<a name="l00179"></a>00179       <span class="keywordflow">if</span> ((<span class="keywordtype">int</span>)!<a class="code" href="lib_2string_8h.html#6f3dcb20ff11ff9db5904c3cfb61a38c">strcmp</a>(dirEntry[i].<a class="code" href="structdirectoryEntry.html#61e77c256eaf6c4e7fe56d2574f16f98">fileName</a>,fd-&gt;fileName))
<a name="l00180"></a>00180         <span class="keywordflow">break</span>;
<a name="l00181"></a>00181       }  
<a name="l00182"></a>00182     dirEntry[i].size = fd-&gt;size;
<a name="l00183"></a>00183 <span class="comment">/*</span>
<a name="l00184"></a>00184 <span class="comment">    fd-&gt;mp-&gt;device-&gt;devInfo-&gt;write(fd-&gt;mp-&gt;device-&gt;devInfo-&gt;info,dirEntry,(fd-&gt;mp-&gt;diskLabel-&gt;partitions[fd-&gt;mp-&gt;partition].pOffset+fsInfo-&gt;blockAllocationTable[fd-&gt;dirBlock].realSector),8);</span>
<a name="l00185"></a>00185 <span class="comment">*/</span>
<a name="l00186"></a>00186     <a class="code" href="kmalloc_8h.html#aa9ed6886459604cf73ccdbf6410e487">kfree</a>(dirEntry);
<a name="l00187"></a>00187     }
<a name="l00188"></a>00188   <span class="keywordflow">return</span>(ch);
<a name="l00189"></a>00189   }
<a name="l00190"></a>00190 
<a name="l00191"></a>00191 <span class="comment">/* Verified Functions */</span>
<a name="l00192"></a>00192 
<a name="l00193"></a>00193     
<a name="l00194"></a><a class="code" href="ubixfs_8c.html#51f5dd233a9470dd0254bb0d0e435b8d">00194</a> <span class="keywordtype">int</span> <a class="code" href="ubixfs_8h.html#3882cc85dc373eba13315dfb0da4c578">readUbixFS</a>(<a class="code" href="structfileDescriptorStruct.html">fileDescriptor</a> *fd,<span class="keywordtype">char</span> *data,<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> offset,<span class="keywordtype">long</span> <a class="code" href="structdirectoryEntry.html#9571030f709f6926b925e552660a65ab">size</a>) {
<a name="l00195"></a>00195   <span class="keywordtype">int</span> i = 0x0;
<a name="l00196"></a>00196   <span class="keywordtype">char</span> *buffer = 0x0;
<a name="l00197"></a>00197   <span class="keyword">struct </span><a class="code" href="structubixFSInfo.html">ubixFSInfo</a> *fsInfo = <a class="code" href="types_8h.html#070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00198"></a>00198 
<a name="l00199"></a>00199   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd);
<a name="l00200"></a>00200   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>);
<a name="l00201"></a>00201   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a>);
<a name="l00202"></a>00202 
<a name="l00203"></a>00203   fsInfo = fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a>;
<a name="l00204"></a>00204   
<a name="l00205"></a>00205   <span class="keywordflow">if</span> (fd-&gt;<a class="code" href="structfileDescriptorStruct.html#0222d37f7abbfbf02d84c98a9a532c33">cacheNode</a>-&gt;<a class="code" href="structcacheNode.html#8b26b1b3dbe3f8cb72627e09e6c8e353">present</a> != 1) 
<a name="l00206"></a>00206     <a class="code" href="kpanic_8h.html#db9a182aa071791a306163d50d653deb">kpanic</a>(<span class="stringliteral">"ERROR with cache node\n"</span>);
<a name="l00207"></a>00207     
<a name="l00208"></a>00208   buffer = (<span class="keywordtype">char</span> *)fd-&gt;<a class="code" href="structfileDescriptorStruct.html#0222d37f7abbfbf02d84c98a9a532c33">cacheNode</a>-&gt;<a class="code" href="structcacheNode.html#42813fa0cdcca6ca1e6772bd20a9c321">info</a>;
<a name="l00209"></a>00209   
<a name="l00210"></a>00210   for (i=0x0; i&lt;size; i++) {
<a name="l00211"></a>00211     <span class="keywordflow">if</span> (offset &gt; fd-&gt;<a class="code" href="structfileDescriptorStruct.html#97eb3dcefe53610658dc341ca449e290">size</a>) {
<a name="l00212"></a>00212       <span class="comment">/* Set File EOF If There Is Nothing To Do */</span>
<a name="l00213"></a>00213       <span class="comment">/* data[i] = '\0'; Is this safe? */</span>
<a name="l00214"></a>00214       fd-&gt;<a class="code" href="structfileDescriptorStruct.html#dd78e2b569c4813dc1b171f4203f3e6b">status</a> = <a class="code" href="vfs_8h.html#4907ecb6121af1b80c5c5b436ebe3cb5">fdEof</a>;
<a name="l00215"></a>00215       <span class="keywordflow">return</span>(size);
<a name="l00216"></a>00216       }
<a name="l00217"></a>00217     <span class="comment">/* Copy Data From Buffer To Data */</span>
<a name="l00218"></a>00218     data[i] = buffer[i + offset];
<a name="l00219"></a>00219     }
<a name="l00220"></a>00220   <span class="comment">/* Return */</span>
<a name="l00221"></a>00221   <span class="keywordflow">return</span>(size);
<a name="l00222"></a>00222   }
<a name="l00223"></a>00223 
<a name="l00224"></a>00224 
<a name="l00225"></a>00225 <span class="comment">/************************************************************************</span>
<a name="l00226"></a>00226 <span class="comment"></span>
<a name="l00227"></a>00227 <span class="comment">Function: int writeUbixFS(fileDescriptor *fd,char *data,long offset,long size)</span>
<a name="l00228"></a>00228 <span class="comment">Description: Write Data Into File</span>
<a name="l00229"></a>00229 <span class="comment">Notes:</span>
<a name="l00230"></a>00230 <span class="comment"></span>
<a name="l00231"></a>00231 <span class="comment">************************************************************************/</span>
<a name="l00232"></a><a class="code" href="ubixfs_8c.html#ba0435c266346dd10ac3cbc68655b20c">00232</a> <span class="keywordtype">int</span> <a class="code" href="ubixfs_8h.html#ba0435c266346dd10ac3cbc68655b20c">writeUbixFS</a>(<a class="code" href="structfileDescriptorStruct.html">fileDescriptor</a> *fd,<span class="keywordtype">char</span> *data,<span class="keywordtype">long</span> offset,<span class="keywordtype">long</span> size) {
<a name="l00233"></a>00233   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> blockOffset    = 0x0;
<a name="l00234"></a>00234   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> blockIndex;
<a name="l00235"></a>00235   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> blockIndexPrev;
<a name="l00236"></a>00236   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> i              = 0x0;
<a name="l00237"></a>00237   <span class="keyword">struct </span><a class="code" href="structubixFSInfo.html">ubixFSInfo</a> *fsInfo = <a class="code" href="types_8h.html#070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00238"></a>00238   <span class="keyword">struct </span><a class="code" href="structdirectoryEntry.html">directoryEntry</a> *dirEntry = 0x0;
<a name="l00239"></a>00239 
<a name="l00240"></a>00240   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd);
<a name="l00241"></a>00241   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>);
<a name="l00242"></a>00242   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a>);
<a name="l00243"></a>00243   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>);
<a name="l00244"></a>00244   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>);
<a name="l00245"></a>00245 
<a name="l00246"></a>00246   blockIndex = blockIndexPrev = fd-&gt;<a class="code" href="structfileDescriptorStruct.html#74b5825aa688ae7936fc0492743ae372">start</a>;
<a name="l00247"></a>00247   fsInfo = fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a>;
<a name="l00248"></a>00248 
<a name="l00249"></a>00249   blockOffset = (offset/0x1000);
<a name="l00250"></a>00250 
<a name="l00251"></a>00251   <span class="keywordflow">if</span> (fd-&gt;<a class="code" href="structfileDescriptorStruct.html#97eb3dcefe53610658dc341ca449e290">size</a> != 0x0) {
<a name="l00252"></a>00252     <span class="keywordflow">for</span> (i = 0x0;i &lt; blockOffset;i++) {
<a name="l00253"></a>00253       blockIndex = fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[blockIndexPrev].<a class="code" href="structblockAllocationTableEntry.html#db5281b505d283f4d43d09e327b63c63">nextBlock</a>;
<a name="l00254"></a>00254         if ((<span class="keywordtype">int</span>)blockIndex == <a class="code" href="ubixfs_8h.html#9c66702437ce6449d7886b4dbaad3c02">EOBC</a>) {
<a name="l00255"></a>00255           blockIndex = <a class="code" href="ubixfs_8h.html#d2880707d0f942f5119f946db4e13e4e">getFreeBlocks</a>(1,fd);
<a name="l00256"></a>00256           fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[blockIndexPrev].<a class="code" href="structblockAllocationTableEntry.html#db5281b505d283f4d43d09e327b63c63">nextBlock</a> = blockIndex;
<a name="l00257"></a>00257           fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[blockIndex].<a class="code" href="structblockAllocationTableEntry.html#db5281b505d283f4d43d09e327b63c63">nextBlock</a> = <a class="code" href="ubixfs_8h.html#9c66702437ce6449d7886b4dbaad3c02">EOBC</a>;
<a name="l00258"></a>00258           <span class="keywordflow">break</span>;
<a name="l00259"></a>00259           }
<a name="l00260"></a>00260         blockIndexPrev = blockIndex;
<a name="l00261"></a>00261       }
<a name="l00262"></a>00262     }
<a name="l00263"></a>00263 
<a name="l00264"></a>00264   fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#6caf84418059d0121e76d873e305ddcb">read</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#eacb2f431b14ddd1e9fe34db278dfc9e">info</a>,fd-&gt;<a class="code" href="structfileDescriptorStruct.html#cbc0897e87c2c167cdb8cb1beb77f598">buffer</a>,fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pOffset+fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[blockIndex].<a class="code" href="structblockAllocationTableEntry.html#47b0210bbfb05977d7d5fed3b24718b4">realSector</a>,<a class="code" href="ubixfs_8h.html#d4eebb29e7c75230c032b1e6f71e061d">blockSize</a>);
<a name="l00265"></a>00265   <span class="keywordflow">for</span> (i = 0x0;i &lt; (<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)size;i++) {
<a name="l00266"></a>00266 
<a name="l00267"></a>00267     fd-&gt;<a class="code" href="structfileDescriptorStruct.html#cbc0897e87c2c167cdb8cb1beb77f598">buffer</a>[(offset- (blockOffset *0<a class="code" href="ap-boot_8S.html#f78b91f02427adef14bb8b28aa93baa5">x1000</a>))] = data[i];
<a name="l00268"></a>00268     offset++;
<a name="l00269"></a>00269 
<a name="l00270"></a>00270     if (offset%4096 == 0x0) {
<a name="l00271"></a>00271       blockOffset++;
<a name="l00272"></a>00272       fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#f46913eec9f191290c82db23380bc5df">write</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#eacb2f431b14ddd1e9fe34db278dfc9e">info</a>,fd-&gt;<a class="code" href="structfileDescriptorStruct.html#cbc0897e87c2c167cdb8cb1beb77f598">buffer</a>,fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pOffset+fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[blockIndex].<a class="code" href="structblockAllocationTableEntry.html#47b0210bbfb05977d7d5fed3b24718b4">realSector</a>,<a class="code" href="ubixfs_8h.html#d4eebb29e7c75230c032b1e6f71e061d">blockSize</a>);
<a name="l00273"></a>00273  
<a name="l00274"></a>00274       <span class="keywordflow">if</span> (fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[blockIndex].<a class="code" href="structblockAllocationTableEntry.html#db5281b505d283f4d43d09e327b63c63">nextBlock</a> == <a class="code" href="ubixfs_8h.html#9c66702437ce6449d7886b4dbaad3c02">EOBC</a>) {
<a name="l00275"></a>00275         blockIndexPrev = blockIndex;
<a name="l00276"></a>00276         blockIndex = <a class="code" href="ubixfs_8h.html#d2880707d0f942f5119f946db4e13e4e">getFreeBlocks</a>(1,fd);
<a name="l00277"></a>00277         fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[blockIndexPrev].<a class="code" href="structblockAllocationTableEntry.html#db5281b505d283f4d43d09e327b63c63">nextBlock</a> = blockIndex;
<a name="l00278"></a>00278         fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[blockIndex].<a class="code" href="structblockAllocationTableEntry.html#db5281b505d283f4d43d09e327b63c63">nextBlock</a>     = <a class="code" href="ubixfs_8h.html#9c66702437ce6449d7886b4dbaad3c02">EOBC</a>;
<a name="l00279"></a>00279         }
<a name="l00280"></a>00280       <span class="keywordflow">else</span> {
<a name="l00281"></a>00281         blockIndex = fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[blockIndex].<a class="code" href="structblockAllocationTableEntry.html#db5281b505d283f4d43d09e327b63c63">nextBlock</a>;
<a name="l00282"></a>00282         fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#6caf84418059d0121e76d873e305ddcb">read</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#eacb2f431b14ddd1e9fe34db278dfc9e">info</a>,fd-&gt;<a class="code" href="structfileDescriptorStruct.html#cbc0897e87c2c167cdb8cb1beb77f598">buffer</a>,fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pOffset+fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[blockIndex].<a class="code" href="structblockAllocationTableEntry.html#47b0210bbfb05977d7d5fed3b24718b4">realSector</a>,<a class="code" href="ubixfs_8h.html#d4eebb29e7c75230c032b1e6f71e061d">blockSize</a>);
<a name="l00283"></a>00283         }
<a name="l00284"></a>00284       }
<a name="l00285"></a>00285     }
<a name="l00286"></a>00286   fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#f46913eec9f191290c82db23380bc5df">write</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#eacb2f431b14ddd1e9fe34db278dfc9e">info</a>,fd-&gt;<a class="code" href="structfileDescriptorStruct.html#cbc0897e87c2c167cdb8cb1beb77f598">buffer</a>,fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pOffset+fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[blockIndex].<a class="code" href="structblockAllocationTableEntry.html#47b0210bbfb05977d7d5fed3b24718b4">realSector</a>,<a class="code" href="ubixfs_8h.html#d4eebb29e7c75230c032b1e6f71e061d">blockSize</a>);
<a name="l00287"></a>00287 
<a name="l00288"></a>00288   <span class="keywordflow">if</span> ((<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)offset &gt; fd-&gt;<a class="code" href="structfileDescriptorStruct.html#97eb3dcefe53610658dc341ca449e290">size</a>) {
<a name="l00289"></a>00289     fd-&gt;<a class="code" href="structfileDescriptorStruct.html#97eb3dcefe53610658dc341ca449e290">size</a> = offset;
<a name="l00290"></a>00290     dirEntry = (<span class="keyword">struct </span><a class="code" href="structdirectoryEntry.html">directoryEntry</a> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(4096);
<a name="l00291"></a>00291 <span class="comment">/*</span>
<a name="l00292"></a>00292 <span class="comment">    fd-&gt;mp-&gt;device-&gt;devInfo-&gt;read(fd-&gt;mp-&gt;device-&gt;devInfo-&gt;info,dirEntry,(fd-&gt;mp-&gt;diskLabel-&gt;partitions[fd-&gt;mp-&gt;partition].pOffset+fsInfo-&gt;blockAllocationTable[fd-&gt;dirBlock].realSector),blockSize);</span>
<a name="l00293"></a>00293 <span class="comment">*/</span>
<a name="l00294"></a>00294     <span class="keywordflow">for</span> (i=0x0;i&lt;(4096/<span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structdirectoryEntry.html">directoryEntry</a>));i++) {
<a name="l00295"></a>00295       <span class="keywordflow">if</span> ((<span class="keywordtype">int</span>)!<a class="code" href="lib_2string_8h.html#6f3dcb20ff11ff9db5904c3cfb61a38c">strcmp</a>(dirEntry[i].<a class="code" href="structdirectoryEntry.html#61e77c256eaf6c4e7fe56d2574f16f98">fileName</a>,fd-&gt;<a class="code" href="structfileDescriptorStruct.html#4ca84ca208f0bcd97d654f99a55724f6">fileName</a>))
<a name="l00296"></a>00296         <span class="keywordflow">break</span>;
<a name="l00297"></a>00297       }
<a name="l00298"></a>00298     dirEntry[i].<a class="code" href="structdirectoryEntry.html#9571030f709f6926b925e552660a65ab">size</a> = fd-&gt;<a class="code" href="structfileDescriptorStruct.html#97eb3dcefe53610658dc341ca449e290">size</a>;
<a name="l00299"></a>00299     dirEntry[i].<a class="code" href="structdirectoryEntry.html#83e91977e7db1dc36d3e81183ac8965c">startCluster</a> = fd-&gt;<a class="code" href="structfileDescriptorStruct.html#74b5825aa688ae7936fc0492743ae372">start</a>;
<a name="l00300"></a>00300 <span class="comment">/*</span>
<a name="l00301"></a>00301 <span class="comment">    fd-&gt;mp-&gt;device-&gt;devInfo-&gt;write(fd-&gt;mp-&gt;device-&gt;devInfo-&gt;info,dirEntry,(fd-&gt;mp-&gt;diskLabel-&gt;partitions[fd-&gt;mp-&gt;partition].pOffset+fsInfo-&gt;blockAllocationTable[fd-&gt;dirBlock].realSector),blockSize);</span>
<a name="l00302"></a>00302 <span class="comment">*/</span>
<a name="l00303"></a>00303     <a class="code" href="kmalloc_8h.html#aa9ed6886459604cf73ccdbf6410e487">kfree</a>(dirEntry);
<a name="l00304"></a>00304     }
<a name="l00305"></a>00305   <span class="comment">/* Return */</span>
<a name="l00306"></a>00306   <span class="keywordflow">return</span>(size);
<a name="l00307"></a>00307   }
<a name="l00308"></a>00308 
<a name="l00309"></a><a class="code" href="ubixfs_8c.html#dfbafb62e063e24f4df09029862ba9d0">00309</a> <span class="keywordtype">void</span> <a class="code" href="ubixfs_8h.html#dfbafb62e063e24f4df09029862ba9d0">ubixFSUnlink</a>(<span class="keywordtype">char</span> *path,<span class="keyword">struct</span> <a class="code" href="structvfs__mountPoint.html">vfs_mountPoint</a> *mp) {
<a name="l00310"></a>00310   <span class="keywordtype">int</span> x=0;
<a name="l00311"></a>00311   <span class="keyword">struct </span><a class="code" href="structdirectoryEntry.html">directoryEntry</a> *dirEntry = (<span class="keyword">struct </span><a class="code" href="structdirectoryEntry.html">directoryEntry</a> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(0<a class="code" href="ap-boot_8S.html#f78b91f02427adef14bb8b28aa93baa5">x1000</a>);
<a name="l00312"></a>00312   <span class="keyword">struct </span><a class="code" href="structubixFSInfo.html">ubixFSInfo</a> *fsInfo = mp-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a>;
<a name="l00313"></a>00313   
<a name="l00314"></a>00314   mp-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#6caf84418059d0121e76d873e305ddcb">read</a>(mp-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#eacb2f431b14ddd1e9fe34db278dfc9e">info</a>,dirEntry,(mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[mp-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pOffset+fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[fsInfo-&gt;<a class="code" href="structubixFSInfo.html#8c58076e25df4115ed42bebce08d5181">rootDir</a>].realSector),8);
<a name="l00315"></a>00315 
<a name="l00316"></a>00316   <span class="keywordflow">for</span> (x=0;(<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)x&lt;(4096/<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structdirectoryEntry.html">directoryEntry</a>));x++) {
<a name="l00317"></a>00317     <span class="keywordflow">if</span> ((<span class="keywordtype">int</span>)!<a class="code" href="lib_2string_8h.html#6f3dcb20ff11ff9db5904c3cfb61a38c">strcmp</a>(dirEntry[x].fileName,path)) {
<a name="l00318"></a>00318       dirEntry[x].attributes |= <a class="code" href="ubixfs_8h.html#b0df352296e0f22896675aba0aa11b6e">typeDeleted</a>;
<a name="l00319"></a>00319       dirEntry[x].<a class="code" href="structdirectoryEntry.html#61e77c256eaf6c4e7fe56d2574f16f98">fileName</a>[0] = <span class="charliteral">'?'</span>;
<a name="l00320"></a>00320       mp-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#f46913eec9f191290c82db23380bc5df">write</a>(mp-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#eacb2f431b14ddd1e9fe34db278dfc9e">info</a>,dirEntry,(mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[mp-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pOffset+fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[fsInfo-&gt;<a class="code" href="structubixFSInfo.html#8c58076e25df4115ed42bebce08d5181">rootDir</a>].realSector),8);
<a name="l00321"></a>00321       <span class="keywordflow">return</span>;
<a name="l00322"></a>00322       }
<a name="l00323"></a>00323     }
<a name="l00324"></a>00324   <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"File Not Found\n"</span>);
<a name="l00325"></a>00325   <span class="keywordflow">return</span>;
<a name="l00326"></a>00326   }
<a name="l00327"></a>00327   
<a name="l00328"></a>00328   
<a name="l00329"></a>00329 <span class="comment">/*****************************************************************************************</span>
<a name="l00330"></a>00330 <span class="comment"></span>
<a name="l00331"></a>00331 <span class="comment">Function: static</span>
<a name="l00332"></a>00332 <span class="comment">          int ubixfs_loadData(fileDescriptor *fd,char *data,uInt32 size,uInt32 batIndex)</span>
<a name="l00333"></a>00333 <span class="comment"></span>
<a name="l00334"></a>00334 <span class="comment">Description: This will load the node data in from the disk</span>
<a name="l00335"></a>00335 <span class="comment"></span>
<a name="l00336"></a>00336 <span class="comment">Notes:</span>
<a name="l00337"></a>00337 <span class="comment">  07/23/2004 - This loads complete blocks from disk so it is aligned to 0x1000 not the</span>
<a name="l00338"></a>00338 <span class="comment">               actual file size</span>
<a name="l00339"></a>00339 <span class="comment"></span>
<a name="l00340"></a>00340 <span class="comment">*****************************************************************************************/</span>    
<a name="l00341"></a><a class="code" href="ubixfs_8c.html#ec127f9c4f26d2021e637f5f92ef8e12">00341</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="ubixfs_8c.html#ec127f9c4f26d2021e637f5f92ef8e12">ubixfs_loadData</a>(<a class="code" href="structfileDescriptorStruct.html">fileDescriptor</a> *fd,<span class="keywordtype">char</span> *data,<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> size,<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> batIndex) {
<a name="l00342"></a>00342   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> i = 0x0;
<a name="l00343"></a>00343 
<a name="l00344"></a>00344   <span class="keyword">struct </span><a class="code" href="structubixFSInfo.html">ubixFSInfo</a> *fsInfo = <a class="code" href="types_8h.html#070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00345"></a>00345 
<a name="l00346"></a>00346   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd);
<a name="l00347"></a>00347   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>);
<a name="l00348"></a>00348   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a>);
<a name="l00349"></a>00349 
<a name="l00350"></a>00350   fsInfo = fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a>;
<a name="l00351"></a>00351 
<a name="l00352"></a>00352   size = <a class="code" href="ubixfs_8h.html#bd7a711afb8ae672c3e08a9308d06c5b">UBIXFS_ALIGN</a>(size);
<a name="l00353"></a>00353   <span class="comment">/* Loop by block size */</span>
<a name="l00354"></a>00354   
<a name="l00355"></a>00355   <span class="keywordflow">for</span> (i=0x0; i&lt;size; i += (<a class="code" href="ubixfs_8h.html#dab92bc23023fba8f349eb34bf5acf46">UBIXFS_BLOCKSIZE_BYTES</a>)) {
<a name="l00356"></a>00356   <span class="comment">/* Get next block if we are ready for it */</span>
<a name="l00357"></a>00357     <span class="keywordflow">if</span> (i != 0x0)
<a name="l00358"></a>00358       batIndex = fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[batIndex].<a class="code" href="structblockAllocationTableEntry.html#db5281b505d283f4d43d09e327b63c63">nextBlock</a>;
<a name="l00359"></a>00359   <span class="comment">/* Read data in from media */</span>
<a name="l00360"></a>00360     fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#6caf84418059d0121e76d873e305ddcb">read</a>(fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#eacb2f431b14ddd1e9fe34db278dfc9e">info</a>,data+i,fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[fd-&gt;<a class="code" href="structfileDescriptorStruct.html#f8abeb5da4a430885db51246db1356f9">mp</a>-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pOffset+fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[batIndex].<a class="code" href="structblockAllocationTableEntry.html#47b0210bbfb05977d7d5fed3b24718b4">realSector</a>,<a class="code" href="ubixfs_8h.html#d4eebb29e7c75230c032b1e6f71e061d">blockSize</a>);
<a name="l00361"></a>00361     }
<a name="l00362"></a>00362   <span class="comment">/* Return */</span>
<a name="l00363"></a>00363   <span class="keywordflow">return</span>(0x0);
<a name="l00364"></a>00364   }
<a name="l00365"></a>00365 
<a name="l00366"></a>00366 
<a name="l00367"></a>00367 <span class="comment">/*****************************************************************************************</span>
<a name="l00368"></a>00368 <span class="comment"></span>
<a name="l00369"></a>00369 <span class="comment">Function: int ubixfs_initialize()</span>
<a name="l00370"></a>00370 <span class="comment"></span>
<a name="l00371"></a>00371 <span class="comment">Description: This will initialize a mount point it loads the BAT and Caches the rootDir</span>
<a name="l00372"></a>00372 <span class="comment"></span>
<a name="l00373"></a>00373 <span class="comment">Notes:</span>
<a name="l00374"></a>00374 <span class="comment"></span>
<a name="l00375"></a>00375 <span class="comment">*****************************************************************************************/</span>  
<a name="l00376"></a><a class="code" href="ubixfs_8c.html#32762e2563015d124909f3317c2a7423">00376</a> <span class="keywordtype">int</span> <a class="code" href="ubixfs_8h.html#2c53ad6e6ce2e149eec9b5361dd10eda">ubixfs_initialize</a>(<span class="keyword">struct</span> <a class="code" href="structvfs__mountPoint.html">vfs_mountPoint</a> *mp) {
<a name="l00377"></a>00377   <span class="keyword">struct </span><a class="code" href="structubixFSInfo.html">ubixFSInfo</a> *fsInfo = 0x0;
<a name="l00378"></a>00378 
<a name="l00379"></a>00379   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(mp);
<a name="l00380"></a>00380   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>);
<a name="l00381"></a>00381   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>);
<a name="l00382"></a>00382 
<a name="l00383"></a>00383   mp-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a> = (<span class="keyword">struct </span><a class="code" href="structubixFSInfo.html">ubixFSInfo</a> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structubixFSInfo.html">ubixFSInfo</a>));
<a name="l00384"></a>00384   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(mp-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a>);
<a name="l00385"></a>00385   
<a name="l00386"></a>00386   fsInfo = mp-&gt;<a class="code" href="structvfs__mountPoint.html#9771ecae1bc4482ad0282aee5766bd9b">fsInfo</a>;
<a name="l00387"></a>00387   fsInfo-&gt;<a class="code" href="structubixFSInfo.html#8c58076e25df4115ed42bebce08d5181">rootDir</a> = 0x0; <span class="comment">/* Root directory is always 0x0 on the UbixFS */</span>
<a name="l00388"></a>00388   
<a name="l00389"></a>00389   <span class="comment">/*</span>
<a name="l00390"></a>00390 <span class="comment">   Check the disk label to ensure this is an UbixFS partition</span>
<a name="l00391"></a>00391 <span class="comment">  */</span>
<a name="l00392"></a>00392   <span class="keywordflow">if</span> ((mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#2eea14a0546c7de19d53b3784e623463">magicNum</a> == <a class="code" href="ubixfs_8h.html#1b1ab97d6d5dfbfb20f0f80d7c625941">UBIXDISKMAGIC</a>) &amp;&amp;  (mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#95fd8a0ea36a8b3de597b92c8ebe0dce">magicNum2</a> == <a class="code" href="ubixfs_8h.html#1b1ab97d6d5dfbfb20f0f80d7c625941">UBIXDISKMAGIC</a>)) {
<a name="l00393"></a>00393     
<a name="l00394"></a>00394     <span class="comment">/* Allocate memory for BAT */</span>
<a name="l00395"></a>00395     fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a> = (<span class="keyword">struct </span><a class="code" href="structblockAllocationTableEntry.html">blockAllocationTableEntry</a> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[mp-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pBatSize * 512);
<a name="l00396"></a>00396     <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>);
<a name="l00397"></a>00397 
<a name="l00398"></a>00398     <span class="comment">/* Set up the amount of BAT entries */</span>
<a name="l00399"></a>00399     fsInfo-&gt;<a class="code" href="structubixFSInfo.html#4f530e266f49e0310c763653399dafa2">batEntries</a> = (mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[mp-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].<a class="code" href="structubixDiskLabel_1_1ubixPartitions.html#6a02392928bd127ff780dd656dc88203">pBatSize</a>*512) / <span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structblockAllocationTableEntry.html">blockAllocationTableEntry</a>);
<a name="l00400"></a>00400 
<a name="l00401"></a>00401     <span class="comment">/* Read the BAT to memory */</span>
<a name="l00402"></a>00402     <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(mp-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#6caf84418059d0121e76d873e305ddcb">read</a>);
<a name="l00403"></a>00403     mp-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#6caf84418059d0121e76d873e305ddcb">read</a>(mp-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#eacb2f431b14ddd1e9fe34db278dfc9e">info</a>, 
<a name="l00404"></a>00404                              fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>,
<a name="l00405"></a>00405                              mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[mp-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pOffset,
<a name="l00406"></a>00406                              mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[mp-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pBatSize);
<a name="l00407"></a>00407     
<a name="l00408"></a>00408     <span class="comment">/* Set up root directory cache */</span>
<a name="l00409"></a>00409     fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a> = <a class="code" href="dirCache_8h.html#adfffea5ad577cecdfbc4eb7989cf193">ubixfs_cacheNew</a>(<span class="stringliteral">"/"</span>);
<a name="l00410"></a>00410     <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>);
<a name="l00411"></a>00411     fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#42813fa0cdcca6ca1e6772bd20a9c321">info</a> = (<span class="keyword">struct </span><a class="code" href="structdirectoryEntry.html">directoryEntry</a> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(0x4000);  <span class="comment">/* allocate root dir */</span>
<a name="l00412"></a>00412     fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#8b26b1b3dbe3f8cb72627e09e6c8e353">present</a> = 1;
<a name="l00413"></a>00413     fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#81d33d36c4163308906d9a48ea0f9eab">size</a> = <a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(<span class="keyword">sizeof</span>(fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#81d33d36c4163308906d9a48ea0f9eab">size</a>));
<a name="l00414"></a>00414     fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#a3fa99dfac99663d5448d74594120521">startCluster</a> = <a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(<span class="keyword">sizeof</span>(fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#a3fa99dfac99663d5448d74594120521">startCluster</a>));
<a name="l00415"></a>00415     fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#76defc9430363558ce5a96f72fa7b1d4">attributes</a> = <a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(<span class="keyword">sizeof</span>(fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#76defc9430363558ce5a96f72fa7b1d4">attributes</a>));
<a name="l00416"></a>00416     fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#1eccf5ffd0b1a3479e0e630373cff5af">permissions</a> = <a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(<span class="keyword">sizeof</span>(fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#1eccf5ffd0b1a3479e0e630373cff5af">permissions</a>));
<a name="l00417"></a>00417 
<a name="l00418"></a>00418     *fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#81d33d36c4163308906d9a48ea0f9eab">size</a> = 0x4000;
<a name="l00419"></a>00419     *fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#a3fa99dfac99663d5448d74594120521">startCluster</a> = fsInfo-&gt;<a class="code" href="structubixFSInfo.html#8c58076e25df4115ed42bebce08d5181">rootDir</a>;
<a name="l00420"></a>00420     
<a name="l00421"></a>00421     <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#42813fa0cdcca6ca1e6772bd20a9c321">info</a>);
<a name="l00422"></a>00422     <span class="comment">/* Read root dir in from disk it is always 0x4000 bytes long */</span>
<a name="l00423"></a>00423     mp-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#6caf84418059d0121e76d873e305ddcb">read</a>(mp-&gt;<a class="code" href="structvfs__mountPoint.html#5683a99774aaf81116e1765eb2509df5">device</a>-&gt;<a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-&gt;<a class="code" href="structdevice__interface.html#eacb2f431b14ddd1e9fe34db278dfc9e">info</a>,
<a name="l00424"></a>00424                               fsInfo-&gt;<a class="code" href="structubixFSInfo.html#6f64ea0bc1a21fca92dde6228bb194fc">dirCache</a>-&gt;<a class="code" href="structcacheNode.html#42813fa0cdcca6ca1e6772bd20a9c321">info</a>,
<a name="l00425"></a>00425                               (mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[mp-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pOffset+fsInfo-&gt;<a class="code" href="structubixFSInfo.html#03867f147dbbdf3c1d6cdd16a7a33097">blockAllocationTable</a>[fsInfo-&gt;<a class="code" href="structubixFSInfo.html#8c58076e25df4115ed42bebce08d5181">rootDir</a>].realSector),
<a name="l00426"></a>00426                               0x4000 / 512);
<a name="l00427"></a>00427 
<a name="l00428"></a>00428     <span class="comment">/* Start our ubixfs_thread to manage the mount point */</span>
<a name="l00429"></a>00429     <span class="comment">/*</span>
<a name="l00430"></a>00430 <span class="comment">    UBU disable for now</span>
<a name="l00431"></a>00431 <span class="comment">    execThread(ubixfs_Thread,(uInt32)(kmalloc(0x2000)+0x2000),0x0);</span>
<a name="l00432"></a>00432 <span class="comment">    */</span>
<a name="l00433"></a>00433     <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"  Offset: [%i], Partition: [%i]\n"</span>,
<a name="l00434"></a>00434     mp-&gt;<a class="code" href="structvfs__mountPoint.html#e5ddbb2d1c7a01716a481bc5462d6c8f">diskLabel</a>-&gt;<a class="code" href="structubixDiskLabel.html#a97973cf7f0b67811080656e11c6385f">partitions</a>[mp-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>].pOffset,mp-&gt;<a class="code" href="structvfs__mountPoint.html#26cf95c23f79647d61dc6396bbeb94a6">partition</a>);
<a name="l00435"></a>00435     <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"UbixFS Initialized\n"</span>);
<a name="l00436"></a>00436     <span class="keywordflow">return</span>(0<a class="code" href="ap-boot_8S.html#1a3ac2137e21f6f0d400f1996914dd19">x1</a>);
<a name="l00437"></a>00437     }
<a name="l00438"></a>00438     
<a name="l00439"></a>00439   <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"Not a valid UbixFS disk.\n"</span>);
<a name="l00440"></a>00440   <span class="comment">/* Return */</span>
<a name="l00441"></a>00441   <span class="keywordflow">return</span>(0x0);
<a name="l00442"></a>00442   }
<a name="l00443"></a>00443   
<a name="l00444"></a>00444 <span class="comment">/*****************************************************************************************</span>
<a name="l00445"></a>00445 <span class="comment"></span>
<a name="l00446"></a>00446 <span class="comment">Function: int ubixfs_init()</span>
<a name="l00447"></a>00447 <span class="comment"></span>
<a name="l00448"></a>00448 <span class="comment">Description: This is the master initialization for the Ubix File System it will make the</span>
<a name="l00449"></a>00449 <span class="comment">             OS UbixFS aware.</span>
<a name="l00450"></a>00450 <span class="comment">             It does not in any way shape or form connect a mount point an medium that is</span>
<a name="l00451"></a>00451 <span class="comment">             upto the ubixfs_initialize() function</span>
<a name="l00452"></a>00452 <span class="comment"></span>
<a name="l00453"></a>00453 <span class="comment">Notes:</span>
<a name="l00454"></a>00454 <span class="comment"></span>
<a name="l00455"></a>00455 <span class="comment">*****************************************************************************************/</span>  
<a name="l00456"></a><a class="code" href="ubixfs_8c.html#1d4159e0eb816b6b23c214d7c601dcb4">00456</a> <span class="keywordtype">int</span> <a class="code" href="ubixfs_8h.html#1d4159e0eb816b6b23c214d7c601dcb4">ubixfs_init</a>() {
<a name="l00457"></a>00457   <span class="comment">/* Set up our file system structure */</span>
<a name="l00458"></a>00458   <span class="keyword">struct </span><a class="code" href="structfileSystem.html">fileSystem</a> ubixFileSystem = 
<a name="l00459"></a>00459    {<a class="code" href="types_8h.html#070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>,                         <span class="comment">/* prev        */</span>
<a name="l00460"></a>00460     <a class="code" href="types_8h.html#070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>,                         <span class="comment">/* next        */</span>
<a name="l00461"></a>00461     (<span class="keywordtype">void</span> *)<a class="code" href="ubixfs_8h.html#2c53ad6e6ce2e149eec9b5361dd10eda">ubixfs_initialize</a>,    <span class="comment">/* vfsInitFS   */</span>
<a name="l00462"></a>00462     (<span class="keywordtype">void</span> *)<a class="code" href="ubixfs_8h.html#3882cc85dc373eba13315dfb0da4c578">readUbixFS</a>,           <span class="comment">/* vfsRead     */</span>
<a name="l00463"></a>00463     (<span class="keywordtype">void</span> *)<a class="code" href="ubixfs_8h.html#ba0435c266346dd10ac3cbc68655b20c">writeUbixFS</a>,          <span class="comment">/* vfsWrite    */</span>
<a name="l00464"></a>00464     (<span class="keywordtype">void</span> *)<a class="code" href="ubixfs_8c.html#0ab17f87a44bc7bb7ee3c76262f80e94">openFileUbixFS</a>,       <span class="comment">/* vfsOpenFile */</span>
<a name="l00465"></a>00465     (<span class="keywordtype">void</span> *)<a class="code" href="ubixfs_8h.html#dfbafb62e063e24f4df09029862ba9d0">ubixFSUnlink</a>,         <span class="comment">/* vfsUnlink   */</span>
<a name="l00466"></a>00466     (<span class="keywordtype">void</span> *)<a class="code" href="ubixfs_8h.html#a3a7f1d4d6f7d2477798e933acf2cb3f">ubixFSmkDir</a>,          <span class="comment">/* vfsMakeDir  */</span>
<a name="l00467"></a>00467     NULL,                         <span class="comment">/* vfsRemDir   */</span>
<a name="l00468"></a>00468     NULL,                         <span class="comment">/* vfsSync     */</span>
<a name="l00469"></a>00469     0                             <span class="comment">/* vfsType     */</span>
<a name="l00470"></a>00470    }; <span class="comment">/* ubixFileSystem */</span>
<a name="l00471"></a>00471 
<a name="l00472"></a>00472   <span class="comment">/* Add UbixFS */</span>
<a name="l00473"></a>00473   <span class="keywordflow">if</span> (<a class="code" href="vfs_8h.html#8652b1ccbcf7d2a872c5781640f7d59a">vfsRegisterFS</a>(ubixFileSystem) != 0x0) {
<a name="l00474"></a>00474     <a class="code" href="kpanic_8h.html#db9a182aa071791a306163d50d653deb">kpanic</a>(<span class="stringliteral">"Unable To Enable UbixFS"</span>);
<a name="l00475"></a>00475     <span class="keywordflow">return</span>(0<a class="code" href="ap-boot_8S.html#1a3ac2137e21f6f0d400f1996914dd19">x1</a>);
<a name="l00476"></a>00476     }
<a name="l00477"></a>00477 
<a name="l00478"></a>00478   <span class="comment">/* Return */</span>
<a name="l00479"></a>00479   <span class="keywordflow">return</span>(0x0);
<a name="l00480"></a>00480   }
<a name="l00481"></a>00481 
<a name="l00482"></a>00482 <span class="comment">/***</span>
<a name="l00483"></a>00483 <span class="comment"> $Log: ubixfs_8c-source.html,v $
<a name="l00483"></a>00483 <span class="comment"> Revision 1.7  2006/12/15 17:47:08  reddawg
<a name="l00483"></a>00483 <span class="comment"> Updates
<a name="l00483"></a>00483 <span class="comment"></span>
<a name="l00484"></a>00484 <span class="comment"> Revision 1.2  2006/12/05 14:10:21  reddawg</span>
<a name="l00485"></a>00485 <span class="comment"> Workign Distro</span>
<a name="l00486"></a>00486 <span class="comment"></span>
<a name="l00487"></a>00487 <span class="comment"> Revision 1.1.1.1  2006/06/01 12:46:17  reddawg</span>
<a name="l00488"></a>00488 <span class="comment"> ubix2</span>
<a name="l00489"></a>00489 <span class="comment"></span>
<a name="l00490"></a>00490 <span class="comment"> Revision 1.2  2005/10/12 00:13:37  reddawg</span>
<a name="l00491"></a>00491 <span class="comment"> Removed</span>
<a name="l00492"></a>00492 <span class="comment"></span>
<a name="l00493"></a>00493 <span class="comment"> Revision 1.1.1.1  2005/09/26 17:24:42  reddawg</span>
<a name="l00494"></a>00494 <span class="comment"> no message</span>
<a name="l00495"></a>00495 <span class="comment"></span>
<a name="l00496"></a>00496 <span class="comment"> Revision 1.44  2004/08/26 22:51:19  reddawg</span>
<a name="l00497"></a>00497 <span class="comment"> TCA touched me :( i think he likes men....</span>
<a name="l00498"></a>00498 <span class="comment"></span>
<a name="l00499"></a>00499 <span class="comment"></span>
<a name="l00500"></a>00500 <span class="comment"> sched.h:        kTask_t added parentPid</span>
<a name="l00501"></a>00501 <span class="comment"> endtask.c:     fixed term back to parentPid</span>
<a name="l00502"></a>00502 <span class="comment"> exec.c:          cleaned warnings</span>
<a name="l00503"></a>00503 <span class="comment"> fork.c:            fixed term to childPid</span>
<a name="l00504"></a>00504 <span class="comment"> sched.c:         clean up for dead tasks</span>
<a name="l00505"></a>00505 <span class="comment"> systemtask.c: clean up dead tasks</span>
<a name="l00506"></a>00506 <span class="comment"> kmalloc.c:       cleaned up warnings</span>
<a name="l00507"></a>00507 <span class="comment"> udp.c:            cleaned up warnings</span>
<a name="l00508"></a>00508 <span class="comment"> bot.c:             cleaned up warnings</span>
<a name="l00509"></a>00509 <span class="comment"> shell.c:           cleaned up warnings</span>
<a name="l00510"></a>00510 <span class="comment"> tcpdump.c:     took a dump</span>
<a name="l00511"></a>00511 <span class="comment"> hd.c:             cleaned up warnings</span>
<a name="l00512"></a>00512 <span class="comment"> ubixfs.c:        stopped prning debug info</span>
<a name="l00513"></a>00513 <span class="comment"></span>
<a name="l00514"></a>00514 <span class="comment"> Revision 1.43  2004/08/14 11:23:02  reddawg</span>
<a name="l00515"></a>00515 <span class="comment"> Changes</span>
<a name="l00516"></a>00516 <span class="comment"></span>
<a name="l00517"></a>00517 <span class="comment"> Revision 1.42  2004/08/09 12:58:05  reddawg</span>
<a name="l00518"></a>00518 <span class="comment"> let me know when you got the surce</span>
<a name="l00519"></a>00519 <span class="comment"></span>
<a name="l00520"></a>00520 <span class="comment"> Revision 1.41  2004/08/01 17:58:39  flameshadow</span>
<a name="l00521"></a>00521 <span class="comment"> chg: fixed string allocation bug in ubixfs_cacheNew()</span>
<a name="l00522"></a>00522 <span class="comment"></span>
<a name="l00523"></a>00523 <span class="comment"> Revision 1.40  2004/07/28 17:07:29  flameshadow</span>
<a name="l00524"></a>00524 <span class="comment"> chg: re-added moving cached nodes to the front of the list when found</span>
<a name="l00525"></a>00525 <span class="comment"> add: added an assert() in ubixfs.c</span>
<a name="l00526"></a>00526 <span class="comment"></span>
<a name="l00527"></a>00527 <span class="comment"> Revision 1.39  2004/07/27 19:24:31  flameshadow</span>
<a name="l00528"></a>00528 <span class="comment"> chg: reduced the number of debugging statements in the kernel.</span>
<a name="l00529"></a>00529 <span class="comment"></span>
<a name="l00530"></a>00530 <span class="comment"> Revision 1.38  2004/07/27 12:02:01  reddawg</span>
<a name="l00531"></a>00531 <span class="comment"> chg: fixed marks bug readFile did a lookup which is why it looked like it was loopping so much</span>
<a name="l00532"></a>00532 <span class="comment"></span>
<a name="l00533"></a>00533 <span class="comment"> Revision 1.37  2004/07/27 09:05:43  flameshadow</span>
<a name="l00534"></a>00534 <span class="comment"> chg: fixed file not found bug. Still can't find looping issue</span>
<a name="l00535"></a>00535 <span class="comment"></span>
<a name="l00536"></a>00536 <span class="comment"> Revision 1.36  2004/07/27 04:05:20  flameshadow</span>
<a name="l00537"></a>00537 <span class="comment"> chg: kinda fixed it. Added bunches of debug info</span>
<a name="l00538"></a>00538 <span class="comment"></span>
<a name="l00539"></a>00539 <span class="comment"> Revision 1.35  2004/07/26 19:15:49  reddawg</span>
<a name="l00540"></a>00540 <span class="comment"> test code, fixes and the like</span>
<a name="l00541"></a>00541 <span class="comment"></span>
<a name="l00542"></a>00542 <span class="comment"> Revision 1.34  2004/07/24 23:04:44  reddawg</span>
<a name="l00543"></a>00543 <span class="comment"> Changes... mark let me know if you fault at pid 185 when you type stress</span>
<a name="l00544"></a>00544 <span class="comment"></span>
<a name="l00545"></a>00545 <span class="comment"> Revision 1.33  2004/07/23 09:10:06  reddawg</span>
<a name="l00546"></a>00546 <span class="comment"> ubixfs: cleaned up some functions played with the caching a bit</span>
<a name="l00547"></a>00547 <span class="comment"> vfs:    renamed a bunch of functions</span>
<a name="l00548"></a>00548 <span class="comment"> cleaned up a few misc bugs</span>
<a name="l00549"></a>00549 <span class="comment"></span>
<a name="l00550"></a>00550 <span class="comment"> Revision 1.32  2004/07/22 23:01:51  reddawg</span>
<a name="l00551"></a>00551 <span class="comment"> Ok checking in before I sleep</span>
<a name="l00552"></a>00552 <span class="comment"></span>
<a name="l00553"></a>00553 <span class="comment"> Revision 1.31  2004/07/22 22:37:03  reddawg</span>
<a name="l00554"></a>00554 <span class="comment"> Caching is working now the FS is extremely fast but needs to be optimized to do 32bit copies over 8bit</span>
<a name="l00555"></a>00555 <span class="comment"></span>
<a name="l00556"></a>00556 <span class="comment"> Revision 1.30  2004/07/22 19:01:59  flameshadow</span>
<a name="l00557"></a>00557 <span class="comment"> chg: more directory and file caching</span>
<a name="l00558"></a>00558 <span class="comment"></span>
<a name="l00559"></a>00559 <span class="comment"> Revision 1.29  2004/07/22 16:34:32  flameshadow</span>
<a name="l00560"></a>00560 <span class="comment"> add: file and dir caching kinda work</span>
<a name="l00561"></a>00561 <span class="comment"></span>
<a name="l00562"></a>00562 <span class="comment"> Revision 1.28  2004/07/21 22:07:18  flameshadow</span>
<a name="l00563"></a>00563 <span class="comment"> chg: renamed caching functions (again)</span>
<a name="l00564"></a>00564 <span class="comment"></span>
<a name="l00565"></a>00565 <span class="comment"> Revision 1.27  2004/07/21 21:08:05  flameshadow</span>
<a name="l00566"></a>00566 <span class="comment"> add: added provisions for file caching</span>
<a name="l00567"></a>00567 <span class="comment"></span>
<a name="l00568"></a>00568 <span class="comment"> Revision 1.26  2004/07/20 23:21:31  flameshadow</span>
<a name="l00569"></a>00569 <span class="comment"> syncing</span>
<a name="l00570"></a>00570 <span class="comment"></span>
<a name="l00571"></a>00571 <span class="comment"> Revision 1.25  2004/07/20 21:39:53  reddawg</span>
<a name="l00572"></a>00572 <span class="comment"> ubixfs: does propper caching now problem was you did not seek realSector however the os starts but I am getting a segfault could be from anything haven't looked into it right quick</span>
<a name="l00573"></a>00573 <span class="comment"></span>
<a name="l00574"></a>00574 <span class="comment"> Revision 1.24  2004/07/20 21:38:08  flameshadow</span>
<a name="l00575"></a>00575 <span class="comment"> try now</span>
<a name="l00576"></a>00576 <span class="comment"></span>
<a name="l00577"></a>00577 <span class="comment"></span>
<a name="l00578"></a>00578 <span class="comment"> Revision 1.23  2004/07/20 21:35:09  reddawg</span>
<a name="l00579"></a>00579 <span class="comment"> Let me commit before we start to overlap</span>
<a name="l00580"></a>00580 <span class="comment"></span>
<a name="l00581"></a>00581 <span class="comment"> Revision 1.22  2004/07/20 21:28:16  flameshadow</span>
<a name="l00582"></a>00582 <span class="comment"> oops</span>
<a name="l00583"></a>00583 <span class="comment"></span>
<a name="l00584"></a>00584 <span class="comment"> Revision 1.20  2004/07/20 19:36:49  reddawg</span>
<a name="l00585"></a>00585 <span class="comment"> UBU Tags</span>
<a name="l00586"></a>00586 <span class="comment"></span>
<a name="l00587"></a>00587 <span class="comment"> Revision 1.19  2004/07/20 18:09:37  flameshadow</span>
<a name="l00588"></a>00588 <span class="comment"> add: directory caching related stuff</span>
<a name="l00589"></a>00589 <span class="comment"></span>
<a name="l00590"></a>00590 <span class="comment"> Revision 1.18  2004/07/17 03:21:34  flameshadow</span>
<a name="l00591"></a>00591 <span class="comment"> chg: cleaned up code; added assert() statements</span>
<a name="l00592"></a>00592 <span class="comment"></span>
<a name="l00593"></a>00593 <span class="comment"> Revision 1.15  2004/07/14 12:21:49  reddawg</span>
<a name="l00594"></a>00594 <span class="comment"> ubixfs: enableUbixFs to ubixfs_init</span>
<a name="l00595"></a>00595 <span class="comment"> Changed Startup Routines</span>
<a name="l00596"></a>00596 <span class="comment"></span>
<a name="l00597"></a>00597 <span class="comment"> Revision 1.14  2004/06/28 23:12:58  reddawg</span>
<a name="l00598"></a>00598 <span class="comment"> file format now container:/path/to/file</span>
<a name="l00599"></a>00599 <span class="comment"></span>
<a name="l00600"></a>00600 <span class="comment"> Revision 1.13  2004/06/28 18:12:44  reddawg</span>
<a name="l00601"></a>00601 <span class="comment"> We need these files</span>
<a name="l00602"></a>00602 <span class="comment"></span>
<a name="l00603"></a>00603 <span class="comment"> Revision 1.12  2004/06/28 11:57:58  reddawg</span>
<a name="l00604"></a>00604 <span class="comment"> Fixing Up Filesystem</span>
<a name="l00605"></a>00605 <span class="comment"></span>
<a name="l00606"></a>00606 <span class="comment"> Revision 1.10  2004/06/04 13:20:22  reddawg</span>
<a name="l00607"></a>00607 <span class="comment"> ubixFSmkDir(): played with it a bit to see if it still worked</span>
<a name="l00608"></a>00608 <span class="comment"></span>
<a name="l00609"></a>00609 <span class="comment"> Revision 1.9  2004/06/04 10:19:42  reddawg</span>
<a name="l00610"></a>00610 <span class="comment"> notes: we compile again, thank g-d anyways i was about to cry</span>
<a name="l00611"></a>00611 <span class="comment"></span>
<a name="l00612"></a>00612 <span class="comment"> Revision 1.8  2004/06/01 00:04:53  reddawg</span>
<a name="l00613"></a>00613 <span class="comment"> Try now mark</span>
<a name="l00614"></a>00614 <span class="comment"></span>
<a name="l00615"></a>00615 <span class="comment"> Revision 1.7  2004/05/19 15:20:06  reddawg</span>
<a name="l00616"></a>00616 <span class="comment"> Fixed reference problems due to changes in drive subsystem</span>
<a name="l00617"></a>00617 <span class="comment"></span>
<a name="l00618"></a>00618 <span class="comment"> Revision 1.6  2004/05/19 04:07:43  reddawg</span>
<a name="l00619"></a>00619 <span class="comment"> kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been</span>
<a name="l00620"></a>00620 <span class="comment"></span>
<a name="l00621"></a>00621 <span class="comment"> Revision 1.5  2004/04/29 15:45:19  reddawg</span>
<a name="l00622"></a>00622 <span class="comment"> Fixed some bugs so now the automade images will work correctly</span>
<a name="l00623"></a>00623 <span class="comment"></span>
<a name="l00624"></a>00624 <span class="comment"> Revision 1.4  2004/04/28 21:10:40  reddawg</span>
<a name="l00625"></a>00625 <span class="comment"> Lots Of changes to make it work with existing os</span>
<a name="l00626"></a>00626 <span class="comment"></span>
<a name="l00627"></a>00627 <span class="comment"> Revision 1.3  2004/04/28 13:33:09  reddawg</span>
<a name="l00628"></a>00628 <span class="comment"> Overhaul to ubixfs and boot loader and MBR to work well with our schema</span>
<a name="l00629"></a>00629 <span class="comment"> now BAT and dir and file entries are all offset 64Sectors from the start of the partition</span>
<a name="l00630"></a>00630 <span class="comment"></span>
<a name="l00631"></a>00631 <span class="comment"> Revision 1.2  2004/04/28 02:22:55  reddawg</span>
<a name="l00632"></a>00632 <span class="comment"> This is a fiarly large commit but we are starting to use new driver model</span>
<a name="l00633"></a>00633 <span class="comment"> all around</span>
<a name="l00634"></a>00634 <span class="comment"></span>
<a name="l00635"></a>00635 <span class="comment"> Revision 1.1.1.1  2004/04/15 12:07:08  reddawg</span>
<a name="l00636"></a>00636 <span class="comment"> UbixOS v1.0</span>
<a name="l00637"></a>00637 <span class="comment"></span>
<a name="l00638"></a>00638 <span class="comment"> Revision 1.31  2004/04/13 16:36:34  reddawg</span>
<a name="l00639"></a>00639 <span class="comment"> Changed our copyright, it is all now under a BSD-Style license</span>
<a name="l00640"></a>00640 <span class="comment"></span>
<a name="l00641"></a>00641 <span class="comment"> END</span>
<a name="l00642"></a>00642 <span class="comment"> ***/</span>
<a name="l00643"></a>00643 
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Dec 15 11:18:55 2006 for UbixOS V2 by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>