X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=fs%2Fbattfs.h;h=59d8fece34fe164b470996e19ef7778cb3b6cb54;hb=e5523f6098d2f4d51c838459ce83423152cc8692;hp=187eb7df882dcd2b20e005d35ca08100e55a611c;hpb=2f53e025d66c5a62df65831a7b1100f927483193;p=bertos.git diff --git a/fs/battfs.h b/fs/battfs.h index 187eb7df..59d8fece 100644 --- a/fs/battfs.h +++ b/fs/battfs.h @@ -30,7 +30,7 @@ * * --> * - * \version $Id:$ + * \version $Id$ * * \author Francesco Sacchi * @@ -207,7 +207,7 @@ typedef struct BattFsSuper disk_size_t disk_size; ///< Size of the disk, in bytes (page_count * page_size). disk_size_t free_bytes; ///< Free space on the disk. - + List file_opened_list; ///< List used to keep trace of open files. /* TODO add other fields. */ } BattFsSuper; @@ -219,7 +219,7 @@ typedef uint32_t file_size_t; ///< Type for file sizes. * Modes for battfs_fileopen. * \{ */ -#define BATTFS_CREATE BV(0) ///< Create file if dos not exist +#define BATTFS_CREATE BV(0) ///< Create file if does not exist #define BATTFS_RD BV(1) ///< Open file for reading #define BATTFS_WR BV(2) ///< Open file fir writing /*/}*/ @@ -238,6 +238,11 @@ typedef struct KFileBattFs pgcnt_t *start; ///< Pointer to page_array file start position. } KFileBattFs; +/** + * Id for battfs file descriptors. + */ +#define KFT_BATTFS MAKE_ID('B', 'T', 'F', 'S') + /** * Macro used to cast a KFile to a KFileBattFs. * Also perform dynamic type check. @@ -251,6 +256,7 @@ INLINE KFileBattFs * KFILEBATTFS(KFile *fd) bool battfs_init(struct BattFsSuper *d); bool battfs_close(struct BattFsSuper *disk); +bool battfs_fileExists(BattFsSuper *disk, inode_t inode); bool battfs_fileopen(BattFsSuper *disk, KFileBattFs *fd, inode_t inode, filemode_t mode); bool battfs_writeTestBlock(struct BattFsSuper *disk, pgcnt_t page, inode_t inode, seq_t seq, fill_t fill, pgoff_t pgoff, mark_t mark);