You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "anjiahao1 (via GitHub)" <gi...@apache.org> on 2023/09/25 09:07:47 UTC

[GitHub] [nuttx] anjiahao1 opened a new pull request, #10804: fs:support zipfs,can mount zipfile

anjiahao1 opened a new pull request, #10804:
URL: https://github.com/apache/nuttx/pull/10804

   ## Summary
   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.
   ## Impact
   fs
   ## Testing
   ```
   ./tools/configure.sh sim:zipfs
   ./nuttx
   nsh> mount -t hostfs -o /home/ajh/work /host
   nsh> mount -t zipfs -o /home/ajh/work/test.zip /zip
   nsh> ls /zip
   nsh> ls /zip
   /zip:
    a/1
    a/2
   nsh> cat /zip/a/1
   this is zipfs test 1
   nsh> cat /zip/a/2
   this is zipfs test 2
   ```
   
   ![image](https://github.com/apache/nuttx/assets/75056955/ca8cd6fa-37f9-44fd-a5bb-94f7c108c274)
   sikp the error
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] anjiahao1 commented on pull request #10804: fs:support zipfs,can mount zipfile

Posted by "anjiahao1 (via GitHub)" <gi...@apache.org>.
anjiahao1 commented on PR #10804:
URL: https://github.com/apache/nuttx/pull/10804#issuecomment-1733243840

   ![image](https://github.com/apache/nuttx/assets/75056955/63a94b9b-0588-4f00-898c-d9d49f78d24f)
   format error need skip


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 merged pull request #10804: fs:support zipfs,can mount zipfile

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #10804:
URL: https://github.com/apache/nuttx/pull/10804


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] acassis commented on a diff in pull request #10804: fs:support zipfs,can mount zipfile

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #10804:
URL: https://github.com/apache/nuttx/pull/10804#discussion_r1336334478


##########
fs/zipfs/Make.defs:
##########
@@ -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

Review Comment:
   I think you need to add minizip support first before submitting zipfs support, don't you?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] anjiahao1 commented on pull request #10804: fs:support zipfs,can mount zipfile

Posted by "anjiahao1 (via GitHub)" <gi...@apache.org>.
anjiahao1 commented on PR #10804:
URL: https://github.com/apache/nuttx/pull/10804#issuecomment-1735587463

   @acassis I added a simple document to introduce zipfs


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] acassis commented on pull request #10804: fs:support zipfs,can mount zipfile

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #10804:
URL: https://github.com/apache/nuttx/pull/10804#issuecomment-1734376269

   wow! Very nice feature @anjiahao1 ! Please include some basic Documentation/ to let more people to discover about it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #10804: fs:support zipfs,can mount zipfile

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #10804:
URL: https://github.com/apache/nuttx/pull/10804#discussion_r1336514188


##########
fs/zipfs/Make.defs:
##########
@@ -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

Review Comment:
   yes, it's here: https://github.com/apache/nuttx-apps/pull/2094



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] anchao commented on a diff in pull request #10804: fs:support zipfs,can mount zipfile

Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao commented on code in PR #10804:
URL: https://github.com/apache/nuttx/pull/10804#discussion_r1335650713


##########
fs/zipfs/zip_vfs.c:
##########
@@ -0,0 +1,655 @@
+/****************************************************************************
+ * fs/zipfs/zip_vfs.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/statfs.h>
+#include <nuttx/mutex.h>
+#include <nuttx/kmalloc.h>
+#include <nuttx/fs/fs.h>
+#include <nuttx/fs/ioctl.h>
+
+#include <unzip.h>
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct zipfs_dir_s
+{
+  struct fs_dirent_s base;
+  mutex_t lock;
+  unzFile uf;
+  bool last;
+};
+
+struct zipfs_mountpt_s
+{
+  char abspath[1];
+};
+
+struct zipfs_file_s
+{
+  unzFile uf;
+  mutex_t lock;
+  char *seekbuf;

Review Comment:
   ```suggestion
     FAR char *seekbuf;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org