<!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/devfs/devfs.c File Reference</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 Page</span></a></li> <li><a href="classes.html"><span>Data 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> <u>S</u>earch for </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 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> » <a class="el" href="dir_832905b1f7f5feaf61a306b40c0ac817.html">sys</a> » <a class="el" href="dir_0af38c139db535004c17f658eecde1eb.html">devfs</a></div> <h1>devfs.c File Reference</h1><code>#include <<a class="el" href="devfs_8h-source.html">devfs/devfs.h</a>></code><br> <code>#include <<a class="el" href="vfs_8h-source.html">vfs/vfs.h</a>></code><br> <code>#include <<a class="el" href="device_8h-source.html">sys/device.h</a>></code><br> <code>#include <<a class="el" href="types_8h-source.html">ubixos/types.h</a>></code><br> <code>#include <<a class="el" href="spinlock_8h-source.html">ubixos/spinlock.h</a>></code><br> <code>#include <<a class="el" href="kpanic_8h-source.html">ubixos/kpanic.h</a>></code><br> <code>#include <<a class="el" href="kmalloc_8h-source.html">lib/kmalloc.h</a>></code><br> <code>#include <<a class="el" href="lib_2string_8h-source.html">lib/string.h</a>></code><br> <code>#include <<a class="el" href="kprintf_8h-source.html">lib/kprintf.h</a>></code><br> <p> <a href="devfs_8c-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="devfs_8c.html#c74c840a034d38b197e93bf883001d0d">devfs_init</a> ()</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="devfs_8c.html#7b312bcbbf9c2386ec31ccc73f1c3c63">devfs_initialize</a> (struct <a class="el" href="structvfs__mountPoint.html">vfs_mountPoint</a> *mp)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="devfs_8c.html#d568bae84bef3691539f1b1d0f6a54b4">devfs_makeNode</a> (char *<a class="el" href="pci_8c.html#8f8f80d37794cde9472343e4487ba3eb">name</a>, <a class="el" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> type, <a class="el" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> major, <a class="el" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> minor)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="devfs_8c.html#acec49d86336bd84c9feb9dea354381c">devfs_open</a> (char *<a class="el" href="structfile.html">file</a>, <a class="el" href="structfileDescriptorStruct.html">fileDescriptor</a> *fd)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="devfs_8c.html#c6b73190c80703169760a556abafab22">devfs_read</a> (<a class="el" href="structfileDescriptorStruct.html">fileDescriptor</a> *fd, char *data, long offset, long size)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="devfs_8c.html#ee16012227e22291c72d6f74258bb8a9">devfs_write</a> (<a class="el" href="structfileDescriptorStruct.html">fileDescriptor</a> *fd, char *data, long offset, long size)</td></tr> <tr><td colspan="2"><br><h2>Variables</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="devfs_8c.html#2858b8792372c6b992e3727e49fe0a8c">devfs_len</a> = 0x0</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="spinlock_8h.html#a240e9404b4ede1e0d714610080d1176">spinLock_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="devfs_8c.html#0b9ed1fd2d4151d3e7e76f3a584e9b27">devfsSpinLock</a> = SPIN_LOCK_INITIALIZER</td></tr> </table> <hr><h2>Function Documentation</h2> <a class="anchor" name="c74c840a034d38b197e93bf883001d0d"></a><!-- doxytag: member="devfs.c::devfs_init" ref="c74c840a034d38b197e93bf883001d0d" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int devfs_init </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> <p> Definition at line <a class="el" href="devfs_8c-source.html#l00215">215</a> of file <a class="el" href="devfs_8c-source.html">devfs.c</a>. <p> References <a class="el" href="devfs_8c-source.html#l00050">devfs_initialize()</a>, <a class="el" href="devfs_8c-source.html#l00071">devfs_open()</a>, <a class="el" href="devfs_8c-source.html#l00114">devfs_read()</a>, <a class="el" href="devfs_8c-source.html#l00160">devfs_write()</a>, <a class="el" href="def_8h-source.html#l00041">NULL</a>, <a class="el" href="mount_8c-source.html#l00047">vfs_mount()</a>, <a class="el" href="vfs_8c-source.html#l00081">vfsRegisterFS()</a>, and <a class="el" href="ap-boot_8S-source.html#l00006">x1</a>. </div> </div><p> <a class="anchor" name="7b312bcbbf9c2386ec31ccc73f1c3c63"></a><!-- doxytag: member="devfs.c::devfs_initialize" ref="7b312bcbbf9c2386ec31ccc73f1c3c63" args="(struct vfs_mountPoint *mp)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void devfs_initialize </td> <td>(</td> <td class="paramtype">struct <a class="el" href="structvfs__mountPoint.html">vfs_mountPoint</a> * </td> <td class="paramname"> <em>mp</em> </td> <td> ) </td> <td width="100%"><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p> This is the initialized called by the vfs system when enabling devfs basically it allocates memory for the devfs module <p> Definition at line <a class="el" href="devfs_8c-source.html#l00050">50</a> of file <a class="el" href="devfs_8c-source.html">devfs.c</a>. <p> References <a class="el" href="devfs_8h-source.html#l00046">devfs_info::deviceList</a>, <a class="el" href="mount_8h-source.html#l00042">vfs_mountPoint::fsInfo</a>, <a class="el" href="kpanic_8h-source.html#l00033">K_PANIC</a>, and <a class="el" href="kmalloc_8c-source.html#l00247">kmalloc()</a>. <p> Referenced by <a class="el" href="devfs_8c-source.html#l00215">devfs_init()</a>. </div> </div><p> <a class="anchor" name="d568bae84bef3691539f1b1d0f6a54b4"></a><!-- doxytag: member="devfs.c::devfs_makeNode" ref="d568bae84bef3691539f1b1d0f6a54b4" args="(char *name, uInt8 type, uInt16 major, uInt16 minor)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int devfs_makeNode </td> <td>(</td> <td class="paramtype">char * </td> <td class="paramname"> <em>name</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> </td> <td class="paramname"> <em>type</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> </td> <td class="paramname"> <em>major</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> </td> <td class="paramname"> <em>minor</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> <p> Definition at line <a class="el" href="devfs_8c-source.html#l00178">178</a> of file <a class="el" href="devfs_8c-source.html">devfs.c</a>. <p> References <a class="el" href="devfs_8c-source.html#l00044">devfs_len</a>, <a class="el" href="devfs_8c-source.html#l00041">devfsSpinLock</a>, <a class="el" href="devfs_8h-source.html#l00046">devfs_info::deviceList</a>, <a class="el" href="devfs_8h-source.html#l00040">devfs_devices::devMajor</a>, <a class="el" href="devfs_8h-source.html#l00041">devfs_devices::devMinor</a>, <a class="el" href="devfs_8h-source.html#l00042">devfs_devices::devName</a>, <a class="el" href="devfs_8h-source.html#l00039">devfs_devices::devType</a>, <a class="el" href="mount_8h-source.html#l00042">vfs_mountPoint::fsInfo</a>, <a class="el" href="kmalloc_8c-source.html#l00247">kmalloc()</a>, <a class="el" href="kprintf_8c-source.html#l00038">kprintf()</a>, <a class="el" href="devfs_8h-source.html#l00037">devfs_devices::next</a>, <a class="el" href="devfs_8h-source.html#l00038">devfs_devices::prev</a>, <a class="el" href="spinlock_8c-source.html#l00056">spinLock()</a>, <a class="el" href="spinlock_8c-source.html#l00037">spinUnlock()</a>, <a class="el" href="kprintf_8c-source.html#l00051">sprintf()</a>, <a class="el" href="strlen_8S-source.html#l00004">strlen</a>, and <a class="el" href="mount_8c-source.html#l00132">vfs_findMount()</a>. <p> Referenced by <a class="el" href="fdc_8c-source.html#l00063">fdc_init()</a>, and <a class="el" href="hd_8c-source.html#l00039">initHardDisk()</a>. </div> </div><p> <a class="anchor" name="acec49d86336bd84c9feb9dea354381c"></a><!-- doxytag: member="devfs.c::devfs_open" ref="acec49d86336bd84c9feb9dea354381c" args="(char *file, fileDescriptor *fd)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int devfs_open </td> <td>(</td> <td class="paramtype">char * </td> <td class="paramname"> <em>file</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structfileDescriptorStruct.html">fileDescriptor</a> * </td> <td class="paramname"> <em>fd</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p> This is the open routine called by the vfs when a fopen or open is called within the user or kernel space file - this is the file node fd - this is the file descriptor<p> This format will be changing down the road <p> Definition at line <a class="el" href="devfs_8c-source.html#l00071">71</a> of file <a class="el" href="devfs_8c-source.html">devfs.c</a>. <p> References <a class="el" href="devfs_8c-source.html#l00044">devfs_len</a>, <a class="el" href="devfs_8c-source.html#l00041">devfsSpinLock</a>, <a class="el" href="device_8c-source.html#l00086">device_find()</a>, <a class="el" href="devfs_8h-source.html#l00046">devfs_info::deviceList</a>, <a class="el" href="device_8h-source.html#l00038">device_node::devInfo</a>, <a class="el" href="devfs_8h-source.html#l00040">devfs_devices::devMajor</a>, <a class="el" href="devfs_8h-source.html#l00041">devfs_devices::devMinor</a>, <a class="el" href="devfs_8h-source.html#l00042">devfs_devices::devName</a>, <a class="el" href="mount_8h-source.html#l00042">vfs_mountPoint::fsInfo</a>, <a class="el" href="kprintf_8c-source.html#l00038">kprintf()</a>, <a class="el" href="file_8h-source.html#l00051">fileDescriptorStruct::mode</a>, <a class="el" href="file_8h-source.html#l00049">fileDescriptorStruct::mp</a>, <a class="el" href="devfs_8h-source.html#l00037">devfs_devices::next</a>, <a class="el" href="device_8h-source.html#l00050">device_interface::size</a>, <a class="el" href="file_8h-source.html#l00053">fileDescriptorStruct::size</a>, <a class="el" href="spinlock_8c-source.html#l00056">spinLock()</a>, <a class="el" href="spinlock_8c-source.html#l00037">spinUnlock()</a>, <a class="el" href="file_8h-source.html#l00055">fileDescriptorStruct::start</a>, <a class="el" href="string_8c-source.html#l00032">strcmp()</a>, and <a class="el" href="ap-boot_8S-source.html#l00006">x1</a>. <p> Referenced by <a class="el" href="devfs_8c-source.html#l00215">devfs_init()</a>. </div> </div><p> <a class="anchor" name="c6b73190c80703169760a556abafab22"></a><!-- doxytag: member="devfs.c::devfs_read" ref="c6b73190c80703169760a556abafab22" args="(fileDescriptor *fd, char *data, long offset, long size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int devfs_read </td> <td>(</td> <td class="paramtype"><a class="el" href="structfileDescriptorStruct.html">fileDescriptor</a> * </td> <td class="paramname"> <em>fd</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char * </td> <td class="paramname"> <em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">long </td> <td class="paramname"> <em>offset</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">long </td> <td class="paramname"> <em>size</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Function: int readDevFS(fileDescriptor *fd,char *data,long offset,long size) Description: Read File Into Data Notes: <p> Definition at line <a class="el" href="devfs_8c-source.html#l00114">114</a> of file <a class="el" href="devfs_8c-source.html">devfs.c</a>. <p> References <a class="el" href="file_8h-source.html#l00057">fileDescriptorStruct::buffer</a>, <a class="el" href="device_8c-source.html#l00086">device_find()</a>, <a class="el" href="device_8h-source.html#l00038">device_node::devInfo</a>, <a class="el" href="devfs_8h-source.html#l00040">devfs_devices::devMajor</a>, <a class="el" href="devfs_8h-source.html#l00041">devfs_devices::devMinor</a>, <a class="el" href="device_8h-source.html#l00052">device_interface::info</a>, <a class="el" href="kprintf_8c-source.html#l00038">kprintf()</a>, <a class="el" href="structdevice__interface.html#6caf84418059d0121e76d873e305ddcb">device_interface::read</a>, and <a class="el" href="file_8h-source.html#l00055">fileDescriptorStruct::start</a>. <p> Referenced by <a class="el" href="devfs_8c-source.html#l00215">devfs_init()</a>. </div> </div><p> <a class="anchor" name="ee16012227e22291c72d6f74258bb8a9"></a><!-- doxytag: member="devfs.c::devfs_write" ref="ee16012227e22291c72d6f74258bb8a9" args="(fileDescriptor *fd, char *data, long offset, long size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int devfs_write </td> <td>(</td> <td class="paramtype"><a class="el" href="structfileDescriptorStruct.html">fileDescriptor</a> * </td> <td class="paramname"> <em>fd</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char * </td> <td class="paramname"> <em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">long </td> <td class="paramname"> <em>offset</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">long </td> <td class="paramname"> <em>size</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p> <p> Definition at line <a class="el" href="devfs_8c-source.html#l00160">160</a> of file <a class="el" href="devfs_8c-source.html">devfs.c</a>. <p> References <a class="el" href="file_8h-source.html#l00057">fileDescriptorStruct::buffer</a>, <a class="el" href="device_8c-source.html#l00086">device_find()</a>, <a class="el" href="device_8h-source.html#l00038">device_node::devInfo</a>, <a class="el" href="devfs_8h-source.html#l00040">devfs_devices::devMajor</a>, <a class="el" href="devfs_8h-source.html#l00041">devfs_devices::devMinor</a>, <a class="el" href="device_8h-source.html#l00052">device_interface::info</a>, <a class="el" href="structdevice__interface.html#6caf84418059d0121e76d873e305ddcb">device_interface::read</a>, <a class="el" href="file_8h-source.html#l00055">fileDescriptorStruct::start</a>, and <a class="el" href="structdevice__interface.html#f46913eec9f191290c82db23380bc5df">device_interface::write</a>. <p> Referenced by <a class="el" href="devfs_8c-source.html#l00215">devfs_init()</a>. </div> </div><p> <hr><h2>Variable Documentation</h2> <a class="anchor" name="2858b8792372c6b992e3727e49fe0a8c"></a><!-- doxytag: member="devfs.c::devfs_len" ref="2858b8792372c6b992e3727e49fe0a8c" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="devfs_8c.html#2858b8792372c6b992e3727e49fe0a8c">devfs_len</a> = 0x0<code> [static]</code> </td> </tr> </table> </div> <div class="memdoc"> <p> <p> Definition at line <a class="el" href="devfs_8c-source.html#l00044">44</a> of file <a class="el" href="devfs_8c-source.html">devfs.c</a>. <p> Referenced by <a class="el" href="devfs_8c-source.html#l00178">devfs_makeNode()</a>, and <a class="el" href="devfs_8c-source.html#l00071">devfs_open()</a>. </div> </div><p> <a class="anchor" name="0b9ed1fd2d4151d3e7e76f3a584e9b27"></a><!-- doxytag: member="devfs.c::devfsSpinLock" ref="0b9ed1fd2d4151d3e7e76f3a584e9b27" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="spinlock_8h.html#a240e9404b4ede1e0d714610080d1176">spinLock_t</a> <a class="el" href="devfs_8c.html#0b9ed1fd2d4151d3e7e76f3a584e9b27">devfsSpinLock</a> = SPIN_LOCK_INITIALIZER<code> [static]</code> </td> </tr> </table> </div> <div class="memdoc"> <p> <p> Definition at line <a class="el" href="devfs_8c-source.html#l00041">41</a> of file <a class="el" href="devfs_8c-source.html">devfs.c</a>. <p> Referenced by <a class="el" href="devfs_8c-source.html#l00178">devfs_makeNode()</a>, and <a class="el" href="devfs_8c-source.html#l00071">devfs_open()</a>. </div> </div><p> <hr size="1"><address style="align: right;"><small>Generated on Tue Dec 12 08:52:09 2006 for UbixOS V2 by <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>