summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* fs: check pointer returned by get_fsdevice_by_path before dereferencingGaël PORTAY2018-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In __canonicalize_path() we dereference the pointer returned by get_fsdevice_by_path() without checking if the pointer is NULL or not. When the pointer is NULL it leads to an Ooops. Ooops, address error on load or ifetch! $ 0 : 00000000 00000001 a0000026 a0811c10 $ 4 : a0402e60 a0402e48 a0811c00 a0402e58 $ 8 : 00000001 00000000 0000005a 00000023 $12 : 00000000 00000002 00601021 00000000 $16 : a0402e60 a0402e50 a0402e39 a0810000 $20 : a0402e38 a0811420 a0811424 00000000 $24 : 00000000 a080de10 $28 : 87f87d40 a03ffa68 a0810000 a080ce30 Hi : 00000002 Lo : 00000000 epc : a080ce34 ra : a080ce30 Status: 00000006 Cause : 40008010 Config: 80040483 ### ERROR ### Please RESET the board ### Fixes: d79a81736 fs: Don't bother filesystems without link support with additional stat() calls Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ratp: allow building without full console supportAleksander Morgado2018-03-011-1/+1
| | | | | | | | | | | | | Make CONFIG_RATP a selectable config option, so that the user can enable RATP support without explicitly needing to enable the full console support over RATP (e.g. only for RATP FS or built-in command support). The full console can still be explicitly enabled with CONFIG_CONSOLE_RATP. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/zstd'Sascha Hauer2018-02-086-0/+169
|\
| * squashfs: Add zstd supportPhilipp Zabel2018-02-056-0/+169
| | | | | | | | | | | | | | | | | | | | Based on kernel commit 87bf54bb43dd ("squashfs: Add zstd support"). Creating zstd compressed squashfs images is supported by squashfs-tools newer than commit e38956b92f73 ("squashfs-tools: Add zstd support"). Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/tftp-workaround'Sascha Hauer2018-02-082-24/+35
|\ \
| * | fs/uimagefs: Use is_tftp_fs() and cache_file() to ease TFTP workaroundSascha Hauer2018-01-251-24/+13
| | | | | | | | | | | | | | | | | | | | | We have helper functions now to ease file caching when a file is on TFTP. Use them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: implement is_tftp_fs()Sascha Hauer2018-01-251-0/+22
| |/ | | | | | | | | | | | | | | | | | | Some commands need files in which they can lseek backwards which is particularly not possible on TFTP. Instead of hiding this behind can_lseek_backward() create a function for it which tests if the file is on TFTP directly rather than using different lseek operations. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | pstore: lower message prioritySascha Hauer2018-02-061-1/+1
| | | | | | | | | | | | | | | | Having no valid data in pstore after a coldstart is pretty much expected, so do not print a scary error message, but a debug message instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: add support loop mount offsetPhilipp Zabel2018-02-052-7/+13
| | | | | | | | | | | | | | | | When loop mounting, allow to specify an offset into the file, similarly to the losetup offset option. Multiplicative suffixes are supported. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: Fix memory leak in mount()Sascha Hauer2018-01-261-0/+2
|/ | | | | | | | "path" is allocated by normalise_path() and thus must be freed. This was done in the error path, but not in the success path. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-01-225-67/+3
|\
| * move parseopt to lib/Antony Pavlov2018-01-175-67/+3
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: implement ftruncateSascha Hauer2018-01-101-0/+22
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* uimage: fix: add can_lseek_backward and use in uimage_openMichael Grzeschik2017-11-101-2/+2
| | | | | | | | | | Since commit ce0cc7fe we support forward seek on tftpfs. This feature breaks the condition to check rather we open an uimage over tftp. Since backward seeking is the problem here, we add the function can_lseek_backward and check for it instead of the simple lseek. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove checks for xzalloc() returning NULLUwe Kleine-König2017-09-262-4/+0
| | | | | | | xzalloc() either returns memory or panics, so checking for NULL is useless. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* efi: make sure efi-fs is started in the right orderMichael Olbrich2017-09-081-1/+1
| | | | | | | | | with this parch, EFI System partition will be mounted to /boot instead of /mnt/diskXX. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Don't bother filesystems without link support with additional stat() callsSascha Hauer2017-09-061-0/+10
| | | | | | | | | | | | | In __canonicalize_path() we only call stat() to know if the path is a link or not. When the filesystem doesn't support links we already know that it's not a link, so we do not need to call stat(). This helps the tftp filesystem since the parent directories of a file to be opened won't be stat()ed anymore, something tftp does not support. Fixes: a602bebc fs: Implement links to directories Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: avoid pathes with '//' in __canonicalize_path()Sascha Hauer2017-09-061-2/+7
| | | | | | | | | In __canonicalize_path pathes beginning with '//' can occur. This is normally not a problem since normalize_path() will clean this up, but it means we cannot call get_fsdevice_by_path() on these pathes in this function, as needed in the next patch. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs-core: add function to find cdev by partuuidSteffen Trumtrar2017-07-101-0/+14
| | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* fs: efi: return with correct error code in efifs_statSteffen Trumtrar2017-07-101-3/+1
| | | | | | | | Instead of erroring out when a file is not present, just return ENOENT if the file does not exist and let the fs-layer handle the situation correctly. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* fs: Make locally used function canonicalize_dir() staticSascha Hauer2017-06-271-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2017-06-144-4/+151
|\
| * fs: add cdev_create_loop and cdev_remove_loop for loop mount optionPhilipp Zabel2017-06-063-6/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow to create a loopback cdev from a file. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Fixed up with: fs: Makefile: Add parseopt to all builds parseopt.h was included to fs.c with commit 9248b, but parseopt.o has a dependency to CONFIG_FS_NFS. Moved parseopt.o to the default build to eliminate build failures. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: add parseopt_b for loop mount optionPhilipp Zabel2017-06-012-0/+27
| | | | | | | | | | Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: Create automount entries for the default mount pathesSascha Hauer2017-05-102-0/+16
| | | | | | | | | | | | | | | | | | | | In barebox the default mount path for a cdev is /mnt/<cdevname> which can be mounted with "mount <cdevname>" without specifying a target path explicitly. Simplify this further by creating automount entries for the default mount pathes which makes a manual mount completely unnecessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/dts'Sascha Hauer2017-06-141-2/+2
|\ \
| * | fs: Makefile: Add parseopt to all buildsDaniel Schultz2017-06-061-2/+2
| |/ | | | | | | | | | | | | | | | | | | parseopt.h was included to fs.c with commit 9248b, but parseopt.o has a dependency to CONFIG_FS_NFS. Moved parseopt.o to the default build to eliminate build failures. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fixup! fs: Implement links to directoriesSascha Hauer2017-05-111-2/+2
| |
* | fs: Implement links to directoriesSascha Hauer2017-05-111-118/+169
| | | | | | | | | | | | | | | | | | | | | | | | So far links can only point to files. Implement links to directories. With this all kinds of links are supported: - relative links - absolute links - links including ".." - link loops (are detected, return -EMLINK) Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: drop path_check_prereq()Sascha Hauer2017-05-111-65/+48
|/ | | | | | | | | | | | | | | | | path_check_prereq() has some bugs: - It's called with S_IFLNK, but this is effectively a no-op because this case is not implemented in the function - It uses lstat, but if stat or lstat should be used depends on the usecase: For opendir() stat() must be used, since we are not interested in the link, but in the target. For readlink() lstat() must be used since we are indeed interested in the link, not the target. It's easier and better understandable to open code the functionality where it's needed, so drop path_check_prereq() and do the right thing where called. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: squashfs: fix "no previous prototype for 'squashfs_set_rootarg'" warningAntony Pavlov2017-04-101-1/+2
| | | | | | | | | | | The patch fixes this compiler's warning: fs/squashfs/squashfs.c:115:6: warning: no previous prototype for 'squashfs_set_rootarg' [-Wmissing-prototypes] void squashfs_set_rootarg(struct squashfs_priv *priv, struct fs_device_d *fsdev) ^ Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ofpart'Sascha Hauer2017-04-071-71/+11
|\
| * fs: devfs-core: replace DEVFS_IS_PARTITION flag with pointer to the master cdevSascha Hauer2017-03-311-4/+4
| | | | | | | | | | | | | | | | Instead of having a flag indicating a cdev is a partition on some master cdev, just add a master pointer to the cdev, so that we can also find out who the master is. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: devfs-core: remove unused codeSascha Hauer2017-03-311-68/+0
| | | | | | | | | | | | | | | | | | Partitions on mtd devices are implemented as mtd devices themselves which have a ioctl hook. The DEVFS_IS_PARTITION flag is never set for these devices, so the partition offset translation code in fs/devfs-core.c is unused. Remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * cdev: Collect partitions on listSascha Hauer2017-03-311-0/+8
| | | | | | | | | | | | | | We currently do not have a way to iterate over all partitions of a cdev. Change this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ext4: Use correct descriptor size when reading the block group descriptorAntony Pavlov2017-03-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an adoption of the U-Boot commit | commit f798b1dda1c5de818b806189e523d1b75db7e72d | Author: Stefan Brüns <stefan.bruens@rwth-aachen.de> | Date: Sat Sep 17 02:10:09 2016 +0200 | | ext4: Use correct descriptor size when reading the block group descriptor | | The correct descriptor size must be used when calculating offsets, and | also to read the correct amount of data. | | Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ext4: determine group descriptor size for 64bit featureAntony Pavlov2017-03-302-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an adoption of the U-Boot commits | commit fc214ef90910159f33fbe92a6cb77839a27fa8a6 | Author: Stefan Brüns <stefan.bruens@rwth-aachen.de> | Date: Sat Sep 17 02:10:07 2016 +0200 | | ext4: determine group descriptor size for 64bit feature | | If EXT4_FEATURE_INCOMPAT_64BIT is set, the descriptor can be read from | the superblocks, otherwise it defaults to 32. | | Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> | commit 3cc5bbb8e68dc67b7c3d2fdebef69408e5271469 | Author: Stefan Brüns <stefan.bruens@rwth-aachen.de> | Date: Tue Dec 27 02:35:08 2016 +0100 | | fs/ext4: Initialize group descriptor size for revision level 0 filesystems | | genext2fs creates revision level 0 filesystems, which are not readable | by u-boot due to the initialized group descriptor size field. | f798b1dda1c5de818b806189e523d1b75db7e72d | | Reported-by: Kever Yang <kever.yang@rock-chips.com> | Reported-by: FrostyBytes@protonmail.com | Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> | Tested-by: Kever Yang <kever.yang@rock-chips.com> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ext4: Update ext2/3/4 superblock, group descriptor and inode structuresAntony Pavlov2017-03-301-4/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an adoption of the U-Boot commit | commit 3ee2f977f3649bcc1d0de86356145e8e6999575a | Author: Stefan Brüns <stefan.bruens@rwth-aachen.de> | Date: Sat Sep 17 02:10:06 2016 +0200 | | ext4: Update ext2/3/4 superblock, group descriptor and inode structures | | Most importantly, the superblock provides the used group descriptor size, | which is required for the EXT4_FEATURE_INCOMPAT_64BIT. | | Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ext4: fix wrong usage of le32_to_cpu()Antony Pavlov2017-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an adoption of the U-Boot commit | commit 011bc3342a485345f7136eed20e0477b8cd5580f | Author: Michael Walle <michael@walle.cc> | Date: Mon Aug 29 10:46:46 2016 +0200 | | ext4: fix wrong usage of le32_to_cpu() | | le32_to_cpu() must only convert the revision_level and not the boolean | result. | | Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ext4: drop unused and misdefined INODE_SIZE_FILESYSTEM macroAntony Pavlov2017-03-301-2/+0
| | | | | | | | | | | | | | Nota bene sblock.inode_size actually has __le16 type. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ext4: use kernel names for byte swapsAntony Pavlov2017-03-304-39/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an adoption of the U-Boot commit | commit 7f101be314da1f6f612a1b84822f791d6569946b | Author: Michael Walle <michael@walle.cc> | Date: Mon Aug 29 10:46:44 2016 +0200 | | ext4: use kernel names for byte swaps | | Instead of __{be,le}{16,32}_to_cpu use {be,le}{16,32}_to_cpu. | | Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ext4: change structure fields to __le/__be typesAntony Pavlov2017-03-301-68/+68
|/ | | | | | | | | | | | | | | | | | | This is an adoption of the U-Boot commit | commit 2a0b7a971aac682112cf676c6583196faafcb2b0 | Author: Michael Walle <michael@walle.cc> | Date: Mon Aug 29 10:46:43 2016 +0200 | | ext4: change structure fields to __le/__be types | | Change all the types of ext2/4 fields to little endian types and all the | JBD fields to big endian types. Now we can use sparse (make C=1) to check | for statements where we need byteswaps. | | Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2017-03-132-10/+41
|\
| * tftp: implement forward seekingUwe Kleine-König2017-03-031-1/+26
| | | | | | | | | | | | | | Just abuse tftp_read to step forward. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * tftp: trivial code simplificationUwe Kleine-König2017-03-031-6/+4
| | | | | | | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lseek: tighten error checking and allow negative offsets for SEEK_ENDUwe Kleine-König2017-03-031-2/+4
| | | | | | | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lseek: ensure errno is set on failure and return -1Uwe Kleine-König2017-03-021-1/+7
| | | | | | | | | | | | | | | | All error paths before calling the driver's lseek callback return -1 and set errno. Do the same if the callback returns an error. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | efi: move x86 efi boot support to x86 archJean-Christophe PLAGNIOL-VILLARD2017-02-271-2/+2
| | | | | | | | | | | | | | prepare to drop the efi arch as efi boot up is not arch sepecific Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | efi: move bus driver to driver/efiJean-Christophe PLAGNIOL-VILLARD2017-02-242-4/+4
|/ | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Remove O_TRUNC check for devices when open filesTeresa Remmet2017-01-111-1/+1
| | | | | | | | Don't check for the file type here. Devices may have truncate callbacks. Otherwise the caller should check if O_TRUNC is possible. Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>