XgPhatDir


Data Structures

struct  _PHATFIND

Defines

#define PHAT_MAX_NAMELEN   255
 Maximum length of a base file name.
#define PHAT_MAXDIRENT   65536
 Maximum number of directory entries.
#define PHAT_REM_DIRENT   0xE5
#define PHAT_REM_NAMENT   0x05

Typedefs

typedef _PHATFIND PHATFIND

Functions

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

Variables

 PHATDIRENT
 PHATXDIRENT


Function Documentation

struct __attribute__ ( (packed)   ) 

Operating system configuration type.

Once created, this structure will never change if it points to another directory. Except if the entry is removed.

File name, padded with blanks.

File attributes.

See PHAT_FATTR_ flags.

Reserved byte, possibly used by NT.

Hundredth of seconds of file creation time.

File creation time.

File creation date.

Last file access date.

High bytes of first cluster of this file.

If used with the double dot entry, dent_clusthi and dent_clust must be zero if the entry points to the root directory.

The same is true when pointing to a normal file with zero length.

Last file modification time.

Last file modification date.

First cluster used.

This is zero for empty files.

Size of the file in bytes.

For directories, this is always zero.

int PhatDirCreate ( NUTDEVICE dev,
char *  path 
)

Create a new subdirectory.

One cluster is allocated, initialized to zero and two directory entries are created, '.' and '..'.

Parameters:
dev Specifies the file system device.
path Full path to the directory.
Returns:
0 on success. Otherwise -1 is returned.

int PhatDirDelEntry ( NUTDEVICE dev,
CONST char *  path,
u_long  flags 
)

Remove a directory entry.

Allocated clusters are released.

Parameters:
dev Specifies the file system device.
path Name of the entry to remove.
flags Attributes of the entry to remove.
Returns:
0 if successful. Otherwise returns an error code.

int PhatDirEntryCreate ( NUTFILE ndp,
CONST char *  name,
int  acc,
PHATDIRENT *  dirent 
)

Create a new directory entry.

Parameters:
ndp Handle to the parent directory.
name Name of the new entry.
acc Attributes of the new entry.
dirent Information structure of the new entry.
Returns:
0 on success. Otherwise -1 is returned.

int PhatDirEntryFind ( NUTFILE ndp,
CONST char *  spec,
u_long  attmsk,
PHATFIND *  srch 
)

Find a directory entry with a specified name.

Parameters:
ndp Pointer to a previously opened directory.
spec Name of the entry to retrieve.
attmsk Attribute mask. Entries with attributes not specified in this mask will be ignored.
srch Optional pointer to a structure which receives the search result.
Returns:
0 if an entry was found, otherwise -1 is returned.

int PhatDirEntryStatus ( NUTDEVICE dev,
CONST char *  path,
struct stat stp 
)

Retrieve status of a specified file.

Parameters:
dev File system device.
path Path name to the file to query.
stp Pointer to a structure which receives the result.
return 0 on success, -1 otherwise.

int PhatDirEntryUpdate ( NUTFILE nfp  ) 

Update directory entry of an opened file or directory.

Parameters:
nfp File of which the directory entry will be updated.
Returns:
0 on success. Otherwise -1 is returned.

NUTFILE* PhatDirOpen ( NUTDEVICE dev,
CONST char *  dpath 
)

Open a directory.

Parameters:
dev Specifies the file system device.
dpath Full absolute pathname of the directory to open.
Returns:
Pointer to a NUTFILE structure if successful or NUTFILE_EOF otherwise.

NUTFILE* PhatDirOpenParent ( NUTDEVICE dev,
CONST char *  path,
CONST char **  basename 
)

Open parent directory of a given path.

Parameters:
dev Specifies the file system device.
path Full path.
basename Points to a pointer which will be set to the last component within the full path.
Returns:
Pointer to a NUTFILE structure if successful or NUTFILE_EOF otherwise.

int PhatDirRead ( DIR dir  ) 

Read the next directory entry.

Parameters:
dir Pointer to the internal directory information structure.
Returns:
0 on success, -1 otherwise.

int PhatDirReleaseChain ( NUTDEVICE dev,
PHATDIRENT *  dent 
)

Release a cluster chain of a specified directory entry.

Parameters:
dev Specifies the file system device.
dent Directory entry.
Returns:
0 on success or -1 on failure.

int PhatDirRemove ( NUTDEVICE dev,
char *  path 
)

Remove a specified subdirectory.

Parameters:
dev Specifies the file system device.
path Full path to the directory.
Returns:
0 on success. Otherwise -1 is returned.

int PhatDirRenameEntry ( NUTDEVICE dev,
CONST char *  old_path,
CONST char *  new_path 
)

Rename file.

Parameters:
dev Specifies the file system device.
old_path Old name and path of the file.
new_path New name and path of the file.
Returns:
0 on success, -1 otherwise.


Generated on Tue Jan 23 21:12:31 2007 for BTnut System Software by doxygen 1.4.7