subsys: fs: Add the support for multiple instances of fs
Add support for multiple instances of a file system by making use of mount point as the disk volume name which is used by the file system library while formatting or mounting a disk. Also moved out file system specific data structures from public fs.h header and handled them in corresponding file system interface files by introducing open files and open directories concept which is already being used in NFFS interface module. Now it is extended to FatFs as well. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This commit is contained in:
parent
9413682942
commit
dd5449a77b
5 changed files with 128 additions and 103 deletions
|
@ -7,14 +7,6 @@
|
|||
#ifndef _FS_INTERFACE_H_
|
||||
#define _FS_INTERFACE_H_
|
||||
|
||||
#ifdef CONFIG_FAT_FILESYSTEM_ELM
|
||||
#include <ff.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FILE_SYSTEM_NFFS
|
||||
#include <nffs/nffs.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -30,38 +22,22 @@ struct fs_mount_t;
|
|||
/**
|
||||
* @brief File object representing an open file
|
||||
*
|
||||
* @param fatfs_fp FATFS file object structure
|
||||
* @param nffs_fp NFFS file object structure
|
||||
* @param Pointer to FATFS file object structure
|
||||
* @param mp Pointer to mount point structure
|
||||
*/
|
||||
struct fs_file_t {
|
||||
union {
|
||||
#ifdef CONFIG_FAT_FILESYSTEM_ELM
|
||||
FIL fatfs_fp;
|
||||
#endif
|
||||
#ifdef CONFIG_FILE_SYSTEM_NFFS
|
||||
struct nffs_file *nffs_fp;
|
||||
#endif
|
||||
};
|
||||
void *filep;
|
||||
const struct fs_mount_t *mp;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Directory object representing an open directory
|
||||
*
|
||||
* @param fatfs_dp FATFS directory object structure
|
||||
* @param nffs_dp NFFS directory object structure
|
||||
* @param dirp Pointer to directory object structure
|
||||
* @param mp Pointer to mount point structure
|
||||
*/
|
||||
struct fs_dir_t {
|
||||
union {
|
||||
#ifdef CONFIG_FAT_FILESYSTEM_ELM
|
||||
DIR fatfs_dp;
|
||||
#endif
|
||||
#ifdef CONFIG_FILE_SYSTEM_NFFS
|
||||
struct nffs_dir *nffs_dp;
|
||||
#endif
|
||||
};
|
||||
void *dirp;
|
||||
const struct fs_mount_t *mp;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue