CardSight 0.1.0
C API reference for the CardSight firmware and application
Loading...
Searching...
No Matches
storage_proxy.h File Reference

Public interface of the exFAT proxy view. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <vfs.h>

Go to the source code of this file.

Data Structures

struct  storage_proxy_config
 What the caller wants the proxy to expose. More...
struct  storage_proxy_partition_info
 One source partition as found by a scan of the card. More...

Macros

#define STORAGE_PROXY_MAX_PARTITIONS   8U
 Number of source partitions the view can expose.

Functions

int storage_proxy_start (const char *source_disk)
 Start the view over every partition found on the disk.
int storage_proxy_start_config (const struct storage_proxy_config *config)
 Start the view with an explicit partition selection.
int storage_proxy_scan (const char *source_disk, struct storage_proxy_partition_info *partitions, size_t capacity, size_t *count)
 Describe the partitions of a disk without starting the view.
void storage_proxy_stop (void)
 Stop the view and release everything it holds.
void storage_proxy_source_lost (void)
 Mark the source card as gone so the view only fails until it is stopped.
bool storage_proxy_running (void)
 Report whether the view is running.
bool storage_proxy_read_only (void)
 Report whether the view refuses writes.
const char * storage_proxy_device_name (void)
 Return the block device name the view is registered under.
size_t storage_proxy_entry_count (void)
 Return the number of index nodes the view currently holds.
int storage_proxy_partition_status (uint32_t partition)
 Return the probe status of one source partition.

Detailed Description

Public interface of the exFAT proxy view.

The proxy synthesises one exFAT volume whose partition folders are backed by the mounted source file systems, and exposes it as block device cardview0 for the USB mass storage gadget.

Function Documentation

◆ storage_proxy_device_name()

const char * storage_proxy_device_name ( void )

Return the block device name the view is registered under.

Returns
The constant device name of the view.

◆ storage_proxy_entry_count()

size_t storage_proxy_entry_count ( void )

Return the number of index nodes the view currently holds.

Returns
Node count, including the root and retired nodes.

◆ storage_proxy_partition_status()

int storage_proxy_partition_status ( uint32_t partition)

Return the probe status of one source partition.

Parameters
[in]partitionZero-based partition index.
Returns
The stored status, or -EINVAL when the index is out of range.

◆ storage_proxy_read_only()

bool storage_proxy_read_only ( void )

Report whether the view refuses writes.

Returns
True when any exposed source is read-only.

◆ storage_proxy_running()

bool storage_proxy_running ( void )

Report whether the view is running.

Returns
True when the view is registered as a block device.

◆ storage_proxy_scan()

int storage_proxy_scan ( const char * source_disk,
struct storage_proxy_partition_info * partitions,
size_t capacity,
size_t * count )

Describe the partitions of a disk without starting the view.

Parameters
[in]source_diskWhole-disk block device name.
[out]partitionsArray receiving one entry per present partition.
[in]capacityNumber of entries partitions can hold.
[out]countNumber of entries filled.
Returns
0 on success, or a negative errno.

◆ storage_proxy_start()

int storage_proxy_start ( const char * source_disk)

Start the view over every partition found on the disk.

Parameters
[in]source_diskBlock device name of the whole disk.
Returns
0 on success, or a negative errno.

◆ storage_proxy_start_config()

int storage_proxy_start_config ( const struct storage_proxy_config * config)

Start the view with an explicit partition selection.

Parameters
[in]configSource disk and selection mask.
Returns
0 on success, or a negative errno.