10#ifndef CARDSIGHT_APP_H
11#define CARDSIGHT_APP_H
17#define APP_LAYOUT_MAX 8U
23#define APP_FILE_ENTRIES 64U
25#define APP_FILE_NAME 128U
#define APP_LAYOUT_MAX
Maximum number of partitions a layout request may describe.
Definition app.h:17
void cardsight_snapshot(struct cardsight_state *state)
Copy the shared state for the UI to render.
cardsight_request_type
Operation the worker can be asked to perform; one is in flight at a time.
Definition app.h:64
@ CARDSIGHT_REQUEST_FORMAT
Format one partition.
Definition app.h:74
@ CARDSIGHT_REQUEST_START_PROXY
Start the exFAT proxy view and expose it over USB.
Definition app.h:70
@ CARDSIGHT_REQUEST_LAYOUT
Write a new partition table and format its partitions.
Definition app.h:76
@ CARDSIGHT_REQUEST_SCAN
Re-read the card, its table and its partitions.
Definition app.h:66
@ CARDSIGHT_REQUEST_START_DIRECT
Expose the whole card over USB mass storage.
Definition app.h:68
@ CARDSIGHT_REQUEST_STOP
Stop USB mass storage and the proxy.
Definition app.h:72
@ CARDSIGHT_REQUEST_LIST
List one directory of one partition.
Definition app.h:78
void cardsight_app_init(void)
Initialise the state, the locks and the worker task.
#define APP_FILE_NAME
Longest file name, including the terminating NUL, held in a listing.
Definition app.h:25
void send_request(const struct cardsight_request *request)
Queue one request for the worker.
#define APP_FILE_ENTRIES
Number of directory entries the browser keeps.
Definition app.h:23
Block devices: disks made by a driver, the partitions found in their table, and the checked transfers...
blk_partition_content
File system marker stored in a created partition.
Definition blkdev.h:244
blk_partition_table_type
Partition table format written by blk_write_partition_layout().
Definition blkdev.h:236
SD/MMC core: the description of the card and the disk it creates ("mmcblk0").
Public interface of the exFAT proxy view.
#define STORAGE_PROXY_MAX_PARTITIONS
Number of source partitions the view can expose.
Definition storage_proxy.h:19
One partition to create, in disk order.
Definition blkdev.h:253
One directory entry shown in the file browser.
Definition app.h:30
char name[APP_FILE_NAME]
Name as the source file system reports it.
Definition app.h:32
uint64_t size
File size in bytes; zero for a directory.
Definition app.h:34
bool dir
True when the entry is a directory.
Definition app.h:36
The listing of one directory, valid or carrying the error that prevented it.
Definition app.h:42
char path[VFS_PATH_MAX]
Path of the listed directory, relative to the partition root.
Definition app.h:46
size_t total
Total number of entries seen, including those dropped because the array was full.
Definition app.h:50
struct cardsight_file_entry entries[APP_FILE_ENTRIES]
Entries kept by the browser, directories first, then case-insensitive name order.
Definition app.h:44
bool valid
True once the listing has been filled, even when it holds only an error.
Definition app.h:58
uint32_t partition
Partition number the listing belongs to.
Definition app.h:52
bool truncated
True when total exceeds count.
Definition app.h:56
int error
Error that stopped the listing, or zero.
Definition app.h:54
size_t count
Number of valid entries in entries.
Definition app.h:48
One request queued to the worker task.
Definition app.h:87
uint32_t partition
Partition number for format and list requests.
Definition app.h:91
struct blk_partition_layout_entry entries[APP_LAYOUT_MAX]
Partitions of a layout request.
Definition app.h:105
uint32_t count
Number of valid entries in entries for a layout request.
Definition app.h:97
bool full
True for a full format, which erases the partition before writing the file system.
Definition app.h:99
enum blk_partition_table_type table
Partition table type to write for a layout request.
Definition app.h:95
enum blk_partition_content content
File system to create for a format or layout request.
Definition app.h:93
uint32_t selected
Bit mask of partitions to expose, bit zero being partition one.
Definition app.h:101
enum cardsight_request_type type
Operation to perform.
Definition app.h:89
char path[VFS_PATH_MAX]
Directory path for a list request.
Definition app.h:103
Everything the worker publishes to the UI.
Definition app.h:114
size_t partition_count
Number of valid entries in partitions.
Definition app.h:122
bool running
True while the USB mass storage device is running.
Definition app.h:160
bool card_present
True when a block device for the source disk could be opened.
Definition app.h:132
enum blk_partition_table_type table
Partition table type found on the card.
Definition app.h:130
uint32_t write_rate
Write throughput of the last second, in bytes per second.
Definition app.h:152
bool card_info_valid
True when card holds a valid identity.
Definition app.h:138
int error
Error of the last completed operation, or zero.
Definition app.h:126
uint64_t bytes_written
Bytes the host has written over USB since the device started.
Definition app.h:148
bool busy
True while the worker runs a request.
Definition app.h:142
int progress
Progress percentage of the current operation, or -1 when it is not measurable.
Definition app.h:158
struct storage_proxy_partition_info partitions[STORAGE_PROXY_MAX_PARTITIONS]
Partition information from the last scan.
Definition app.h:116
uint64_t bytes_read
Bytes the host has read over USB since the device started.
Definition app.h:146
uint64_t sectors
Capacity of the card in 512-byte sectors.
Definition app.h:124
char operation[48]
Human-readable description of the current or last operation.
Definition app.h:154
bool card_detecting
True while the MMC slot is identifying a newly inserted card.
Definition app.h:134
char card_error[48]
Human-readable detail of the last card failure.
Definition app.h:156
uint32_t read_rate
Read throughput of the last second, in bytes per second.
Definition app.h:150
bool configured
True when the host has configured the USB mass storage device.
Definition app.h:144
struct cardsight_file_list files
Latest directory listing.
Definition app.h:120
bool card_writable
True when the card is not read-only.
Definition app.h:136
bool proxy_active
True while the proxy view and its USB device are up.
Definition app.h:140
struct mmc_card_info card
Identity of the card in the slot, when it could be read.
Definition app.h:118
enum cardsight_request_type request
Operation currently running or last run.
Definition app.h:128
What the host found out about the card.
Definition card.h:25
One source partition as found by a scan of the card.
Definition storage_proxy.h:34
Virtual file system: block devices, mount points, one name space.
#define VFS_PATH_MAX
Longest path, including the terminating zero.
Definition vfs.h:29