00001 #ifndef FS_PHATVOL_H_ 00002 #define FS_PHATVOL_H_ 00003 00004 /* 00005 * Copyright (C) 2005 by egnite Software GmbH. All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * 1. Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 2. Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the distribution. 00016 * 3. Neither the name of the copyright holders nor the names of 00017 * contributors may be used to endorse or promote products derived 00018 * from this software without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS 00021 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00022 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00023 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE 00024 * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00025 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00026 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 00027 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00028 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00029 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00030 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00031 * SUCH DAMAGE. 00032 * 00033 * For additional information see http://www.ethernut.de/ 00034 */ 00035 00065 #include <cfg/fs.h> 00066 00067 #include <sys/types.h> 00068 #include <sys/file.h> 00069 #include <sys/device.h> 00070 00075 00079 typedef struct __attribute__ ((packed)) _PHATVBR { 00081 uint8_t boot_jump[3]; 00083 uint8_t boot_oem[8]; 00088 uint16_t bios_sectsz; 00090 uint8_t bios_clustsz; 00096 uint16_t bios_rsvd_sects; 00098 uint8_t bios_ntabs; 00100 uint16_t bios_rootsz; 00102 uint16_t bios_volsz; 00104 uint8_t bios_media; 00109 uint16_t bios_tabsz; 00111 uint16_t bios_sects_p_trk; 00113 uint16_t bios_heads; 00118 uint32_t bios_sects_hidd; 00123 uint32_t bios_volsz_big; 00124 00129 uint32_t bios_tabsz_big; 00136 uint16_t bios_xflags; 00138 uint16_t bios_fsver; 00140 uint32_t bios_root_clust; 00142 uint16_t bios_fsinfo; 00144 uint16_t bios_boot_bak; 00149 uint8_t bios_rsvd32[12]; 00150 00156 uint8_t boot_drive; 00158 uint8_t boot_rsvd_nt; 00163 uint8_t boot_xsig; 00165 uint32_t boot_vol_id; 00167 uint8_t boot_vol_lbl[11]; 00169 uint8_t boot_vol_fs[8]; 00170 } PHATVBR; 00171 00175 typedef struct _PHATSECTBUF { 00177 uint8_t *sect_data; 00179 uint32_t sect_num; 00181 int sect_dirty; 00182 } PHATSECTBUF; 00183 00187 typedef struct _PHATVOL { 00192 int vol_type; 00194 uint32_t vol_numfree; 00196 uint32_t vol_nxtfree; 00198 #if PHAT_SECTOR_BUFFERS 00199 PHATSECTBUF vol_buf[PHAT_SECTOR_BUFFERS]; 00201 int vol_usenext; 00202 #else 00203 PHATSECTBUF vol_buf[1]; 00204 #endif 00205 00206 HANDLE vol_fsmutex; 00208 HANDLE vol_iomutex; 00210 u_int vol_sectsz; 00212 u_int vol_clustsz; 00213 00215 uint32_t vol_tabsz; 00220 uint32_t vol_tab_sect[2]; 00221 00223 u_int vol_rootsz; 00225 uint32_t vol_root_sect; 00227 uint32_t vol_root_clust; 00228 00234 uint32_t vol_last_clust; 00239 uint32_t vol_data_sect; 00240 } PHATVOL; 00241 00244 __BEGIN_DECLS 00245 /* Prototypes */ 00246 extern int PhatVolMount(NUTDEVICE * dev, NUTFILE * blkmnt, uint8_t part_type); 00247 extern int PhatVolUnmount(NUTDEVICE * dev); 00248 extern uint32_t PhatClusterSector(NUTFILE * nfp, uint32_t clust); 00249 00250 __END_DECLS 00251 /* End of prototypes */ 00252 #endif