Nut/OS  4.10.3
API Reference
phatdir.c File Reference

PHAT File System. More...

#include <fs/fs.h>
#include <fs/phatfs.h>
#include <fs/phatvol.h>
#include <fs/phatio.h>
#include <fs/phatutil.h>
#include <fs/phatdir.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include <memdebug.h>
Include dependency graph for phatdir.c:

Go to the source code of this file.


#define PHAT_MAXDIRENT   65536
 Maximum number of directory entries.


int PhatDirEntryCreate (NUTFILE *ndp, CONST char *name, int acc, PHATDIRENT *dirent)
 Create a new directory entry.
int PhatDirEntryUpdate (NUTFILE *nfp)
 Update directory entry of an opened file or directory.
int PhatDirEntryFind (NUTFILE *ndp, CONST char *spec, uint32_t attmsk, PHATFIND *srch)
 Find a directory entry with a specified name.
NUTFILEPhatDirOpenParent (NUTDEVICE *dev, CONST char *path, CONST char **basename)
 Open parent directory of a given path.
int PhatDirRenameEntry (NUTDEVICE *dev, CONST char *old_path, CONST char *new_path)
 Rename file.
int PhatDirReleaseChain (NUTDEVICE *dev, PHATDIRENT *dent)
 Release a cluster chain of a specified directory entry.
int PhatDirDelEntry (NUTDEVICE *dev, CONST char *path, uint32_t flags)
 Remove a directory entry.
NUTFILEPhatDirOpen (NUTDEVICE *dev, CONST char *dpath)
 Open a directory.
int PhatDirRead (DIR *dir)
 Read the next directory entry.
int PhatDirCreate (NUTDEVICE *dev, char *path)
 Create a new subdirectory.
int PhatDirRemove (NUTDEVICE *dev, char *path)
 Remove a specified subdirectory.
int PhatDirEntryStatus (NUTDEVICE *dev, CONST char *path, struct stat *stp)
 Retrieve status of a specified file.

Detailed Description

PHAT File System.

 * $Log$
 * Revision 1.14  2009/02/13 14:52:05  haraldkipp
 * Include memdebug.h for heap management debugging support.
 * Revision 1.13  2009/01/17 11:26:46  haraldkipp
 * Getting rid of two remaining BSD types in favor of stdint.
 * Replaced 'u_int' by 'unsinged int' and 'uptr_t' by 'uintptr_t'.
 * Revision 1.12  2008/08/11 06:59:42  haraldkipp
 * BSD types replaced by stdint types (feature request #1282721).
 * Revision 1.11  2006/10/08 16:42:56  haraldkipp
 * Not optimal, but simple and reliable exclusive access implemented.
 * Fixes bug #1486539. Furthermore, bug #1567790, which had been rejected,
 * had been reported correctly and is now fixed.
 * Revision 1.10  2006/10/05 17:23:14  haraldkipp
 * Fixes bug #1571269. Thanks to Dirk Boecker for reporting this.
 * Revision 1.9  2006/09/08 16:48:28  haraldkipp
 * Directory entries honor daylight saving time. Thanks to Dirk Boecker for
 * this fix.
 * Revision 1.8  2006/07/05 16:00:30  haraldkipp
 * Two bugs fixed. Renaming a file's path (including directory change) failed.
 * Thanks to Dirk Boecker, who reported this.
 * The second bug was a memory hole, which had been discovered by
 * Ralf Spettel.
 * Revision 1.7  2006/06/28 17:24:29  haraldkipp
 * Bugfix. Directories with long filename entries may not expand when
 * crossing cluster boundaries.
 * Revision 1.6  2006/06/18 16:37:10  haraldkipp
 * No need to set errno after GetParentPath() returns an error.
 * No need to set errno after malloc failed.
 * New local helper function PhatOpenParentPath() reduces code size.
 * Support for long filenames (VFAT) added.
 * New function PhatDirReleaseChain() simplifies code.
 * Static function PhatDirOpenParentPath() replaced by global PhatDirOpenParent().
 * Added const attribute to path parameter of PhatDirOpen().
 * Now PhatDirEntryUpdate() clears the dirty flag for the root directory.
 * Calls to PhatFilePosSet() with position zero replaced by calls to PhatFilePosRewind().
 * Revision 1.5  2006/04/07 12:52:24  haraldkipp
 * Memory hole fixed. Flag for normal / directory files now set correctly.
 * Revision 1.4  2006/02/23 15:45:21  haraldkipp
 * PHAT file system now supports configurable number of sector buffers.
 * This dramatically increased write rates of no-name cards.
 * AVR compile errors corrected.
 * Revision 1.3  2006/01/25 18:47:42  haraldkipp
 * Fixes wrong implementation of readdir() and simplifies the code.
 * Thanks to Jesper Hansen.
 * Revision 1.2  2006/01/22 17:40:51  haraldkipp
 * Now mkdir() fails, if the directory exists already.
 * Now rmdir() returns an error when trying to delete subdirectories, which
 * are not empty.
 * Now PhatDirEntryStatus() sets correct errno value, if out of memory.
 * Revision 1.1  2006/01/05 16:31:32  haraldkipp
 * First check-in.

Definition in file phatdir.c.