Nut/OS  4.10.3
API Reference
phatvol.h
Go to the documentation of this file.
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 
00069 #include <cfg/fs.h>
00070 
00071 #include <sys/types.h>
00072 #include <sys/file.h>
00073 #include <sys/device.h>
00074 
00079 
00083 typedef struct __attribute__ ((packed)) _PHATVBR {
00085     uint8_t boot_jump[3];
00087     uint8_t boot_oem[8];
00092     uint16_t bios_sectsz;
00094     uint8_t bios_clustsz;
00100     uint16_t bios_rsvd_sects;
00102     uint8_t bios_ntabs;
00104     uint16_t bios_rootsz;
00106     uint16_t bios_volsz;
00108     uint8_t bios_media;
00113     uint16_t bios_tabsz;
00115     uint16_t bios_sects_p_trk;
00117     uint16_t bios_heads;
00122     uint32_t bios_sects_hidd;
00127     uint32_t bios_volsz_big;
00128 
00133     uint32_t bios_tabsz_big;
00140     uint16_t bios_xflags;
00142     uint16_t bios_fsver;
00144     uint32_t bios_root_clust;
00146     uint16_t bios_fsinfo;
00148     uint16_t bios_boot_bak;
00153     uint8_t bios_rsvd32[12];
00154 
00160     uint8_t boot_drive;
00162     uint8_t boot_rsvd_nt;
00167     uint8_t boot_xsig;
00169     uint32_t boot_vol_id;
00171     uint8_t boot_vol_lbl[11];
00173     uint8_t boot_vol_fs[8];
00174 } PHATVBR;
00175 
00179 typedef struct _PHATSECTBUF {
00181     uint8_t *sect_data;
00183     uint32_t sect_num;
00185     int sect_dirty;
00186 } PHATSECTBUF;
00187 
00191 typedef struct _PHATVOL {
00196     int vol_type;
00198     uint32_t vol_numfree;
00200     uint32_t vol_nxtfree;
00202 #if PHAT_SECTOR_BUFFERS
00203     PHATSECTBUF vol_buf[PHAT_SECTOR_BUFFERS];
00205     int vol_usenext;
00206 #else
00207     PHATSECTBUF vol_buf[1];
00208 #endif
00209 
00210     HANDLE vol_fsmutex;
00212     HANDLE vol_iomutex;
00214     unsigned int vol_sectsz;
00216     unsigned int vol_clustsz;
00217 
00219     uint32_t vol_tabsz;
00224     uint32_t vol_tab_sect[2];
00225 
00227     unsigned int vol_rootsz;
00229     uint32_t vol_root_sect;
00231     uint32_t vol_root_clust;
00232 
00238     uint32_t vol_last_clust;
00243     uint32_t vol_data_sect;
00244 } PHATVOL;
00245 
00248 __BEGIN_DECLS
00249 /* Prototypes */
00250 extern int PhatVolMount(NUTDEVICE * dev, NUTFILE * blkmnt, uint8_t part_type);
00251 extern int PhatVolUnmount(NUTDEVICE * dev);
00252 extern uint32_t PhatClusterSector(NUTFILE * nfp, uint32_t clust);
00253 
00254 __END_DECLS
00255 /* End of prototypes */
00256 #endif