RetroArch
Macros | Typedefs | Enumerations | Functions | Variables
directory.c File Reference
#include <string.h>
#include <ctype.h>
#include <wchar.h>
#include <wctype.h>
#include <stdlib.h>
#include <stdio.h>
#include "directory.h"
#include "common.h"
#include "partition.h"
#include "file_allocation_table.h"
#include "bit_ops.h"
#include "filetime.h"
Include dependency graph for directory.c:

Macros

#define DIR_ENTRY_LAST   0x00
 
#define DIR_ENTRY_FREE   0xE5
 
#define LFN_END   0x40
 
#define LFN_DEL   0x80
 
#define ABOVE_UCS_RANGE   0xF0
 

Typedefs

typedef unsigned short ucs2_t
 

Enumerations

enum  LFN_offset {
  LFN_offset_ordinal = 0x00, LFN_offset_char0 = 0x01, LFN_offset_char1 = 0x03, LFN_offset_char2 = 0x05,
  LFN_offset_char3 = 0x07, LFN_offset_char4 = 0x09, LFN_offset_flag = 0x0B, LFN_offset_reserved1 = 0x0C,
  LFN_offset_checkSum = 0x0D, LFN_offset_char5 = 0x0E, LFN_offset_char6 = 0x10, LFN_offset_char7 = 0x12,
  LFN_offset_char8 = 0x14, LFN_offset_char9 = 0x16, LFN_offset_char10 = 0x18, LFN_offset_reserved2 = 0x1A,
  LFN_offset_char11 = 0x1C, LFN_offset_char12 = 0x1E, LFN_offset_ordinal = 0x00, LFN_offset_char0 = 0x01,
  LFN_offset_char1 = 0x03, LFN_offset_char2 = 0x05, LFN_offset_char3 = 0x07, LFN_offset_char4 = 0x09,
  LFN_offset_flag = 0x0B, LFN_offset_reserved1 = 0x0C, LFN_offset_checkSum = 0x0D, LFN_offset_char5 = 0x0E,
  LFN_offset_char6 = 0x10, LFN_offset_char7 = 0x12, LFN_offset_char8 = 0x14, LFN_offset_char9 = 0x16,
  LFN_offset_char10 = 0x18, LFN_offset_reserved2 = 0x1A, LFN_offset_char11 = 0x1C, LFN_offset_char12 = 0x1E
}
 

Functions

static int _FAT_directory_lfnLength (const char *name)
 
static size_t _FAT_directory_mbstoucs2 (ucs2_t *dst, const char *src, size_t len)
 
static size_t _FAT_directory_ucs2tombs (char *dst, const ucs2_t *src, size_t len)
 
static int _FAT_directory_mbsncasecmp (const char *s1, const char *s2, size_t len1)
 
static bool _FAT_directory_entryGetAlias (const u8 *entryData, char *destName)
 
uint32_t _FAT_directory_entryGetCluster (PARTITION *partition, const uint8_t *entryData)
 
static bool _FAT_directory_incrementDirEntryPosition (PARTITION *partition, DIR_ENTRY_POSITION *entryPosition, bool extendDirectory)
 
bool _FAT_directory_getNextEntry (PARTITION *partition, DIR_ENTRY *entry)
 
bool _FAT_directory_getFirstEntry (PARTITION *partition, DIR_ENTRY *entry, uint32_t dirCluster)
 
bool _FAT_directory_getRootEntry (PARTITION *partition, DIR_ENTRY *entry)
 
bool _FAT_directory_getVolumeLabel (PARTITION *partition, char *label)
 
bool _FAT_directory_entryFromPosition (PARTITION *partition, DIR_ENTRY *entry)
 
bool _FAT_directory_entryFromPath (PARTITION *partition, DIR_ENTRY *entry, const char *path, const char *pathEnd)
 
bool _FAT_directory_removeEntry (PARTITION *partition, DIR_ENTRY *entry)
 
static bool _FAT_directory_findEntryGap (PARTITION *partition, DIR_ENTRY *entry, uint32_t dirCluster, size_t size)
 
static bool _FAT_directory_entryExists (PARTITION *partition, const char *name, uint32_t dirCluster)
 
static int _FAT_directory_createAlias (char *alias, const char *lfn)
 
bool _FAT_directory_addEntry (PARTITION *partition, DIR_ENTRY *entry, uint32_t dirCluster)
 
bool _FAT_directory_chdir (PARTITION *partition, const char *path)
 
void _FAT_directory_entryStat (PARTITION *partition, DIR_ENTRY *entry, struct stat *st)
 

Variables

static const int LFN_offset_table [13] ={0x01,0x03,0x05,0x07,0x09,0x0E,0x10,0x12,0x14,0x16,0x18,0x1C,0x1E}
 
static const char ILLEGAL_ALIAS_CHARACTERS [] = "\\/:;*?\"<>|&+,=[] "
 
static const char ILLEGAL_LFN_CHARACTERS [] = "\\/:*?\"<>|"
 

Macro Definition Documentation

◆ ABOVE_UCS_RANGE

#define ABOVE_UCS_RANGE   0xF0

◆ DIR_ENTRY_FREE

#define DIR_ENTRY_FREE   0xE5

◆ DIR_ENTRY_LAST

#define DIR_ENTRY_LAST   0x00

◆ LFN_DEL

#define LFN_DEL   0x80

◆ LFN_END

