ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
dir_insert_t Struct Reference

Everything decided about a new directory entry before anything is written. More...

#include <ra8_fs_fat_types_internal.h>

Collaboration diagram for dir_insert_t:

Data Fields

dir_slot_t start
 First slot of the reserved run.
uint16_t units [k_lfn_write_max]
 The name, as UTF-16LE code units.
uint32_t nunits
 How many of units the name occupies.
uint8_t name83 [k_max_8_3_name]
 Packed 8.3 name, or the generated alias.
uint8_t ntres
 DIR_NTRes case flags for the entry.
uint8_t lfn_entries
 Chain slots ahead of the 8.3 entry.

Detailed Description

Everything decided about a new directory entry before anything is written.

Adding an entry is split into a reservation and a commit so the caller can fail on a full directory BEFORE it allocates a cluster for the thing it was about to file: mkdir reserves, then allocates, then commits, and a directory with no room left costs no cluster. It also means the alias probing and the free-run search – the only two parts that read the directory – happen exactly once.

The name travels as CODE UNITS rather than as a pointer to the caller's UTF-8. Decoding once, in priv_dir_reserve(), is what lets the commit fill slots without re-deriving a length – and it removes the old rule that the caller's buffer had to outlive the commit.

Invariant
lfn_entries is 0 exactly when the name fits an 8.3 entry.
nunits is the unit count priv_name_classify() produced.
See also
priv_dir_reserve()
Since
0.1.0

Definition at line 658 of file ra8_fs_fat_types_internal.h.

Field Documentation

◆ lfn_entries

uint8_t dir_insert_t::lfn_entries

Chain slots ahead of the 8.3 entry.

Definition at line 664 of file ra8_fs_fat_types_internal.h.

Referenced by priv_dir_commit(), and priv_dir_reserve().

◆ name83

uint8_t dir_insert_t::name83[k_max_8_3_name]

Packed 8.3 name, or the generated alias.

Definition at line 662 of file ra8_fs_fat_types_internal.h.

Referenced by priv_dir_commit(), and priv_dir_reserve().

◆ ntres

uint8_t dir_insert_t::ntres

DIR_NTRes case flags for the entry.

Definition at line 663 of file ra8_fs_fat_types_internal.h.

Referenced by priv_dir_commit(), and priv_dir_reserve().

◆ nunits

uint32_t dir_insert_t::nunits

How many of units the name occupies.

Definition at line 661 of file ra8_fs_fat_types_internal.h.

Referenced by priv_dir_commit(), and priv_dir_reserve().

◆ start

dir_slot_t dir_insert_t::start

First slot of the reserved run.

Definition at line 659 of file ra8_fs_fat_types_internal.h.

Referenced by priv_dir_commit(), and priv_dir_reserve().

◆ units

uint16_t dir_insert_t::units[k_lfn_write_max]

The name, as UTF-16LE code units.

Definition at line 660 of file ra8_fs_fat_types_internal.h.

Referenced by priv_dir_commit(), and priv_dir_reserve().


The documentation for this struct was generated from the following file: