BEEP-8 SDK 1.0.0
Loading...
Searching...
No Matches
crt.h
Go to the documentation of this file.
1
11#pragma once
12#include <sys/stat.h>
13#include <stddef.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
27typedef struct
28{
29 void* f_priv;
30 void* d_priv;
31 uint8_t used;
32 int mode;
33} File;
34
41typedef struct
42{
43 int (*open)( File* filep);
44 int (*close)( File* filep);
45 ssize_t (*read)( File* filep, char *buffer, size_t buflen);
46 ssize_t (*write)( File* filep, const char *buffer, size_t buflen);
47 off_t (*seek)( File* filep, int ptr,int dir);
48 int (*ioctl)( File* filep, unsigned int cmd, void* arg);
50
51#define N_MAX_PATH (32)
58typedef struct {
59 char _path[ N_MAX_PATH ];
61 mode_t _mode;
62 void* _priv;
63} FsDriver ;
64
77extern int fs_register_driver(
78 const char* path,
79 const file_operations* fops,
80 mode_t mode,
81 void* priv
82);
83
95extern int _ioctl(int fd, unsigned int cmd, void* arg);
96
97#ifdef __cplusplus
98}
99#endif
int fs_register_driver(const char *path, const file_operations *fops, mode_t mode, void *priv)
Registers a file system driver.
Definition crt0.c:430
int _ioctl(int fd, unsigned int cmd, void *arg)
Performs an IOCTL operation on a file.
Definition crt0.c:821
int ioctl(int fd, int request,...)
Performs a variety of control functions on devices.
Definition misc.c:6
Represents a file in the file system.
Definition crt.h:28
void * f_priv
File-specific private data.
Definition crt.h:29
uint8_t used
Flag indicating if the file is in use.
Definition crt.h:31
void * d_priv
Driver-specific private data.
Definition crt.h:30
int mode
Access mode for the file.
Definition crt.h:32
Represents a file system driver.
Definition crt.h:58
void * _priv
Driver-specific private data.
Definition crt.h:62
const file_operations * _fops
Supported file operations.
Definition crt.h:60
mode_t _mode
Access mode for the driver.
Definition crt.h:61
Represents the operations that can be performed on a file.
Definition crt.h:42