#define LFN_END   0x40

Typedef Documentation

◆ ucs2_t

typedef unsigned short ucs2_t

Enumeration Type Documentation

◆ LFN_offset

enum LFN_offset
Enumerator
LFN_offset_ordinal 
LFN_offset_char0 
LFN_offset_char1 
LFN_offset_char2 
LFN_offset_char3 
LFN_offset_char4 
LFN_offset_flag 
LFN_offset_reserved1 
LFN_offset_checkSum 
LFN_offset_char5 
LFN_offset_char6 
LFN_offset_char7 
LFN_offset_char8 
LFN_offset_char9 
LFN_offset_char10 
LFN_offset_reserved2 
LFN_offset_char11 
LFN_offset_char12 
LFN_offset_ordinal 
LFN_offset_char0 
LFN_offset_char1 
LFN_offset_char2 
LFN_offset_char3 
LFN_offset_char4 
LFN_offset_flag 
LFN_offset_reserved1 
LFN_offset_checkSum 
LFN_offset_char5 
LFN_offset_char6 
LFN_offset_char7 
LFN_offset_char8 
LFN_offset_char9 
LFN_offset_char10 
LFN_offset_reserved2 
LFN_offset_char11 
LFN_offset_char12 

Function Documentation

◆ _FAT_directory_addEntry()

bool _FAT_directory_addEntry ( PARTITION partition,
DIR_ENTRY entry,
uint32_t  dirCluster 
)
Here is the call graph for this function:

◆ _FAT_directory_chdir()

bool _FAT_directory_chdir ( PARTITION partition,
const char *  path 
)
Here is the call graph for this function:

◆ _FAT_directory_createAlias()

static int _FAT_directory_createAlias ( char *  alias,
const char *  lfn 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _FAT_directory_entryExists()

static bool _FAT_directory_entryExists ( PARTITION partition,
const char *  name,
uint32_t  dirCluster 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _FAT_directory_entryFromPath()

bool _FAT_directory_entryFromPath ( PARTITION partition,
DIR_ENTRY entry,
const char *  path,
const char *  pathEnd 
)
Here is the call graph for this function:

◆ _FAT_directory_entryFromPosition()

bool _FAT_directory_entryFromPosition ( PARTITION partition,
DIR_ENTRY entry 
)
Here is the call graph for this function:

◆ _FAT_directory_entryGetAlias()

static bool _FAT_directory_entryGetAlias ( const u8 entryData,
char *  destName 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _FAT_directory_entryGetCluster()

uint32_t _FAT_directory_entryGetCluster ( PARTITION partition,
const uint8_t entryData 
)
Here is the call graph for this function:

◆ _FAT_directory_entryStat()

void _FAT_directory_entryStat ( PARTITION partition,
DIR_ENTRY entry,
struct stat *  st 
)
Here is the call graph for this function:

◆ _FAT_directory_findEntryGap()

static bool _FAT_directory_findEntryGap ( PARTITION partition,
DIR_ENTRY entry,
uint32_t  dirCluster,
size_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _FAT_directory_getFirstEntry()

bool _FAT_directory_getFirstEntry ( PARTITION partition,
DIR_ENTRY entry,
uint32_t  dirCluster 
)
Here is the call graph for this function:

◆ _FAT_directory_getNextEntry()

bool _FAT_directory_getNextEntry ( PARTITION partition,
DIR_ENTRY entry 
)
Here is the call graph for this function:

◆ _FAT_directory_getRootEntry()

bool _FAT_directory_getRootEntry ( PARTITION partition,
DIR_ENTRY entry 
)
Here is the call graph for this function:

◆ _FAT_directory_getVolumeLabel()

bool _FAT_directory_getVolumeLabel ( PARTITION partition,
char *  label 
)
Here is the call graph for this function:

◆ _FAT_directory_incrementDirEntryPosition()

static bool _FAT_directory_incrementDirEntryPosition ( PARTITION partition,
DIR_ENTRY_POSITION entryPosition,
bool  extendDirectory 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _FAT_directory_lfnLength()

static int _FAT_directory_lfnLength ( const char *  name)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _FAT_directory_mbsncasecmp()

static int _FAT_directory_mbsncasecmp ( const char *  s1,
const char *  s2,
size_t  len1 
)
static
Here is the caller graph for this function:

◆ _FAT_directory_mbstoucs2()

static size_t _FAT_directory_mbstoucs2 ( ucs2_t dst,
const char *  src,
size_t  len 
)
static
Here is the caller graph for this function:

◆ _FAT_directory_removeEntry()

bool _FAT_directory_removeEntry ( PARTITION partition,
DIR_ENTRY entry 
)
Here is the call graph for this function:

◆ _FAT_directory_ucs2tombs()

static size_t _FAT_directory_ucs2tombs ( char *  dst,
const ucs2_t src,
size_t  len 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ ILLEGAL_ALIAS_CHARACTERS

const char ILLEGAL_ALIAS_CHARACTERS[] = "\\/:;*?\"<>|&+,=[] "
static

◆ ILLEGAL_LFN_CHARACTERS

const char ILLEGAL_LFN_CHARACTERS[] = "\\/:*?\"<>|"
static

◆ LFN_offset_table

const int LFN_offset_table[13] ={0x01,0x03,0x05,0x07,0x09,0x0E,0x10,0x12,0x14,0x16,0x18,0x1C,0x1E}
static