CardSight 0.1.0
C API reference for the CardSight firmware and application
Loading...
Searching...
No Matches
storage_proxy.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
10#ifndef CARDSIGHT_STORAGE_PROXY_H
11#define CARDSIGHT_STORAGE_PROXY_H
12
13#include <stdbool.h>
14#include <stddef.h>
15#include <stdint.h>
16#include <vfs.h>
17
19#define STORAGE_PROXY_MAX_PARTITIONS 8U
20
26 const char *source_disk;
28 uint32_t selected_partitions; /* bit zero is partition one */
29};
30
52
59int storage_proxy_start(const char *source_disk);
76int storage_proxy_scan(const char *source_disk, struct storage_proxy_partition_info *partitions,
77 size_t capacity, size_t *count);
116int storage_proxy_partition_status(uint32_t partition);
117
118#endif /* CARDSIGHT_STORAGE_PROXY_H */
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.
bool storage_proxy_running(void)
Report whether the view is running.
size_t storage_proxy_entry_count(void)
Return the number of index nodes the view currently holds.
void storage_proxy_stop(void)
Stop the view and release everything it holds.
const char * storage_proxy_device_name(void)
Return the block device name the view is registered under.
void storage_proxy_source_lost(void)
Mark the source card as gone so the view only fails until it is stopped.
int storage_proxy_start(const char *source_disk)
Start the view over every partition found on the disk.
int storage_proxy_partition_status(uint32_t partition)
Return the probe status of one source partition.
bool storage_proxy_read_only(void)
Report whether the view refuses writes.
int storage_proxy_start_config(const struct storage_proxy_config *config)
Start the view with an explicit partition selection.
What the caller wants the proxy to expose.
Definition storage_proxy.h:24
uint32_t selected_partitions
Bit mask of partitions to expose; bit zero is partition one.
Definition storage_proxy.h:28
const char * source_disk
Block device name of the whole source disk.
Definition storage_proxy.h:26
One source partition as found by a scan of the card.
Definition storage_proxy.h:34
bool selected
True when the partition is in the proxy's selection mask.
Definition storage_proxy.h:48
struct vfs_volume_info volume
Volume information probed from the partition.
Definition storage_proxy.h:38
char device[VFS_BLK_NAME]
Block device name of the partition, such as "mmc0p1".
Definition storage_proxy.h:36
bool present
True when the partition device exists.
Definition storage_proxy.h:46
int status
Result of probing the file system, or -ENODEV when it is absent.
Definition storage_proxy.h:44
uint64_t sectors
Size of the partition in 512-byte sectors.
Definition storage_proxy.h:40
uint32_t partno
One-based partition number.
Definition storage_proxy.h:42
bool writable
True when the partition can be written.
Definition storage_proxy.h:50
Description of a volume found by vfs_probe().
Definition vfs.h:78
Virtual file system: block devices, mount points, one name space.
#define VFS_BLK_NAME
Longest block device name in a mount description.
Definition vfs.h:31