summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* devfs: Add optional truncate callback for device filesTeresa Remmet2017-01-111-0/+5
| | | | | | | | Not all device files have trivial fix device sizes like static ubi volumes. Here the device file size equals the image size it contains. Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: squashfs: don't reference UBI symbols if UBI isn't compiled inLucas Stach2017-01-091-0/+3
| | | | | | | | There is no point in trying to append a UBI root option, if there is no UBI support in barebox. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubifs: restore symlink supportRenaud Barbier2017-01-091-29/+0
| | | | | | | | | | | In commit a63059d7 of the latest u-boot port, the function that returns the inode number also resolves symlink. This prevents the readlink entry point from doing its job and breaks the user command readlink and the display of symlink with the ls command. Remove the code following the link to restore original functionality. Signed-off-by: Renaud Barbier <renaud.barbier@abaco.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: squashfs: Enable squashfs XZ support when XZ is enabledSascha Hauer2016-10-241-10/+7
| | | | | | | | XZ support itself is much more expensive than the squashfs XZ wrapper, so it makes sense to just compile XZ support into barebox when XZ support is available. No need to ask the user for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: squashfs: append linux rootarg for ubi volumeEnrico Jorns2016-10-241-0/+31
| | | | | | | | | | If squashfs runs from an ubi volume, append appropriate root kernel options. Note that ubiblock support is required in the kernel for that. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add filetype and detection for squashfs imagesEnrico Jorns2016-10-241-0/+1
| | | | | | | | | | | | | | | | | | | This adds `filetype_squashfs` to the list of known filetypes and adds a detection for squashfs files to file_detect_type(). This currently matches on the `hsqs` start sequence of an image file. Additionally, the newly introduced filetype is registered as the type of the squashfs_driver which allows, for example, to mount squashfs without the need to specify a type parameter. This changes enable booting a squashfs with the simple `boot` command pointing to the location (device) that holds the squashfs. Note that booting with blspec is limited as the current squashfs driver is not capable of handling symbolic links. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: squashfs: port zlib compression support from kernelEnrico Jorns2016-10-243-0/+143
| | | | | | | | As this is the default compression method for squashfs, make this the default in kconfig selection, too Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: squashfs: port lz4 compression support from kernelEnrico Jorns2016-10-243-0/+151
| | | | | Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: squashfs: port lzo compression support from kernelEnrico Jorns2016-10-243-0/+140
| | | | | | | | | This ports lzo_wrapper from kernel code and adds some minimal adaptions to make squashfs lzo compression work in barebox. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Tested-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: nfs: pick up network interface bootargs parameterEnrico Jorns2016-09-221-0/+8
| | | | | | | | | | | | This adds the linux.bootarg device parameter from the network device of the current nfs connection and adds it to the nfs bootargs line. This allows booting from nfs without manually setting a ip=dhcp or ip=<ipaddr> option. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* convert users to %pI4Sascha Hauer2016-09-221-3/+1
| | | | | | | Convert users of ip_to_string() and print_IPaddr() to %pI4 and remove the now unused functions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Check for correct open modeSascha Hauer2016-07-221-1/+11
| | | | | | | Check that readonly openen files is not written to and writeonly files is not read from. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubifs: check return pointer properlyLucas Stach2016-07-071-4/+4
| | | | | | | | ubifs_iget() returns error codes encoded in the pointer, so the NULL check will never be true. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: ext4: fix symlink read functionRonald Zachariah2016-07-071-1/+1
| | | | | | | | | | | | | | | | | | | | | From U-Boot commit: | commit 37f23885e4905ff500a8524328aa3084ac11cdb4 | Author: Ronald Zachariah <rozachar@cisco.com> | Date: Thu Apr 28 07:08:34 2016 +0200 | | fs: ext4: fix symlink read function | | The function ext4fs_read_symlink was unable to handle a symlink | which had target name of exactly 60 characters. | | Signed-off-by: Ronald Zachariah <rozachar@cisco.com> | Signed-off-by: Stefan Roese <sr@denx.de> | Reviewed-by: Stephen Warren <swarren@nvidia.com> | Cc: Tom Rini <trini@konsulko.com> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>