ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_fs_meta.h
Go to the documentation of this file.
1
34
35#pragma once
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41#include <stdint.h>
42
43#include "ra8_err.h"
44#include "ra8_fs.h"
45
46/* =============================================================================
47 * Free space (statvfs)
48 * =============================================================================
49 */
50
55typedef enum : uint8_t {
58
84typedef struct {
85 uint64_t total_bytes;
86 uint64_t free_bytes;
87 uint64_t used_bytes;
89 uint32_t total_clusters;
90 uint32_t free_clusters;
91 uint32_t used_clusters;
93
129[[nodiscard]] ra8_err_t ra8_fs_free_space(const ra8_fs_mount_t* handle, ra8_fs_space_t* out);
130
131/* =============================================================================
132 * Volume label
133 * =============================================================================
134 */
135
169[[nodiscard]] ra8_err_t ra8_fs_get_label(const ra8_fs_mount_t* handle, char* out, uint32_t out_len);
170
206[[nodiscard]] ra8_err_t ra8_fs_set_label(const ra8_fs_mount_t* handle, const char* label);
207
208/* =============================================================================
209 * Per-entry timestamps (utime)
210 * =============================================================================
211 */
212
258[[nodiscard]] ra8_err_t ra8_fs_utime(const ra8_fs_mount_t* handle,
259 const char* path,
260 const ra8_fs_datetime_t* create,
261 const ra8_fs_datetime_t* modify,
262 const ra8_fs_datetime_t* access);
263
302[[nodiscard]] ra8_err_t ra8_fs_truncate(ra8_fs_file_t* file, uint64_t new_size);
303
304/* =============================================================================
305 * Per-entry attributes (chmod-style)
306 * =============================================================================
307 */
308
323typedef enum : uint8_t {
325 (uint8_t)((uint8_t)k_ra8_fs_attr_read_only | (uint8_t)k_ra8_fs_attr_hidden |
326 (uint8_t)k_ra8_fs_attr_system | (uint8_t)k_ra8_fs_attr_archive),
329
380[[nodiscard]] ra8_err_t ra8_fs_set_attr(const ra8_fs_mount_t* handle,
381 const char* path,
382 uint8_t set_mask,
383 uint8_t clear_mask);
384
385#ifdef __cplusplus
386}
387#endif
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
ra8_err_t ra8_fs_get_label(const ra8_fs_mount_t *handle, char *out, uint32_t out_len)
Read the volume label of a mounted volume.
ra8_err_t ra8_fs_set_attr(const ra8_fs_mount_t *handle, const char *path, uint8_t set_mask, uint8_t clear_mask)
Set and/or clear a named entry's file attributes (chmod-style).
ra8_err_t ra8_fs_truncate(ra8_fs_file_t *file, uint64_t new_size)
Set an open file's length to new_size, shrinking or growing it.
ra8_err_t ra8_fs_free_space(const ra8_fs_mount_t *handle, ra8_fs_space_t *out)
Report a mounted volume's total, free, and used space.
ra8_fs_label_limit_t
Sizing constant for the volume-label API.
Definition ra8_fs_meta.h:55
@ k_ra8_fs_label_cap
11-char FAT/exFAT label + NUL: min out size.
Definition ra8_fs_meta.h:56
ra8_fs_attr_settable_t
The attribute bits ra8_fs_set_attr may change.
@ k_ra8_fs_attr_settable
Union of the four settable bits (0x27).
ra8_err_t ra8_fs_utime(const ra8_fs_mount_t *handle, const char *path, const ra8_fs_datetime_t *create, const ra8_fs_datetime_t *modify, const ra8_fs_datetime_t *access)
Set a named entry's create / modify / access timestamps.
ra8_err_t ra8_fs_set_label(const ra8_fs_mount_t *handle, const char *label)
Set (or clear) the volume label of a mounted volume.
@ k_ra8_fs_attr_system
MS FAT spec sec 6 "ATTR_SYSTEM".
@ k_ra8_fs_attr_archive
MS FAT spec sec 6 "ATTR_ARCHIVE".
@ k_ra8_fs_attr_read_only
MS FAT spec sec 6 "ATTR_READ_ONLY".
@ k_ra8_fs_attr_hidden
MS FAT spec sec 6 "ATTR_HIDDEN".
Broken-down civil date and time used at the filesystem boundary.
Open-file state.
Cached parse of one mounted FAT volume.
A mounted volume's capacity, free space, and cluster geometry.
Definition ra8_fs_meta.h:84
uint32_t used_clusters
Clusters currently allocated.
Definition ra8_fs_meta.h:91
uint32_t bytes_per_cluster
Allocation-unit size in bytes.
Definition ra8_fs_meta.h:88
uint32_t total_clusters
Data-region cluster count.
Definition ra8_fs_meta.h:89
uint32_t free_clusters
Clusters not currently allocated.
Definition ra8_fs_meta.h:90
uint64_t used_bytes
Allocated data region, in bytes.
Definition ra8_fs_meta.h:87
uint64_t free_bytes
Unallocated data region, in bytes.
Definition ra8_fs_meta.h:86
uint64_t total_bytes
Whole data region, in bytes.
Definition ra8_fs_meta.h:85