dosfstools
4.2
About: dosfstools are utilities to create, check and label (MS-DOS) FAT filesystems.
![]() ![]() |
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <time.h>
#include "common.h"
#include "io.h"
#include "fsck.fat.h"
#include "lfn.h"
#include "file.h"
Go to the source code of this file.
Data Structures | |
struct | LFN_ENT |
Macros | |
#define | LFN_ID_START 0x40 |
#define | LFN_ID_SLOTMASK 0x1f |
#define | CHARS_PER_LFN 13 |
#define | UNICODE_CONVERTABLE(cl, ch) (ch == 0 && (cl < 0x80 || cl >= 0xa0)) |
#define | UNTIL_0 INT_MAX |
#define | CNV_PARTS_SO_FAR() |
#define | BYTES_TO_WCHAR(cl, ch) ((wchar_t)((unsigned)(cl) + ((unsigned)(ch) << 8))) |
Functions | |
static size_t | mbslen (wchar_t x) |
static size_t | wctombs (char *dest, wchar_t x) |
static char * | cnv_unicode (const unsigned char *uni, int maxlen, int use_q) |
static void | copy_lfn_part (unsigned char *dst, LFN_ENT *lfn) |
static char * | cnv_this_part (LFN_ENT *lfn) |
static void | clear_lfn_slots (int start, int end) |
void | lfn_fix_checksum (off_t from, off_t to, const char *short_name) |
void | lfn_reset (void) |
void | lfn_add_slot (DIR_ENT *de, off_t dir_offset) |
char * | lfn_get (DIR_ENT *de, off_t *lfn_offset) |
void | lfn_check_orphaned (void) |
Variables | |
unsigned char * | lfn_unicode = NULL |
unsigned char | lfn_checksum |
int | lfn_slot = -1 |
off_t * | lfn_offsets = NULL |
int | lfn_parts = 0 |
static unsigned char | fat_uni2esc [64] |
#define BYTES_TO_WCHAR | ( | cl, | |
ch | |||
) | ((wchar_t)((unsigned)(cl) + ((unsigned)(ch) << 8))) |
#define CNV_PARTS_SO_FAR | ( | ) |
#define UNICODE_CONVERTABLE | ( | cl, | |
ch | |||
) | (ch == 0 && (cl < 0x80 || cl >= 0xa0)) |
|
static |
Definition at line 158 of file lfn.c.
References DELETED_FLAG, fs_write(), LFN_ENT::id, and lfn_offsets.
Referenced by lfn_add_slot(), lfn_check_orphaned(), and lfn_get().
|
inlinestatic |
Definition at line 151 of file lfn.c.
References CHARS_PER_LFN, cnv_unicode(), and copy_lfn_part().
Referenced by lfn_add_slot().
|
static |
Definition at line 102 of file lfn.c.
References alloc(), BYTES_TO_WCHAR, fat_uni2esc, mbslen(), mem_queue, qalloc(), UNICODE_CONVERTABLE, and wctombs().
Referenced by cnv_this_part(), and lfn_get().
|
static |
Definition at line 143 of file lfn.c.
References LFN_ENT::name0_4, LFN_ENT::name11_12, and LFN_ENT::name5_10.
Referenced by cnv_this_part(), and lfn_add_slot().
void lfn_add_slot | ( | DIR_ENT * | de, |
off_t | dir_offset | ||
) |
Definition at line 200 of file lfn.c.
References LFN_ENT::alias_checksum, alloc(), DIR_ENT::attr, CHARS_PER_LFN, clear_lfn_slots(), CNV_PARTS_SO_FAR, cnv_this_part(), copy_lfn_part(), die(), fs_write(), get_choice(), LFN_ENT::id, lfn_check_orphaned(), lfn_checksum, LFN_ID_SLOTMASK, LFN_ID_START, lfn_offsets, lfn_parts, lfn_reset(), lfn_slot, lfn_unicode, LFN_ENT::reserved, LFN_ENT::start, and VFAT_LN_ATTR.
Referenced by add_file().
void lfn_check_orphaned | ( | void | ) |
Definition at line 512 of file lfn.c.
References clear_lfn_slots(), CNV_PARTS_SO_FAR, get_choice(), lfn_parts, lfn_reset(), and lfn_slot.
Referenced by add_file(), lfn_add_slot(), scan_dir(), and scan_root().
void lfn_fix_checksum | ( | off_t | from, |
off_t | to, | ||
const char * | short_name | ||
) |
Definition at line 175 of file lfn.c.
References fs_write().
char* lfn_get | ( | DIR_ENT * | de, |
off_t * | lfn_offset | ||
) |
Definition at line 399 of file lfn.c.
References DIR_ENT::attr, CHARS_PER_LFN, clear_lfn_slots(), CNV_PARTS_SO_FAR, cnv_unicode(), die(), file_name(), fs_write(), get_choice(), DIR_ENT::lcase, lfn_checksum, LFN_ID_START, lfn_offsets, lfn_parts, lfn_reset(), lfn_slot, lfn_unicode, MSDOS_NAME, DIR_ENT::name, UNTIL_0, VFAT_LN_ATTR, and xasprintf().
Referenced by add_file().
void lfn_reset | ( | void | ) |
Definition at line 187 of file lfn.c.
References lfn_offsets, lfn_slot, and lfn_unicode.
Referenced by lfn_add_slot(), lfn_check_orphaned(), lfn_get(), and new_dir().
|
static |
Definition at line 84 of file lfn.c.
Referenced by cnv_unicode().
|
static |
Definition at line 90 of file lfn.c.
Referenced by cnv_unicode().
|
static |
Definition at line 60 of file lfn.c.
Referenced by cnv_unicode().
unsigned char lfn_checksum |
Definition at line 55 of file lfn.c.
Referenced by lfn_add_slot(), and lfn_get().
off_t* lfn_offsets = NULL |
Definition at line 57 of file lfn.c.
Referenced by clear_lfn_slots(), lfn_add_slot(), lfn_get(), and lfn_reset().
int lfn_parts = 0 |
Definition at line 58 of file lfn.c.
Referenced by lfn_add_slot(), lfn_check_orphaned(), and lfn_get().
int lfn_slot = -1 |
Definition at line 56 of file lfn.c.
Referenced by lfn_add_slot(), lfn_check_orphaned(), lfn_get(), and lfn_reset().
unsigned char* lfn_unicode = NULL |
Definition at line 54 of file lfn.c.
Referenced by lfn_add_slot(), lfn_get(), and lfn_reset().