diff --git a/headers/os/drivers/fs_cache.h b/headers/os/drivers/fs_cache.h index cfa7f911d8..75f22597fa 100644 --- a/headers/os/drivers/fs_cache.h +++ b/headers/os/drivers/fs_cache.h @@ -19,44 +19,57 @@ extern "C" { /* transactions */ extern int32 cache_start_transaction(void *_cache); extern status_t cache_sync_transaction(void *_cache, int32 id); -extern status_t cache_end_transaction(void *_cache, int32 id, transaction_notification_hook hook, void *data); +extern status_t cache_end_transaction(void *_cache, int32 id, + transaction_notification_hook hook, void *data); extern status_t cache_abort_transaction(void *_cache, int32 id); -extern int32 cache_detach_sub_transaction(void *_cache, int32 id, transaction_notification_hook hook, void *data); +extern int32 cache_detach_sub_transaction(void *_cache, int32 id, + transaction_notification_hook hook, void *data); extern status_t cache_abort_sub_transaction(void *_cache, int32 id); extern status_t cache_start_sub_transaction(void *_cache, int32 id); -extern status_t cache_next_block_in_transaction(void *_cache, int32 id, uint32 *_cookie, - off_t *_blockNumber, void **_data, void **_unchangedData); +extern status_t cache_next_block_in_transaction(void *_cache, int32 id, + uint32 *_cookie, off_t *_blockNumber, void **_data, + void **_unchangedData); extern int32 cache_blocks_in_transaction(void *_cache, int32 id); extern int32 cache_blocks_in_sub_transaction(void *_cache, int32 id); /* block cache */ extern void block_cache_delete(void *_cache, bool allowWrites); -extern void *block_cache_create(int fd, off_t numBlocks, size_t blockSize, bool readOnly); +extern void *block_cache_create(int fd, off_t numBlocks, size_t blockSize, + bool readOnly); extern status_t block_cache_sync(void *_cache); -extern status_t block_cache_make_writable(void *_cache, off_t blockNumber, int32 transaction); -extern void *block_cache_get_writable_etc(void *_cache, off_t blockNumber, off_t base, - off_t length, int32 transaction); -extern void *block_cache_get_writable(void *_cache, off_t blockNumber, int32 transaction); -extern void *block_cache_get_empty(void *_cache, off_t blockNumber, int32 transaction); -extern const void *block_cache_get_etc(void *_cache, off_t blockNumber, off_t base, off_t length); +extern status_t block_cache_make_writable(void *_cache, off_t blockNumber, + int32 transaction); +extern void *block_cache_get_writable_etc(void *_cache, off_t blockNumber, + off_t base, off_t length, int32 transaction); +extern void *block_cache_get_writable(void *_cache, off_t blockNumber, + int32 transaction); +extern void *block_cache_get_empty(void *_cache, off_t blockNumber, + int32 transaction); +extern const void *block_cache_get_etc(void *_cache, off_t blockNumber, + off_t base, off_t length); extern const void *block_cache_get(void *_cache, off_t blockNumber); -extern status_t block_cache_set_dirty(void *_cache, off_t blockNumber, bool isDirty, int32 transaction); +extern status_t block_cache_set_dirty(void *_cache, off_t blockNumber, + bool isDirty, int32 transaction); extern void block_cache_put(void *_cache, off_t blockNumber); /* file cache */ -extern void *file_cache_create(mount_id mountID, vnode_id vnodeID, off_t size, int fd); +extern void *file_cache_create(mount_id mountID, vnode_id vnodeID, off_t size, + int fd); extern void file_cache_delete(void *_cacheRef); extern status_t file_cache_set_size(void *_cacheRef, off_t size); extern status_t file_cache_sync(void *_cache); -extern status_t file_cache_invalidate_file_map(void *_cacheRef, off_t offset, off_t size); +extern status_t file_cache_invalidate_file_map(void *_cacheRef, off_t offset, + off_t size); extern status_t file_cache_read_pages(void *_cacheRef, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes); extern status_t file_cache_write_pages(void *_cacheRef, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes); -extern status_t file_cache_read(void *_cacheRef, off_t offset, void *bufferBase, size_t *_size); -extern status_t file_cache_write(void *_cacheRef, off_t offset, const void *buffer, size_t *_size); +extern status_t file_cache_read(void *_cacheRef, off_t offset, void *bufferBase, + size_t *_size); +extern status_t file_cache_write(void *_cacheRef, off_t offset, + const void *buffer, size_t *_size); #ifdef __cplusplus } diff --git a/headers/os/drivers/fs_interface.h b/headers/os/drivers/fs_interface.h index 193a350044..23e05ca764 100644 --- a/headers/os/drivers/fs_interface.h +++ b/headers/os/drivers/fs_interface.h @@ -74,98 +74,133 @@ typedef struct file_system_module_info { status_t (*unmount)(fs_volume fs); status_t (*read_fs_info)(fs_volume fs, struct fs_info *info); - status_t (*write_fs_info)(fs_volume fs, const struct fs_info *info, uint32 mask); + status_t (*write_fs_info)(fs_volume fs, const struct fs_info *info, + uint32 mask); status_t (*sync)(fs_volume fs); /* vnode operations */ - status_t (*lookup)(fs_volume fs, fs_vnode dir, const char *name, vnode_id *_id, int *_type); - status_t (*get_vnode_name)(fs_volume fs, fs_vnode vnode, char *buffer, size_t bufferSize); + status_t (*lookup)(fs_volume fs, fs_vnode dir, const char *name, + vnode_id *_id, int *_type); + status_t (*get_vnode_name)(fs_volume fs, fs_vnode vnode, char *buffer, + size_t bufferSize); - status_t (*get_vnode)(fs_volume fs, vnode_id id, fs_vnode *_vnode, bool reenter); + status_t (*get_vnode)(fs_volume fs, vnode_id id, fs_vnode *_vnode, + bool reenter); status_t (*put_vnode)(fs_volume fs, fs_vnode vnode, bool reenter); status_t (*remove_vnode)(fs_volume fs, fs_vnode vnode, bool reenter); /* VM file access */ bool (*can_page)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*read_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, - const iovec *vecs, size_t count, size_t *_numBytes, bool reenter); - status_t (*write_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, - const iovec *vecs, size_t count, size_t *_numBytes, bool reenter); + status_t (*read_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + off_t pos, const iovec *vecs, size_t count, size_t *_numBytes, + bool reenter); + status_t (*write_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + off_t pos, const iovec *vecs, size_t count, size_t *_numBytes, + bool reenter); /* cache file access */ - status_t (*get_file_map)(fs_volume fs, fs_vnode vnode, off_t offset, size_t size, struct file_io_vec *vecs, size_t *_count); + status_t (*get_file_map)(fs_volume fs, fs_vnode vnode, off_t offset, + size_t size, struct file_io_vec *vecs, size_t *_count); /* common operations */ - status_t (*ioctl)(fs_volume fs, fs_vnode v, fs_cookie cookie, ulong op, void *buffer, size_t length); - status_t (*set_flags)(fs_volume fs, fs_vnode v, fs_cookie cookie, int flags); - status_t (*select)(fs_volume fs, fs_vnode v, fs_cookie cookie, uint8 event, - uint32 ref, selectsync *sync); - status_t (*deselect)(fs_volume fs, fs_vnode v, fs_cookie cookie, + status_t (*ioctl)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, ulong op, + void *buffer, size_t length); + status_t (*set_flags)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + int flags); + status_t (*select)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + uint8 event, uint32 ref, selectsync *sync); + status_t (*deselect)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, uint8 event, selectsync *sync); - status_t (*fsync)(fs_volume fs, fs_vnode v); + status_t (*fsync)(fs_volume fs, fs_vnode vnode); - status_t (*read_link)(fs_volume fs, fs_vnode link, char *buffer, size_t *_bufferSize); + status_t (*read_link)(fs_volume fs, fs_vnode link, char *buffer, + size_t *_bufferSize); status_t (*write_link)(fs_volume fs, fs_vnode link, char *toPath); - status_t (*create_symlink)(fs_volume fs, fs_vnode dir, const char *name, const char *path, int mode); + status_t (*create_symlink)(fs_volume fs, fs_vnode dir, const char *name, + const char *path, int mode); - status_t (*link)(fs_volume fs, fs_vnode dir, const char *name, fs_vnode vnode); + status_t (*link)(fs_volume fs, fs_vnode dir, const char *name, + fs_vnode vnode); status_t (*unlink)(fs_volume fs, fs_vnode dir, const char *name); - status_t (*rename)(fs_volume fs, fs_vnode fromDir, const char *fromName, fs_vnode toDir, const char *toName); + status_t (*rename)(fs_volume fs, fs_vnode fromDir, const char *fromName, + fs_vnode toDir, const char *toName); status_t (*access)(fs_volume fs, fs_vnode vnode, int mode); status_t (*read_stat)(fs_volume fs, fs_vnode vnode, struct stat *stat); - status_t (*write_stat)(fs_volume fs, fs_vnode vnode, const struct stat *stat, uint32 statMask); + status_t (*write_stat)(fs_volume fs, fs_vnode vnode, + const struct stat *stat, uint32 statMask); /* file operations */ - status_t (*create)(fs_volume fs, fs_vnode dir, const char *name, int openMode, int perms, fs_cookie *_cookie, vnode_id *_newVnodeID); - status_t (*open)(fs_volume fs, fs_vnode v, int openMode, fs_cookie *_cookie); - status_t (*close)(fs_volume fs, fs_vnode v, fs_cookie cookie); - status_t (*free_cookie)(fs_volume fs, fs_vnode v, fs_cookie cookie); - status_t (*read)(fs_volume fs, fs_vnode v, fs_cookie cookie, off_t pos, void *buffer, size_t *length); - status_t (*write)(fs_volume fs, fs_vnode v, fs_cookie cookie, off_t pos, const void *buffer, size_t *length); + status_t (*create)(fs_volume fs, fs_vnode dir, const char *name, + int openMode, int perms, fs_cookie *_cookie, + vnode_id *_newVnodeID); + status_t (*open)(fs_volume fs, fs_vnode vnode, int openMode, + fs_cookie *_cookie); + status_t (*close)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); + status_t (*free_cookie)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); + status_t (*read)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, + void *buffer, size_t *length); + status_t (*write)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, + const void *buffer, size_t *length); /* directory operations */ - status_t (*create_dir)(fs_volume fs, fs_vnode parent, const char *name, int perms, vnode_id *_newVnodeID); + status_t (*create_dir)(fs_volume fs, fs_vnode parent, const char *name, + int perms, vnode_id *_newVnodeID); status_t (*remove_dir)(fs_volume fs, fs_vnode parent, const char *name); status_t (*open_dir)(fs_volume fs, fs_vnode vnode, fs_cookie *_cookie); status_t (*close_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); status_t (*free_dir_cookie)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*read_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num); + status_t (*read_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + struct dirent *buffer, size_t bufferSize, uint32 *_num); status_t (*rewind_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); /* attribute directory operations */ status_t (*open_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie *_cookie); status_t (*close_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*free_attr_dir_cookie)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*read_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num); + status_t (*free_attr_dir_cookie)(fs_volume fs, fs_vnode vnode, + fs_cookie cookie); + status_t (*read_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + struct dirent *buffer, size_t bufferSize, uint32 *_num); status_t (*rewind_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); /* attribute operations */ - status_t (*create_attr)(fs_volume fs, fs_vnode file, const char *name, uint32 type, int openMode, fs_cookie *_cookie); - status_t (*open_attr)(fs_volume fs, fs_vnode file, const char *name, int openMode, fs_cookie *_cookie); - status_t (*close_attr)(fs_volume fs, fs_vnode file, fs_cookie cookie); - status_t (*free_attr_cookie)(fs_volume fs, fs_vnode file, fs_cookie cookie); - status_t (*read_attr)(fs_volume fs, fs_vnode file, fs_cookie cookie, off_t pos, void *buffer, size_t *length); - status_t (*write_attr)(fs_volume fs, fs_vnode file, fs_cookie cookie, off_t pos, const void *buffer, size_t *length); + status_t (*create_attr)(fs_volume fs, fs_vnode vnode, const char *name, + uint32 type, int openMode, fs_cookie *_cookie); + status_t (*open_attr)(fs_volume fs, fs_vnode vnode, const char *name, + int openMode, fs_cookie *_cookie); + status_t (*close_attr)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); + status_t (*free_attr_cookie)(fs_volume fs, fs_vnode vnode, + fs_cookie cookie); + status_t (*read_attr)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + off_t pos, void *buffer, size_t *length); + status_t (*write_attr)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + off_t pos, const void *buffer, size_t *length); - status_t (*read_attr_stat)(fs_volume fs, fs_vnode file, fs_cookie cookie, struct stat *stat); - status_t (*write_attr_stat)(fs_volume fs, fs_vnode file, fs_cookie cookie, const struct stat *stat, int statMask); - status_t (*rename_attr)(fs_volume fs, fs_vnode fromFile, const char *fromName, fs_vnode toFile, const char *toName); - status_t (*remove_attr)(fs_volume fs, fs_vnode file, const char *name); + status_t (*read_attr_stat)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + struct stat *stat); + status_t (*write_attr_stat)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + const struct stat *stat, int statMask); + status_t (*rename_attr)(fs_volume fs, fs_vnode fromVnode, + const char *fromName, fs_vnode toVnode, const char *toName); + status_t (*remove_attr)(fs_volume fs, fs_vnode vnode, const char *name); /* index directory & index operations */ status_t (*open_index_dir)(fs_volume fs, fs_cookie *cookie); status_t (*close_index_dir)(fs_volume fs, fs_cookie cookie); status_t (*free_index_dir_cookie)(fs_volume fs, fs_cookie cookie); - status_t (*read_index_dir)(fs_volume fs, fs_cookie cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num); + status_t (*read_index_dir)(fs_volume fs, fs_cookie cookie, + struct dirent *buffer, size_t bufferSize, uint32 *_num); status_t (*rewind_index_dir)(fs_volume fs, fs_cookie cookie); - status_t (*create_index)(fs_volume fs, const char *name, uint32 type, uint32 flags); + status_t (*create_index)(fs_volume fs, const char *name, uint32 type, + uint32 flags); status_t (*remove_index)(fs_volume fs, const char *name); - status_t (*read_index_stat)(fs_volume fs, const char *name, struct stat *stat); + status_t (*read_index_stat)(fs_volume fs, const char *name, + struct stat *stat); /* query operations */ - status_t (*open_query)(fs_volume fs, const char *query, uint32 flags, port_id port, uint32 token, fs_cookie *_cookie); + status_t (*open_query)(fs_volume fs, const char *query, uint32 flags, + port_id port, uint32 token, fs_cookie *_cookie); status_t (*close_query)(fs_volume fs, fs_cookie cookie); status_t (*free_query_cookie)(fs_volume fs, fs_cookie cookie); status_t (*read_query)(fs_volume fs, fs_cookie cookie, @@ -215,15 +250,18 @@ typedef struct file_system_module_info { const char *parameters, disk_job_id job); status_t (*initialize)(const char *partition, const char *name, const char *parameters, disk_job_id job); - // This is pretty close to how the hook in R5 looked. Save the job ID, of - // course and that the parameters were given as (void*, size_t) pair. + // This is pretty close to how the hook in R5 looked. Save the job ID, + // of course and that the parameters were given as (void*, size_t) pair. } file_system_module_info; /* file system add-ons only prototypes */ -extern status_t new_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode); -extern status_t publish_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode); -extern status_t get_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode *_privateNode); +extern status_t new_vnode(mount_id mountID, vnode_id vnodeID, + fs_vnode privateNode); +extern status_t publish_vnode(mount_id mountID, vnode_id vnodeID, + fs_vnode privateNode); +extern status_t get_vnode(mount_id mountID, vnode_id vnodeID, + fs_vnode *_privateNode); extern status_t put_vnode(mount_id mountID, vnode_id vnodeID); extern status_t remove_vnode(mount_id mountID, vnode_id vnodeID); extern status_t unremove_vnode(mount_id mountID, vnode_id vnodeID);