mirror of
https://github.com/apache/nuttx.git
synced 2026-05-18 00:34:10 +08:00
fs:support zipfs,can mount zipfile
we can mount a zipfile in nuttx use mount command like this: mount -t zipfs -o /data/test.zip /zip The zipfs is a read only file system,The advantage is that it does not occupy additional space when reading the decompressed file. When used, reading and decompression operations are simultaneous. The known disadvantage is that when using seek to read forward, it will reopen and cause slow speed problems. Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="sim"
|
||||
CONFIG_ARCH_BOARD="sim"
|
||||
CONFIG_ARCH_BOARD_SIM=y
|
||||
CONFIG_ARCH_CHIP="sim"
|
||||
CONFIG_ARCH_SIM=y
|
||||
CONFIG_BOARDCTL_APP_SYMTAB=y
|
||||
CONFIG_BOARDCTL_POWEROFF=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=0
|
||||
CONFIG_BOOT_RUNFROMEXTSRAM=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEV_GPIO=y
|
||||
CONFIG_DEV_LOOP=y
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_EXAMPLES_GPIO=y
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
CONFIG_FAT_LFN=y
|
||||
CONFIG_FSUTILS_PASSWD=y
|
||||
CONFIG_FSUTILS_PASSWD_READONLY=y
|
||||
CONFIG_FS_BINFS=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FS_HOSTFS=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_RAMMAP=y
|
||||
CONFIG_FS_ROMFS=y
|
||||
CONFIG_FS_ZIPFS=y
|
||||
CONFIG_GPIO_LOWER_HALF=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_IOEXPANDER=y
|
||||
CONFIG_IOEXPANDER_DUMMY=y
|
||||
CONFIG_LIBC_ENVPATH=y
|
||||
CONFIG_LIBC_EXECFUNCS=y
|
||||
CONFIG_LIBC_LOCALE=y
|
||||
CONFIG_LIBC_LOCALE_CATALOG=y
|
||||
CONFIG_LIBC_LOCALE_GETTEXT=y
|
||||
CONFIG_LIBC_MAX_EXITFUNS=1
|
||||
CONFIG_LIBC_NUMBERED_ARGS=y
|
||||
CONFIG_LIB_ZLIB=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_ARCHROMFS=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FATDEVNO=2
|
||||
CONFIG_NSH_FILE_APPS=y
|
||||
CONFIG_NSH_MOTD=y
|
||||
CONFIG_NSH_MOTD_STRING="MOTD: username=admin password=Administrator"
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NSH_ROMFSDEVNO=1
|
||||
CONFIG_NSH_ROMFSETC=y
|
||||
CONFIG_PATH_INITIAL="/bin"
|
||||
CONFIG_PSEUDOFS_ATTRIBUTES=y
|
||||
CONFIG_PSEUDOFS_SOFTLINKS=y
|
||||
CONFIG_READLINE_TABCOMPLETION=y
|
||||
CONFIG_SCHED_BACKTRACE=y
|
||||
CONFIG_SCHED_HAVE_PARENT=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SIM_WALLTIME_SIGNAL=y
|
||||
CONFIG_START_MONTH=6
|
||||
CONFIG_START_YEAR=2008
|
||||
CONFIG_SYSTEM_DUMPSTACK=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_UTILS_UNZIP=y
|
||||
CONFIG_UTILS_ZIP=y
|
||||
@@ -129,3 +129,4 @@ source "fs/unionfs/Kconfig"
|
||||
source "fs/userfs/Kconfig"
|
||||
source "fs/hostfs/Kconfig"
|
||||
source "fs/rpmsgfs/Kconfig"
|
||||
source "fs/zipfs/Kconfig"
|
||||
|
||||
@@ -56,6 +56,7 @@ include userfs/Make.defs
|
||||
include hostfs/Make.defs
|
||||
include littlefs/Make.defs
|
||||
include rpmsgfs/Make.defs
|
||||
include zipfs/Make.defs
|
||||
|
||||
endif
|
||||
|
||||
|
||||
@@ -181,6 +181,9 @@ extern const struct mountpt_operations g_unionfs_operations;
|
||||
#ifdef CONFIG_FS_RPMSGFS
|
||||
extern const struct mountpt_operations g_rpmsgfs_operations;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_ZIPFS
|
||||
extern const struct mountpt_operations g_zipfs_operations;
|
||||
#endif
|
||||
|
||||
static const struct fsmap_t g_nonbdfsmap[] =
|
||||
{
|
||||
@@ -213,6 +216,9 @@ static const struct fsmap_t g_nonbdfsmap[] =
|
||||
#endif
|
||||
#ifdef CONFIG_FS_RPMSGFS
|
||||
{ "rpmsgfs", &g_rpmsgfs_operations },
|
||||
#endif
|
||||
#ifdef CONFIG_FS_ZIPFS
|
||||
{ "zipfs", &g_zipfs_operations},
|
||||
#endif
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# ##############################################################################
|
||||
# fs/zipfs/CMakeLists.txt
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
|
||||
# license agreements. See the NOTICE file distributed with this work for
|
||||
# additional information regarding copyright ownership. The ASF licenses this
|
||||
# file to you under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
#
|
||||
# ##############################################################################
|
||||
|
||||
if(CONFIG_FS_ZIPFS)
|
||||
|
||||
target_sources(fs PRIVATE zip_vfs.c)
|
||||
|
||||
target_include_directories(
|
||||
fs PRIVATE ${CMAKE_CURRENT_LIST_DIR}/zlib/zlib/contrib/minizip
|
||||
${CMAKE_CURRENT_LIST_DIR}/zlib/zlib)
|
||||
endif()
|
||||
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
config FS_ZIPFS
|
||||
bool "ZIPFS File System"
|
||||
default n
|
||||
|
||||
if FS_ZIPFS
|
||||
|
||||
config ZIPFS_SEEK_BUFSIZE
|
||||
int "zipfs seek buffer size"
|
||||
default 256
|
||||
---help---
|
||||
this option will influences seek speed
|
||||
|
||||
endif # FS_ZIPFS
|
||||
@@ -0,0 +1,32 @@
|
||||
############################################################################
|
||||
# fs/zipfs/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_FS_ZIPFS),y)
|
||||
# Files required for ZIPFS file system support
|
||||
|
||||
CFLAGS += ${INCDIR_PREFIX}zipfs/zlib/zlib/contrib/minizip
|
||||
CFLAGS += ${INCDIR_PREFIX}zipfs/zlib/zlib
|
||||
CSRCS += zip_vfs.c
|
||||
# Include ZIPFS build support
|
||||
|
||||
DEPPATH += --dep-path zipfs
|
||||
VPATH += :zipfs
|
||||
|
||||
endif
|
||||
File diff suppressed because it is too large
Load Diff
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../../apps/system/zlib
|
||||
@@ -94,6 +94,7 @@
|
||||
#define USERFS_MAGIC 0x52455355
|
||||
#define CROMFS_MAGIC 0x4d4f5243
|
||||
#define RPMSGFS_MAGIC 0x54534f47
|
||||
#define ZIPFS_MAGIC 0x504b
|
||||
|
||||
#if defined(CONFIG_FS_LARGEFILE)
|
||||
# define statfs64 statfs
|
||||
|
||||
@@ -549,6 +549,20 @@ static const char *g_white_content_list[] =
|
||||
|
||||
"IRQn_Type",
|
||||
|
||||
/* Ref:
|
||||
* fs/zipfs/zip_vfs.c
|
||||
*/
|
||||
|
||||
"unzFile",
|
||||
"uLong",
|
||||
"unzOpen2_64",
|
||||
"unzLocateFile",
|
||||
"unzOpenCurrentFile",
|
||||
"unzClose",
|
||||
"unzReadCurrentFile",
|
||||
"unzGetCurrentFileInfo64",
|
||||
"unzGoToNextFile",
|
||||
"unzGoToFirstFile",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user