Nut/OS  4.10.3
API Reference
phatdir.h
Go to the documentation of this file.
00001 #ifndef FS_PHATDIR_H_
00002 #define FS_PHATDIR_H_
00003 
00004 /*
00005  * Copyright (C) 2005-2006 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 <dirent.h>
00066 #include <sys/stat.h>
00067 
00072 
00076 #ifndef PHAT_MAX_NAMELEN
00077 #define PHAT_MAX_NAMELEN    255
00078 #endif
00079 
00080 #define PHAT_REM_DIRENT  0xE5
00081 #define PHAT_REM_NAMENT  0x05
00082 
00089 typedef struct __attribute__ ((packed)) _PHATDIRENT {
00091     uint8_t dent_name[11];
00096     uint8_t dent_attr;
00098     uint8_t dent_rsvdnt;
00100     uint8_t dent_ctsecs;
00102     uint16_t dent_ctime;
00104     uint16_t dent_cdate;
00106     uint16_t dent_adate;
00115     uint16_t dent_clusthi;
00117     uint16_t dent_mtime;
00119     uint16_t dent_mdate;
00124     uint16_t dent_clust;
00129     uint32_t dent_fsize;
00130 } PHATDIRENT;
00131 
00137 typedef struct __attribute__ ((packed)) _PHATXDIRENT {
00139     uint8_t xdent_seq;
00141     uint16_t xdent_uname_1_5[5];
00143     uint8_t xdent_attr;
00145     uint8_t xdent_rsvd;
00147     uint8_t xdent_cks;
00149     uint16_t xdent_uname_6_11[6];
00151     uint16_t xdent_clust;
00153     uint16_t xdent_uname_12_13[2];
00154 } PHATXDIRENT;
00155 
00156 typedef struct _PHATFIND {
00157     PHATDIRENT phfind_ent;
00158     uint32_t phfind_pos;
00160     int phfind_xcnt;
00161     char phfind_name[PHAT_MAX_NAMELEN];
00162 } PHATFIND;
00163 
00166 __BEGIN_DECLS
00167 /* Prototypes */
00168 extern int PhatDirEntryCreate(NUTFILE * ndp, CONST char *name, int acc, PHATDIRENT * dirent);
00169 
00170 extern int PhatDirEntryUpdate(NUTFILE * ndp);
00171 
00172 extern int PhatDirReleaseChain(NUTDEVICE * dev, PHATDIRENT * dent);
00173 
00174 extern int PhatDirDelEntry(NUTDEVICE * dev, CONST char *path, uint32_t flags);
00175 extern int PhatDirRenameEntry(NUTDEVICE * dev, CONST char *old_path, CONST char *new_path);
00176 
00177 extern NUTFILE *PhatDirOpen(NUTDEVICE * dev, CONST char *dpath);
00178 extern NUTFILE *PhatDirOpenParent(NUTDEVICE * dev, CONST char *path, CONST char **basename);
00179 extern int PhatDirEntryFind(NUTFILE * nfp, CONST char *spec, uint32_t flags, PHATFIND * srch);
00180 extern int PhatDirRead(DIR * dir);
00181 
00182 extern int PhatDirCreate(NUTDEVICE * dev, char *path);
00183 extern int PhatDirRemove(NUTDEVICE * dev, char *path);
00184 
00185 extern int PhatDirEntryStatus(NUTDEVICE * dev, CONST char *path, struct stat *s);
00186 
00187 __END_DECLS
00188 /* End of prototypes */
00189 #endif