path: root/cpukit/libfs/src (unfollow)
Commit message (Collapse)AuthorFilesLines
6 daysDo not use RTEMS_INLINE_ROUTINESebastian Huber1-2/+2
Directly use "static inline" which is available in C99 and later. This brings the RTEMS implementation closer to standard C. Close #3935.
2022-07-25imfs: Add <rtems/imfsimpl.h>Sebastian Huber11-11/+11
2022-06-21TFTPFS: Implement block and window size optionsFrank Kühndel3-658/+1800
The original file cpukit/libfs/src/ftpfs/tftpDriver.c is split into two: tftpfs.c - This file contains the code from tftpDriver.c related to file system operations such as mount(), open(), read(), and so on. tftpDriver.c - In the original file remains only the code related to networking. This code implements the Trivial File Transfer Protocol (TFTP). Moreover, the code is extended to support * RFC 2347 TFTP Option Extension * RFC 2348 TFTP Blocksize Option * RFC 7440 TFTP Windowsize Option Update #4666.
2022-06-21TFTPFS: Cleanup: Remove spaces at lines endsFrank Kühndel1-10/+10
Update #4666.
2022-06-20jffs2: Update baseline version to Linux v5.9Sebastian Huber1-2/+2
2022-06-20treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva2-1/+2
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] Signed-off-by: Gustavo A. R. Silva <>
2022-06-20jffs2: fix jffs2 mounting failureZhe Li1-1/+2
Thanks for the advice mentioned in the email. This is my v3 patch for this problem. Mounting jffs2 on nand flash will get message "failed: I/O error" with the steps listed below. 1.umount jffs2 2.erase nand flash 3.mount jffs2 on it (this mounting operation will be successful) chown or chmod to the mount point directory 5.umount jffs2 6.mount jffs2 on nand flash After step 6, we will get message "mount ... failed: I/O error". Typical image of this problem is like: Empty space found from 0x00000000 to 0x008a0000 Inode node at xx, totlen 0x00000044, #ino 1, version 1, isize 0... The reason for this mounting failure is that at the end of function jffs2_scan_medium(), jffs2 will check the used_size and some info of nr_blocks.If conditions are met, it will return -EIO. The detail is that, in the steps listed above, step 4 will write jffs2_raw_inode into flash without jffs2_raw_dirent, which will cause that there are some jffs2_raw_inode but no jffs2_raw_dirent on flash. This will meet the condition at the end of function jffs2_scan_medium() and return -EIO if we umount jffs2 and mount it again. We notice that jffs2 add the value of c->unchecked_size if we find an inode node while mounting. And jffs2 will never add the value of c->unchecked_size in other situations. So this patch add one more condition about c->unchecked_size of the judgement to fix this problem. Signed-off-by: Zhe Li <> Signed-off-by: Richard Weinberger <>
2022-06-20treewide: Remove uninitialized_var() usageKees Cook1-1/+1
Using uninitialized_var() is dangerous as it papers over real bugs[1] (or can in the future), and suppresses unrelated compiler warnings (e.g. "unused variable"). If the compiler thinks it is uninitialized, either simply initialize the variable or make compiler changes. In preparation for removing[2] the[3] macro[4], remove all remaining needless uses with the following script: git grep '\buninitialized_var\b' | cut -d: -f1 | sort -u | \ xargs perl -pi -e \ 's/\buninitialized_var\(([^\)]+)\)/\1/g; s:\s*/\* (GCC be quiet|to make compiler happy) \*/$::g;' drivers/video/fbdev/riva/riva_hw.c was manually tweaked to avoid pathological white-space. No outstanding warnings were found building allmodconfig with GCC 9.3.0 for x86_64, i386, arm64, arm, powerpc, powerpc64le, s390x, mips, sparc64, alpha, and m68k. [1] [2] [3] [4] Reviewed-by: Leon Romanovsky <> # drivers/infiniband and mlx4/mlx5 Acked-by: Jason Gunthorpe <> # IB Acked-by: Kalle Valo <> # wireless drivers Reviewed-by: Chao Yu <> # erofs Signed-off-by: Kees Cook <>
2022-06-20jffs2: Replace zero-length array with flexible-arrayGustavo A. R. Silva2-3/+3
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. [1] [2] Signed-off-by: Gustavo A. R. Silva <>
2022-06-20Revert "jffs2: Fix possible null-pointer dereferences in ↵Joel Stanley1-1/+1
jffs2_add_frag_to_fragtree()" This reverts commit f2538f999345405f7d2e1194c0c8efa4e11f7b3a. The patch stopped JFFS2 from being able to mount an existing filesystem with the following errors: jffs2: error: (77) jffs2_build_inode_fragtree: Add node to tree failed -22 jffs2: error: (77) jffs2_do_read_inode_internal: Failed to build final fragtree for inode #5377: error -22 Fixes: f2538f999345 ("jffs2: Fix possible null-pointer dereferences...") Cc: Suggested-by: Hou Tao <> Signed-off-by: Joel Stanley <> Signed-off-by: Richard Weinberger <>
2022-06-20jffs2: Fix memory leak in jffs2_scan_eraseblock() error pathWenwen Wang1-1/+4
In jffs2_scan_eraseblock(), 'sumptr' is allocated through kmalloc() if 'sumlen' is larger than 'buf_size'. However, it is not deallocated in the following execution if jffs2_fill_scan_buf() fails, leading to a memory leak bug. To fix this issue, free 'sumptr' before returning the error. Signed-off-by: Wenwen Wang <> Signed-off-by: Richard Weinberger <>
2022-06-20jffs2: Remove jffs2_gc_fetch_page and jffs2_gc_release_pageChristoph Hellwig3-35/+27
Merge these two helpers into the only callers to get rid of some amazingly bad calling conventions. Suggested-by: Al Viro <> Signed-off-by: Christoph Hellwig <> Signed-off-by: Richard Weinberger <>
2022-06-20jffs2: Fix possible null-pointer dereferences in jffs2_add_frag_to_fragtree()Jia-Ju Bai1-1/+1
In jffs2_add_frag_to_fragtree(), there is an if statement on line 223 to check whether "this" is NULL: if (this) When "this" is NULL, it is used at several places, such as on line 249: if (this->node) and on line 260: if (newfrag->ofs > this->ofs) Thus possible null-pointer dereferences may occur. To fix these bugs, -EINVAL is returned when "this" is NULL. These bugs are found by a static analysis tool STCheck written by us. Signed-off-by: Jia-Ju Bai <> Signed-off-by: Richard Weinberger <>
2022-06-20jffs2: Remove C++ style comments from uapi headerMasahiro Yamada1-5/+0
Linux kernel tolerates C++ style comments these days. Actually, the SPDX License tags for .c files start with //. On the other hand, uapi headers are written in more strict C, where the C++ comment style is forbidden. I simply dropped these lines instead of fixing the comment style. This code has been always commented out since it was added around Linux 2.4.9 (i.e. commented out for more than 17 years). 'Maybe later...' will never happen. Signed-off-by: Masahiro Yamada <> Acked-by: Richard Weinberger <> Signed-off-by: Richard Weinberger <>
2022-06-20jffs2: fix use-after-free on symlink traversalAl Viro1-1/+2
free the symlink body after the same RCU delay we have for freeing the struct inode itself, so that traversal during RCU pathwalk wouldn't step into freed memory. Signed-off-by: Al Viro <>
2022-06-20Convert jffs2 acl to struct_sizeMatthew Wilcox1-0/+1
Need to tell the compiler that the acl entries follow the acl header. Signed-off-by: Matthew Wilcox <> Signed-off-by: Kees Cook <>
2022-06-20jffs2: Use RTEMS_CONTAINER_OFSebastian Huber1-1/+1
2022-05-04rtems-rfs-dir-hash.c: Add file headers and licensesRyan Long1-0/+27
This file had no header, copyright, or license. Based on git history, added appropriate copyright and license.
2022-05-04rtems-jffs2-config.h: Add file headers and licensesRyan Long1-0/+33
This file had no header, copyright, or license. Based on git history, added appropriate copyright and license.
2022-04-07imfs: Fix index underrun when extending empty fileChristian Mauderer1-1/+2
Currently the following sequence causes a endless loop when extending an IMFS file: - Create a file with zero length and close it. - Make sure nearly no allocatable memory is left. - Open the file and write enough data into it that more than the remaining memory will be used. In that case when extending the IMFS file, the file currently need zero blocks. If allocating enough new blocks fails, the already allocated new blocks will be freed again. The comparison of block>=old_blocks that has been used prior to this patch compared two unsigned numbers. If old_blocks was zero, the comparison of these two numbers always evaluated to true. This patch frees the last block in a separate step to avoid this problem. Fixes #4639
2022-03-24cpukit/: Update Eric Norum contact info and normalize file headersJoel Sherrill1-1/+1
2022-03-22cpukit/libfs/src/rfs: Change license to BSD-2Joel Sherrill21-63/+462
Updates #3053.
2022-03-22cpukit/libds/src/ftpfs/tftpDriver.c: Manually update license to BSD-2Joel Sherrill1-8/+30
Eric Norum granted permission plus git log archeology to get year for his copyright. Updates #3053.
2022-03-22cpukit/libfs/src/imfs: Change license to BSD-2Joel Sherrill28-84/+616
Updates #3053.
2022-03-22cpukit/libfs/src/defaults: Change license to BSD-2Joel Sherrill37-111/+814
Updates #3053.
2022-03-10cpukit: Automated IMD header file clean upChristian Mauderer1-1/+1
Use the same form of IMD in all copyright lines Update #4625.
2022-03-10bsps and cpukit: Manual file header clean upChristian Mauderer1-8/+5
Updates #4625.
2022-03-10cpukit/: Scripted embedded brains header file clean upJoel Sherrill17-102/+1
Updates #4625.
2021-07-16cpukit: occured -> occurredSebastian Huber9-41/+41
2021-05-28Change filesystem utime_h handler to utimens_hRyan Long11-131/+197
Also updated licenses. Closes #4400 Updates #3899
2021-04-07cpukit/libfs: Remove nfsclientVijay Kumar Banerjee16-10797/+0
Update #3850
2021-04-07cpukit: Move ftpfs from libnetworking to libfsVijay Kumar Banerjee2-0/+2496
Update #3850
2021-03-26dosfs: Use peek supportChristian Mauderer3-5/+31
This speeds up reading fragmented files. Fix #3689
2020-12-02dosfs: Fix Doxygen group placementSebastian Huber10-25/+27
Update #3706.
2020-12-02libfs: Fix Doxygen group placementSebastian Huber6-6/+6
Update #3706.
2020-12-02nfsclient: Rework Doxygen groupsSebastian Huber8-16/+19
Update #3706.
2020-10-17libfs/rfs: Check search bit map end on last bitChris Johns1-2/+15
- Do not write past the last location of the search bit map whe nit is being created. Closes #4148
2020-08-04dosfs: Fix memory leak on failed mounts.Christian Mauderer1-0/+5
Currently if mount fails, a converter isn't destroyed. We have to take care of two cases: 1. The user doesn't provide a converter. In this case mounting a dosfs creates a default converter. This patch makes sure that the converter is destroyed again if mount failes for this case. 2. The user provides a converter. In this case it's not sure that the dosfs specific routines are reached because mount can fail before that. Therefore the user has to destroy the converter himself again. This patch adds a documentation for that and implements it in the media server. Closes #4042.
2020-07-14rtems: Remove deprecated rtems_io_lookup_name()Sebastian Huber1-21/+0
Close #3420.
2020-04-28doxygen: Switch @brief and @ingroupSebastian Huber98-98/+196
This order change fixes the Latex documentation build via Doxygen.
2020-04-16Canonicalize config.h includeSebastian Huber109-169/+169
Use the following variant which was already used by most source files: #ifdef HAVE_CONFIG_H #include "config.h" #endif
2020-03-09imfs: Replace devfs with an IMFS specializationSebastian Huber11-485/+163
Add a simplified path evaluation function IMFS_eval_path_devfs() for a device only IMFS configuration. The code size can be further reduced by the application if it disables the support for legacy IO drivers via: #define CONFIGURE_IMFS_DISABLE_MKNOD #define CONFIGURE_IMFS_DISABLE_MKNOD_DEVICE Obsolete CONFIGURE_MAXIMUM_DEVICES. Remove BSP_MAXIMUM_DEVICES. Update #3894. Update #3898.
2020-03-09imfs: Simplify code generationSebastian Huber1-11/+17
Update #3894.
2020-03-09imfs: Remove unused handlersSebastian Huber1-6/+1
Update #3894.
2020-03-09imfs: Constify imfs_memfile_bytes_per_blockSebastian Huber2-37/+0
The CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK value is validated by <rtems/confdefs/libio.h>. Changing this value during runtime could lead to memory corruption. Update #3894.
2020-03-09imfs: Use _IMFS_get_time()Sebastian Huber1-6/+5
Update #3894.
2020-03-04imfs: Add IMFS_add_node()Sebastian Huber3-5/+162
Update #3894.
2020-03-04imfs: Simplify IMFS_create_node()Sebastian Huber1-3/+4
Update #3894.
2020-03-04imfs: Remove IMFS_NODE_FLAG_NAME_ALLOCATEDSebastian Huber2-14/+39
Remove IMFS_NODE_FLAG_NAME_ALLOCATED and instead replace the node control in rename operations. This avoids a special case in the general node destruction which pulled in free(). Update #3894.
2020-01-03cpukit/libfs: remove more dead code from pipe/fifo.cGedare Bloom1-2/+0
Dead code identified by Coverity (CID 1456674). The value of ret at line 358 is always 0.