More FAT long file name logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3782 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
fb32eed2ee
commit
718738cb62
|
@ -217,7 +217,7 @@
|
|||
# define LDIR_MAXLFNCHARS 13 /* Max unicode characters in one LFN entry */
|
||||
# define LDIR_MAXLFNS 20 /* Max number of LFN entries */
|
||||
|
||||
/* LFN directory enty offsets */
|
||||
/* LFN directory entry offsets */
|
||||
|
||||
# define LDIR_SEQ 0 /* 1@ 0: Sequence number */
|
||||
# define LDIR_WCHAR1_5 1 /* 10@ 1: File name characters 1-5 (5 Unicode characters) */
|
||||
|
@ -235,6 +235,10 @@
|
|||
# define LDIR0_E5 DIR0_E5 /* The actual value is 0xe5 */
|
||||
# define LDIR0_LAST 0x40 /* Last LFN in file name (appears first) */
|
||||
# define LDIR0_SEQ_MASK 0x1f /* Mask for sequence number (1-20) */
|
||||
|
||||
/* The LFN entry attribute */
|
||||
|
||||
# define LDDIR_LFNATTR 0x0f
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -333,10 +337,10 @@
|
|||
#define DIR_GETCRTTIMETENTH(p) UBYTE_VAL(p,DIR_CRTTIMETENTH)
|
||||
|
||||
#ifdef CONFIG_FAT_LFN
|
||||
# define LDIR_GETSEQ(p) UBYTE_VAL(*p, LDIR_SEQ);
|
||||
# define LDIR_GETATTRIBUTES(p) UBYTE_VAL(*p, LDIR_ATTRIBUTES);
|
||||
# define LDIR_GETNTRES(p) UBYTE_VAL(*p, LDIR_NTRES);
|
||||
# define LDIR_GETCHECKSUM(p) UBYTE_VAL(*p, LDIR_CHECKSUM);
|
||||
# define LDIR_GETSEQ(p) UBYTE_VAL(*p,LDIR_SEQ);
|
||||
# define LDIR_GETATTRIBUTES(p) UBYTE_VAL(*p,LDIR_ATTRIBUTES);
|
||||
# define LDIR_GETNTRES(p) UBYTE_VAL(*p,LDIR_NTRES);
|
||||
# define LDIR_GETCHECKSUM(p) UBYTE_VAL(*p,LDIR_CHECKSUM);
|
||||
#endif
|
||||
|
||||
#define MBR_PUTSECPERCLUS(p,v) UBYTE_PUT(p,BS_SECPERCLUS,v)
|
||||
|
@ -717,11 +721,13 @@ struct fat_dirseq_s
|
|||
uint16_t ds_lfnoffset; /* Sector offset to last long file name entry */
|
||||
#endif
|
||||
|
||||
/* Sector numbers */
|
||||
/* Sector and cluster numbers */
|
||||
|
||||
off_t ds_sector; /* Sector of the short file name entry */
|
||||
#ifdef CONFIG_FAT_LFN
|
||||
off_t ds_cluster; /* Cluster containing the short file name entry */
|
||||
off_t ds_lfnsector; /* Sector of the last long name entry */
|
||||
off_t ds_lfncluster; /* Cluster containing the long file name entry */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1181,7 +1181,9 @@ int32_t fat_extendchain(struct fat_mountpt_s *fs, uint32_t cluster)
|
|||
* Name: fat_nextdirentry
|
||||
*
|
||||
* Desciption: Read the next directory entry from the sector in cache,
|
||||
* reading the next sector(s) in the cluster as necessary.
|
||||
* reading the next sector(s) in the cluster as necessary. This function
|
||||
* must return -ENOSPC if if fails because there are no further entries
|
||||
* available in the directory.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -1221,7 +1223,7 @@ int fat_nextdirentry(struct fat_mountpt_s *fs, struct fs_fatdir_s *dir)
|
|||
* the root directory.
|
||||
*/
|
||||
|
||||
return ERROR;
|
||||
return -ENOSPC;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1250,7 +1252,8 @@ int fat_nextdirentry(struct fat_mountpt_s *fs, struct fs_fatdir_s *dir)
|
|||
if (cluster < 2 || cluster >= fs->fs_nclusters)
|
||||
{
|
||||
/* No, we have probably reached the end of the cluster list */
|
||||
return ERROR;
|
||||
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
/* Initialize for new cluster */
|
||||
|
|
|
@ -78,9 +78,9 @@ struct fs_psuedodir_s
|
|||
|
||||
struct fs_fatdir_s
|
||||
{
|
||||
uint32_t fd_startcluster; /* Start cluster number of the directory */
|
||||
uint32_t fd_currcluster; /* Current cluster number being read */
|
||||
size_t fd_currsector; /* Current sector being read */
|
||||
off_t fd_startcluster; /* Start cluster number of the directory */
|
||||
off_t fd_currcluster; /* Current cluster number being read */
|
||||
off_t fd_currsector; /* Current sector being read */
|
||||
unsigned int fd_index; /* Current index of the directory entry to read */
|
||||
};
|
||||
#endif /* CONFIG_FS_FAT */
|
||||
|
@ -92,8 +92,8 @@ struct fs_fatdir_s
|
|||
|
||||
struct fs_romfsdir_s
|
||||
{
|
||||
uint32_t fr_firstoffset; /* Offset to the first entry in the directory */
|
||||
uint32_t fr_curroffset; /* Current offset into the directory contents */
|
||||
off_t fr_firstoffset; /* Offset to the first entry in the directory */
|
||||
off_t fr_curroffset; /* Current offset into the directory contents */
|
||||
};
|
||||
#endif /* CONFIG_FS_ROMFS */
|
||||
|
||||
|
|
Loading…
Reference in New Issue