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 
00062 #include <dirent.h>
00063 #include <sys/stat.h>
00064 
00069 
00073 #ifndef PHAT_MAX_NAMELEN
00074 #define PHAT_MAX_NAMELEN    255
00075 #endif
00076 
00077 #define PHAT_REM_DIRENT  0xE5
00078 #define PHAT_REM_NAMENT  0x05
00079 
00086 typedef struct __attribute__ ((packed)) _PHATDIRENT {
00088     u_char dent_name[11];
00093     u_char dent_attr;
00095     u_char dent_rsvdnt;
00097     u_char dent_ctsecs;
00099     u_short dent_ctime;
00101     u_short dent_cdate;
00103     u_short dent_adate;
00112     u_short dent_clusthi;
00114     u_short dent_mtime;
00116     u_short dent_mdate;
00121     u_short dent_clust;
00126     u_long dent_fsize;
00127 } PHATDIRENT;
00128 
00134 typedef struct __attribute__ ((packed)) _PHATXDIRENT {
00136     u_char xdent_seq;
00138     u_short xdent_uname_1_5[5];
00140     u_char xdent_attr;
00142     u_char xdent_rsvd;
00144     u_char xdent_cks;
00146     u_short xdent_uname_6_11[6];
00148     u_short xdent_clust;
00150     u_short xdent_uname_12_13[2];
00151 } PHATXDIRENT;
00152 
00153 typedef struct _PHATFIND {
00154     PHATDIRENT phfind_ent;
00155     u_long phfind_pos;
00157     int phfind_xcnt;
00158     char phfind_name[PHAT_MAX_NAMELEN];
00159 } PHATFIND;
00160 
00163 __BEGIN_DECLS
00164 /* Prototypes */
00165 extern int PhatDirEntryCreate(NUTFILE * ndp, CONST char *name, int acc, PHATDIRENT * dirent);
00166 
00167 extern int PhatDirEntryUpdate(NUTFILE * ndp);
00168 
00169 extern int PhatDirReleaseChain(NUTDEVICE * dev, PHATDIRENT * dent);
00170 
00171 extern int PhatDirDelEntry(NUTDEVICE * dev, CONST char *path, u_long flags);
00172 extern int PhatDirRenameEntry(NUTDEVICE * dev, CONST char *old_path, CONST char *new_path);
00173 
00174 extern NUTFILE *PhatDirOpen(NUTDEVICE * dev, CONST char *dpath);
00175 extern NUTFILE *PhatDirOpenParent(NUTDEVICE * dev, CONST char *path, CONST char **basename);
00176 extern int PhatDirEntryFind(NUTFILE * nfp, CONST char *spec, u_long flags, PHATFIND * srch);
00177 extern int PhatDirRead(DIR * dir);
00178 
00179 extern int PhatDirCreate(NUTDEVICE * dev, char *path);
00180 extern int PhatDirRemove(NUTDEVICE * dev, char *path);
00181 
00182 extern int PhatDirEntryStatus(NUTDEVICE * dev, CONST char *path, struct stat *s);
00183 
00184 __END_DECLS
00185 /* End of prototypes */
00186 #endif

© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/