diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-04 12:33:26 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-04 12:33:26 -0400 |
commit | d1c61416fc6ab8c39ba7249717a0b6a2a6a7fa32 (patch) | |
tree | c48efa04295d2ed5445447874ab0dd87a8a3e1bd | |
parent | fmt (diff) | |
download | comus-d1c61416fc6ab8c39ba7249717a0b6a2a6a7fa32.tar.gz comus-d1c61416fc6ab8c39ba7249717a0b6a2a6a7fa32.tar.bz2 comus-d1c61416fc6ab8c39ba7249717a0b6a2a6a7fa32.zip |
fix fs vtable
-rw-r--r-- | kernel/include/comus/fs.h | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/kernel/include/comus/fs.h b/kernel/include/comus/fs.h index 81e65ed..ba5bd4d 100644 --- a/kernel/include/comus/fs.h +++ b/kernel/include/comus/fs.h @@ -85,60 +85,78 @@ struct file_system { /// the disk this filesystem is hooked up to struct disk disk; /// get root file in file file_system + /// @param fs - the file system /// @returns the root file or NULL on failure - struct file *(*fs_get_root_file)(void); + struct file *(*fs_get_root_file)(struct file_system *fs); /// rename a file + /// @param fs - the file system /// @param file - the file to rename /// @param name - the new file name /// @returns 0 on success, or an negative fs error code on failure - int (*fs_rename_file)(struct file *file, char *name); + int (*fs_rename_file)(struct file_system *fs, struct file *file, + char *name); /// get length of file + /// @param fs - the file system /// @param file - the file to get the length of /// @param length - the pointer to save the length to /// @return 0 on success, or an negative fs error code on failure - int (*fs_get_file_length)(struct file *file, uint64_t *length); + int (*fs_get_file_length)(struct file_system *fs, struct file *file, + uint64_t *length); /// get created date of file + /// @param fs - the file system /// @param file - the file to get the date created /// @param created - the pointer to save the created date to /// @param modified - the pointer to save the modified date to /// @param accessed - the pointer to save the accessed date to /// @return 0 on success, or an negative fs error code on failure - int (*fs_get_file_dates)(struct file *file, uint64_t *created, uint64_t *modified, uint64_t *accessed); + int (*fs_get_file_dates)(struct file_system *fs, struct file *file, + uint64_t *created, uint64_t *modified, + uint64_t *accessed); /// delete a file in the file system + /// @param fs - the file system /// @param file - the file to delete /// @returns 0 on success, or an negative fs error code on failure - int (*fs_delete_file)(struct file *file); + int (*fs_delete_file)(struct file_system *fs, struct file *file); /// create a file with a given name and type + /// @param fs - the file system /// @param res - the new file structure to save the new file into /// @param parent - the parent (directory) of the file to create /// @param type - the type of file to create /// @returns 0 on success, or an negative fs error code on failure - int (*fs_new_file)(struct file **res, struct file *parent, enum file_type type); + int (*fs_new_file)(struct file_system *fs, struct file **res, + struct file *parent, enum file_type type); /// get files in a directory + /// @param fs - the file system /// @param dir - the directory to search into /// @param start - the directory entry to start at /// @param len - the max number of entrys to save starting at `start` /// @param res - the list of structures to save into /// @returns number of entries read, or an negative fs error code on failure - int (*fs_get_dir_ents)(struct file *dir, size_t start, size_t len, struct file **res); + int (*fs_get_dir_ents)(struct file_system *fs, struct file *dir, + size_t start, size_t len, struct file **res); /// read from a file + /// @param fs - the file system /// @param file - the file to read from /// @param offset - the offset of the file to read into /// @param length - the length of the file to read starting at `offset` /// @param buffer - the buffer to save the data into /// @returns number of bytes read, or an negative fs error code on failure - int (*fs_read_file)(struct file *file, size_t offset, size_t length, uint8_t *buffer); + int (*fs_read_file)(struct file_system *fs, struct file *file, + size_t offset, size_t length, uint8_t *buffer); /// write into a file + /// @param fs - the file system /// @param file - the file to write to /// @param offset - the offset of the file to write into /// @param length - the length of the data to write /// @param buffer - the buffer the data to write is stored in /// @returns number of bytes written, or an negative fs error code on failure - int (*fs_write_file)(struct file *file, size_t offset, size_t length, uint8_t *buffer); + int (*fs_write_file)(struct file_system *fs, struct file *file, + size_t offset, size_t length, uint8_t *buffer); /// close a file in the filesystem + /// @param fs - the file system /// @param file - the file to close /// @returns 0 on success, or an negative fs error coude on failure - int (*fs_close_file)(struct file *file); + int (*fs_close_file)(struct file_system *fs, struct file *file); }; // list of all disks on the system |