summaryrefslogtreecommitdiff
path: root/nuttx/fs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-10 19:29:24 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-10 19:29:24 +0000
commitbae76fc0b070b5d47d35a44c6a91692957029cf8 (patch)
treeeb3c0fa04693ffd428c362bb714b1fcbe824e08c /nuttx/fs
parent9dcf38806dd69fade9cdeb1ad0a7b0fce7f72e77 (diff)
downloadpx4-nuttx-bae76fc0b070b5d47d35a44c6a91692957029cf8.tar.gz
px4-nuttx-bae76fc0b070b5d47d35a44c6a91692957029cf8.tar.bz2
px4-nuttx-bae76fc0b070b5d47d35a44c6a91692957029cf8.zip
ROMFS filesystem support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@903 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs')
-rw-r--r--nuttx/fs/Makefile7
-rw-r--r--nuttx/fs/fs_internal.h30
-rw-r--r--nuttx/fs/fs_mount.c8
3 files changed, 35 insertions, 10 deletions
diff --git a/nuttx/fs/Makefile b/nuttx/fs/Makefile
index 14a618803..0d08c84ab 100644
--- a/nuttx/fs/Makefile
+++ b/nuttx/fs/Makefile
@@ -57,6 +57,7 @@ CSRCS += fs_registerblockdriver.c fs_unregisterblockdriver.c \
fs_fsync.c fs_unlink.c fs_rename.c \
fs_mkdir.c fs_rmdir.c
include fat/Make.defs
+include romfs/Make.defs
endif
endif
@@ -67,8 +68,8 @@ OBJS = $(AOBJS) $(COBJS)
BIN = libfs$(LIBEXT)
-SUBDIRS = fat
-VPATH = fat
+SUBDIRS = fat romfs
+VPATH = fat:romfs
all: $(BIN)
@@ -84,7 +85,7 @@ $(BIN): $(OBJS)
done ; )
.depend: Makefile $(SRCS)
- @$(MKDEP) --dep-path . --dep-path fat $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) --dep-path . --dep-path fat --dep-path romfs $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
diff --git a/nuttx/fs/fs_internal.h b/nuttx/fs/fs_internal.h
index c09716943..3ebf3f210 100644
--- a/nuttx/fs/fs_internal.h
+++ b/nuttx/fs/fs_internal.h
@@ -94,19 +94,34 @@ struct fs_psuedodir_s
struct inode *fd_next; /* The inode for the next call to readdir() */
};
-#if defined(CONFIG_FS_FAT) && !defined(CONFIG_DISABLE_MOUNTPOINT)
-/* For fat, we need to retun the start cluster, current cluster, current
+#ifndef CONFIG_DISABLE_MOUNTPOINT
+#ifdef CONFIG_FS_FAT
+/* For fat, we need to return the start cluster, current cluster, current
* sector and current directory index.
*/
struct fs_fatdir_s
{
- uint32 fd_startcluster; /* Start cluster number of the directory*/
- uint32 fd_currcluster; /* Current cluster number being read*/
- size_t fd_currsector; /* Current sector being read*/
+ uint32 fd_startcluster; /* Start cluster number of the directory */
+ uint32 fd_currcluster; /* Current cluster number being read */
+ size_t fd_currsector; /* Current sector being read */
unsigned int fd_index; /* Current index of the directory entry to read */
};
-#endif
+#endif /* CONFIG_FS_FAT */
+
+#ifdef CONFIG_FS_ROMFS
+/* For ROMFS, we need to return the offset to the current and start positions
+ * of the directory entry being read
+ */
+
+struct fs_romfsdir_s
+{
+ uint32 fr_diroffset; /* Offset to the directory entry */
+ uint32 fr_firstoffset; /* Offset to the first entry */
+ uint32 fr_curroffset; /* Current offset into the directory contents */
+};
+#endif /* CONFIG_FS_ROMFS */
+#endif /* CONFIG_DISABLE_MOUNTPOINT */
struct internal_dir_s
{
@@ -148,6 +163,9 @@ struct internal_dir_s
#ifdef CONFIG_FS_FAT
struct fs_fatdir_s fat;
#endif
+#ifdef CONFIG_FS_ROMFS
+ struct fs_romfsdir_s romfs;
+#endif
#endif
} u;
diff --git a/nuttx/fs/fs_mount.c b/nuttx/fs/fs_mount.c
index 0de22ac5a..d0806ba7d 100644
--- a/nuttx/fs/fs_mount.c
+++ b/nuttx/fs/fs_mount.c
@@ -53,7 +53,7 @@
* every configured filesystem.
*/
-#ifdef CONFIG_FS_FAT
+#ifdef CONFIG_FS_READABLE
/****************************************************************************
* Definitions
@@ -76,12 +76,18 @@ struct fsmap_t
#ifdef CONFIG_FS_FAT
extern const struct mountpt_operations fat_operations;
#endif
+#ifdef CONFIG_FS_ROMFS
+extern const struct mountpt_operations romfs_operations;
+#endif
static const struct fsmap_t g_fsmap[] =
{
#ifdef CONFIG_FS_FAT
{ "vfat", &fat_operations },
#endif
+#ifdef CONFIG_FS_ROMFS
+ { "romfs", &romfs_operations },
+#endif
{ NULL, NULL },
};