rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
kst_files.c File Reference

The card as the servo programmer's files see it. See kst_files.h. More...

#include "kst_files.h"
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
#include "card_tree.h"
#include "panel.h"
#include "storage.h"

Data Structures

struct  walk_t

Macros

#define PATH_MAX_LEN

Functions

static void dir_path (char *out, size_t out_size)
void kst_files_path (const char *name, char *out, size_t out_size)
static int dir_state (void)
static card_dir_t make_dir (void)
bool kst_files_dir (void)
static bool denied (int err)
static bool io_mounted (void *ctx)
static void walk_entry (const storage_entry_t *entry, void *ctx)
static bool io_walk (void *ctx, kst_store_visit_fn visit, void *visit_ctx)
static int32_t io_size (void *ctx, const char *name)
static int32_t io_read (void *ctx, const char *name, char *buf, size_t cap)
static kst_store_io_result_t io_create (void *ctx, const char *name, const char *data, size_t len)
const kst_store_io_t * kst_files_io (bool held)

Variables

static bool s_held

Detailed Description

The card as the servo programmer's files see it. See kst_files.h.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ PATH_MAX_LEN

#define PATH_MAX_LEN
Value:
(sizeof(STORAGE_MOUNT_POINT) + sizeof(KST_STORE_DIR) \
+ STORAGE_NAME_MAX + 2u)
#define KST_STORE_DIR
The folder of the card that holds the files, made level by level on the first save.
Definition kst_store.h:47

Function Documentation

◆ kst_files_dir()

bool kst_files_dir ( void )

Make the folder, each missing level of it. False when it is not there afterwards.

◆ kst_files_io()

const kst_store_io_t * kst_files_io ( bool held)

The card for kst_card_run(): with held, the caller holds the volume (storage_hold()) for the whole request; without, the request finds no card, even one another task mounts meanwhile.

◆ kst_files_path()

void kst_files_path ( const char * name,
char * out,
size_t out_size )

The full path of name inside the directory, ready for fopen().