PHAT Utilities
[PHAT File System]

Collaboration diagram for PHAT Utilities:

Detailed Description

General utility routines used by the PHAT file system.


Functions

void GetDosTimeStamp (u_short *dostim, u_short *dosdat)
 Create a DOS timestamp of the current time and date.
int MakePhatName (CONST char *src, u_char *dst)
 Convert filename to a directory entry name.
void MakeVisibleName (CONST u_char *src, char *dst)
 Convert a directory entry name to a visible file name.
char * GetParentPath (CONST char *path, CONST char **comp)
 Chop off the last component of a path.
int IsFixedRootDir (NUTFILE *ndp)
 Test for PHAT12/PHAT16 root directory.
void PhatFilePosRewind (PHATFILE *fcb)
 Set file pointer back to zero.
int PhatFilePosSet (NUTFILE *nfp, u_long pos)
 Move file pointer to a specified position.


Function Documentation

void GetDosTimeStamp ( u_short dostim,
u_short dosdat 
)

Create a DOS timestamp of the current time and date.

Parameters:
dostim Receives the time of day part.
dosdat Receives the calendar date part.

Definition at line 95 of file phatutil.c.

References localtime(), time(), _tm::tm_hour, _tm::tm_mday, _tm::tm_min, _tm::tm_mon, _tm::tm_sec, and _tm::tm_year.

int MakePhatName ( CONST char *  src,
u_char dst 
)

Convert filename to a directory entry name.

Parameters:
src Original name in the format 'name.ext'.
dst Converted name in the format 'name ext'.
Returns:
0 on success, 1 if the name contains wildcards or -1 if the name is malformed.

Definition at line 120 of file phatutil.c.

References memset(), PHAT_REM_DIRENT, PHAT_REM_NAMENT, strchr(), and toupper().

void MakeVisibleName ( CONST u_char src,
char *  dst 
)

Convert a directory entry name to a visible file name.

Parameters:
src Original name in the format 'name ext'.
dst Converted name in the format 'name.ext'.
Returns:
0 on success, 1 if the name contains wildcards or -1 if the name is malformed.

Definition at line 205 of file phatutil.c.

References PHAT_REM_DIRENT, and PHAT_REM_NAMENT.

char* GetParentPath ( CONST char *  path,
CONST char **  comp 
)

Chop off the last component of a path.

Parameters:
path Full path.
comp Points to a pointer which will be set to the last component within the full path.
Returns:
Pointer to a newly allocated string containing the parent path, or NULL in case of an error. The allocated buffer must be released by the caller.

Definition at line 242 of file phatutil.c.

References EINVAL, errno, malloc, memcpy(), strlen(), and strrchr().

int IsFixedRootDir ( NUTFILE ndp  ) 

Test for PHAT12/PHAT16 root directory.

Parameters:
ndp Handle of an opened file to check.
Returns:
0 if the file is not a fixed root directory.

Definition at line 273 of file phatutil.c.

References _NUTDEVICE::dev_dcb, _NUTFILE::nf_dev, _NUTFILE::nf_fcb, and PHATVOL::vol_type.

void PhatFilePosRewind ( PHATFILE fcb  ) 

Set file pointer back to zero.

Parameters:
fcb Specifies the file control block.

Definition at line 297 of file phatutil.c.

References PHATDIRENT::dent_clust, PHATDIRENT::dent_clusthi, PHATFILE::f_clust, PHATFILE::f_clust_pos, PHATFILE::f_dirent, PHATFILE::f_pos, and PHATFILE::f_sect_pos.

int PhatFilePosSet ( NUTFILE nfp,
u_long  pos 
)

Move file pointer to a specified position.

Moving beyond the current file size is not supported.

Parameters:
nfp File descriptor.
pos Requested file position.
Returns:
0 on success, -1 otherwise. In the latter case the position is unspecified.

Definition at line 322 of file phatutil.c.

References PHATDIRENT::dent_attr, PHATDIRENT::dent_fsize, _NUTDEVICE::dev_dcb, PHATFILE::f_clust, PHATFILE::f_clust_pos, PHATFILE::f_clust_prv, PHATFILE::f_dirent, PHATFILE::f_pos, PHATFILE::f_sect_pos, IsFixedRootDir(), _NUTFILE::nf_dev, _NUTFILE::nf_fcb, PHAT12CMASK, Phat12GetClusterLink(), PHAT16CMASK, Phat16GetClusterLink(), PHAT32CMASK, Phat32GetClusterLink(), PHAT_FATTR_DIR, PHATEOC, PhatFilePosRewind(), PHATVOL::vol_clustsz, PHATVOL::vol_rootsz, PHATVOL::vol_sectsz, and PHATVOL::vol_type.


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