Browse Source

flags union

master
Mathieu Serandour 1 year ago
parent
commit
abbf5a7713
  1. 38
      kernel/fs/fs.h

38
kernel/fs/fs.h

@ -102,7 +102,14 @@ typedef struct fs {
// buffers to grant 1-granularity accesses
unsigned file_access_granularity;
union {
flags;
struct {
unsigned read_only: 1;
unsigned cacheable: 1;
unsigned seekable: 1;
};
};
/**
* @brief size of the cursor handler
* data structure used by open_file,
@ -123,6 +130,13 @@ typedef struct fs {
*/
unsigned n_open_files;
/**
* root cluster/inode/...
* implementation dependant
*/
uint64_t root_addr;
/**
* @brief create a cursor over a file
*
@ -141,6 +155,18 @@ typedef struct fs {
void (*close_file)(void *);
/**
* @brief advance by one sector the file
* cursor structure by one grain
*
* @param fs the filesystem structure
* @param cur the curstor structure to advance
*/
void (*advance_file_cursor)(struct fs* fs, void* cur);
/**
* @brief read one sector from file
* the whole buffer will be overwritten even if
@ -174,8 +200,10 @@ typedef struct fs {
// UNIX fseek like
// but offset is in fs blocks instead of
// bytes
int (*seek)(struct fs* restrict fs,void* restrict cur,
uint64_t offset,int whence);
uint64_t block_offset,int whence);
/**
@ -214,12 +242,6 @@ typedef struct fs {
*
*/
void (*unmount)(struct fs* fs);
/**
* root cluster/inode/...
* implementation dependant
*/
uint64_t root_addr;
} fs_t;

Loading…
Cancel
Save