summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* treewide: Introduce MAP_FAILED and replace ad-hoc constants with itAndrey Smirnov2019-01-161-1/+1
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs/fat: fix FAT32 detectionAlexander Kurz2019-01-041-5/+7
| | | | | | | | | | | | Limits for the number of clusters were used to determine the FAT fs type. This fails e.g. for FAT32 fs with low cluster number that can be found in certain Android images. Sync the FAT fs type detection to the method used in linux by checking the sectors/FAT entries at offset 0x16 (must be zero for FAT32) and offset 0x24 (must be non-zero for FAT32). Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net'Sascha Hauer2018-12-072-6/+19
|\
| * fs: tftp: Make filesize a 64bit typeSascha Hauer2018-11-291-4/+4
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * net: dns: return error codesSascha Hauer2018-11-292-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The resolv() function used to return the IP address. When net_udp_new() fails we return an error code though which the callers of resolv() take as an IP address. This is wrong of course and we could return 0 in this case. Instead we return an error code and pass the resolved IP as a pointer which allows us to return proper error codes. This patch also adds error messages and error returns to the various callers of resolv() which used to just continue with a zero IP and let the user figure out what went wrong. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/missing-prototypes'Sascha Hauer2018-12-073-11/+3
|\ \
| * | fs: devfs: Make locally used function staticSascha Hauer2018-11-121-1/+1
| | | | | | | | | | | | | | | | | | devfs_iterate() is only used locally, so make it static. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: ubifs: Avoid missing prototype warningSascha Hauer2018-11-122-10/+2
| |/ | | | | | | | | | | Remove unused ubifs_iput() and make locally used functions static. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: fix possible null pointer dereference of base.Oleksij Rempel2018-11-211-1/+2
| | | | | | | | | | | | | | we use base before checking if it is NULL Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: closedir: remove uninitialized variable retOleksij Rempel2018-11-211-3/+1
|/ | | | | Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net-switch-mv88e6xxx'Sascha Hauer2018-11-091-1/+1
|\
| * drivers: Introduce dev_set_name()Andrey Smirnov2018-10-181-1/+1
| | | | | | | | | | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/missing-prototypes'Sascha Hauer2018-11-091-18/+18
|\ \
| * | fs: Make locally used functions staticSascha Hauer2018-10-191-18/+18
| |/ | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: devfs: implement d_revalidate hookSascha Hauer2018-10-291-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The files in devfs can change withouut the fs layer noticing, so we have to revalidate dentries before using them. A failure could be triggered with: ls /dev/nand0.root.ubi; ubiattach /dev/nand0.root; ls /dev/nand0.root.ubi The first 'ls' would create a dentry for nand0.root.ubi with no inode associated since it does not yet exist. 'ubiattach' then creates that file, but the second 'ls' does not show it since the dentry is not revalidated and thus no inode is added to that dentry. This patch fixes this and also the opposite case when a file is removed (for example with ubidetach). Reported-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: implement d_revalidateSascha Hauer2018-10-291-1/+36
|/ | | | | | | d_revalidate is useful when filesystems change under the hood of the fs layer. This can happen with network filesystems or with devfs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubifs'Sascha Hauer2018-10-0927-16421/+1769
|\
| * fs: ubifs: optionally allow to mount UBIFS images with encrypted filesSascha Hauer2018-10-083-1/+11
| | | | | | | | | | | | | | | | | | Currently we do not support the UBIFS file encryption feature. Nevertheless we can allow read clear files from UBIFS to be able to boot an unencrypted kernel. This differs from the Kernel behaviour, so add a globalvar to make that configurable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ubifs: Update to v4.18-rc6Sascha Hauer2018-10-0821-550/+2147
| | | | | | | | | | | | | | | | | | | | | | | | This syncs the UBIFS code with Linux-4.19-rc6. There are many functions in the Linux UBIFS codebase that we do not need for a readonly implementation. These are missing here, but all removed functions are annotated as such so it should be relatively easy to copy a newer codebase over the current one and to see which functions shall be removed from the newer version. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: ubifs: remove not needed codeSascha Hauer2018-10-0823-16206/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch aggressively removes stuff that we do not need in a readonly implementation: - write buffering support - lpt/ltab code - garbage collector - everything under #ifndef __BAREBOX__ This decreases the binary size by about 5k on ARM, but the main reason for doing this is the idea that things that are not there don't need to be synced with upstream ubifs code. The __BAREBOX__ ifdeffery makes the code very hard to read and is a maintenance burden by itself, so it is removed here aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: implement clear_nlink and set_nlinkSascha Hauer2018-10-082-35/+16
| | | | | | | | | | | | | | Implement clear_nlink and set_nlink and remove the private versions from UBIFS. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: implement iget_locked and iget_failedSascha Hauer2018-10-082-29/+24
| | | | | | | | | | | | Implement in fs core rather than using a private version in UBIFS. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: implement file_inodeSascha Hauer2018-10-081-0/+1
| | | | | | | | | | | | To ease code porting from Linux Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * Add more mutex no-opsSascha Hauer2018-10-081-3/+0
| | | | | | | | | | | | | | Add mutex_lock_nested, mutex_unlock_nested and mutex_is_locked to include/linux/mutex.h and remove them from UBIFS. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * Add kmemdupSascha Hauer2018-10-082-19/+0
| | | | | | | | | | | | | | | | We have kmemdup as a UBIFS specific variant, put it into the correct header files. Instead of reimplementing it just use memdup we already have. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * Add linux/slab.hSascha Hauer2018-10-082-24/+2
| | | | | | | | | | | | | | | | | | Move stuff we already have in include/linux/barebox-wrapper.h that really belongs to include/linux/slab.h to there. Also add kmem_cache_* functions. UBIFS uses them in there own implementation, so we have to remove it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/fs'Sascha Hauer2018-10-091-6/+7
|\ \ | |/ |/|
| * fs: improve ramfs_truncate speedMarcin Niestroj2018-10-081-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During sequential writes into single file, fs layer is consequently calling ramfs_truncate() function. When file size grows ramfs_truncate() takes more and more time to complete, due to interations through all already written data chunks. As an example loading ~450M image using usb fastboot protocol took over 500s to complete. Use ramfs_find_chunk() function to search for last chunk of data in ramfs_truncate() implementation, which saves a lot of loop iterations. As a result loading ~450M image using usb fastboot protocol takes around 25s now. Tested-by: Maciej Zagrabski <m.zagrabski@grinn-global.com> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: ramfs: make chunk counting in truncate() better readableSascha Hauer2018-09-271-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In ramfs_truncate() "newchunks" denotes the number of chunks we want to have after the call. We decrease that number while iterating over the existing chunks and decrease it further with every newly allocated chunk until "newchunks" is zero. This is a bit hard to read. Instead we drop the decreasing while iterating over existing chunks and increase "oldchunks" while allocating until it reaches "newchunks". This is mainly done to make the next patch easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: ubifs: Do not free memory not allocated by ubifsSascha Hauer2018-09-281-1/+0
| | | | | | | | | | | | | | | | | | Since the switch to dentry cache implementation we no longer allocate the super block, so we must not free it in the error path. Fixes: ("4d2b23bcf9 fs: ubifs: Switch to dentry cache implementation") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: stat: Do not forget to set errnoSascha Hauer2018-09-261-0/+3
| | | | | | | | | | | | | | | | stat() needs to set errno correctly when returning with an error. Fixes: b3fbfad7ae ("fs: dentry cache implementation") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: open: Do not forget to set errnoSascha Hauer2018-09-261-1/+1
|/ | | | | | | | | When the initial lookup fails in open we have to go to the error path which sets errno correctly rather than returning directly. Fixes: b3fbfad7ae ("fs: dentry cache implementation") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: ramfs: Free data when file is unlinkedSascha Hauer2018-09-261-1/+23
| | | | | | | | | Since the switch to dentry cache implementation the memory is no longer freed when a file in ramfs is deleted. Fix this. Fixes: b283b72639 ("fs: ramfs: Switch to dentry cache implementation") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs: fix r/w permissionsSascha Hauer2018-09-171-1/+6
| | | | | | | | | The real r/w flags were lost in the switch to dentry cache implementation. Restore them. Fixes: 9137c41915 ("fs: devfs: Switch to dentry cache implementation") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs: Create device files as character devicesSascha Hauer2018-09-171-2/+2
| | | | | | | | | | | | Without this files in /dev/ appear as regular files. copy_file() stumbles upon this as it tries a truncate() on that files which then fails. Create the files as character devices so that copy_file() works as expected. Fixes: 9137c41915 ("fs: devfs: Switch to dentry cache implementation") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Tested-by: Giorgio Dal Molin <giorgio.nicole@arcor.de>
* fs: tftp: Use pr_debug for errorsSascha Hauer2018-09-101-1/+1
| | | | | | | This has been debug output before for good reasons. The users will usually print the error messages when they want to. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: tftp: improve file size handlingSascha Hauer2018-08-301-2/+8
| | | | | | | | Previously we used FILE_SIZE_STREAM unconditionally. Instead, fill the inode size with a valid filesize if we have one and only if not fall back to FILE_SIZE_STREAM. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: tftp: hide files which are actually not present on the serverSascha Hauer2018-08-301-8/+25
| | | | | | | | | | In tftp_lookup we claimed that every desired file is there. This leads to problems when a user only tests if a file is present and makes decisions upon this information. Rather than claiming that all files are present do a tftp_do_open() on the files and see if it is really there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: tftp: fix return valueSascha Hauer2018-08-301-1/+1
| | | | | | | | When tftp_get_inode() fails it is a sign for a out of memory situtation rather than an indicator for no space left on the filesystem, so return -ENOMEM. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: tftp: fix memory holeSascha Hauer2018-08-301-10/+7
| | | | | | | dpath() returns a pointer to an allocated string, so we have to free it. Put the pointer into our file private data and free it on close time. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: tftp: overhaul debuggingSascha Hauer2018-08-301-10/+25
| | | | | | | | | - use pr_* instead of debug() - use pr_vdebug for the less interesting messages - use pr_err for error messages - print state as clear text and not as number Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/memcmds'Sascha Hauer2018-08-131-1/+1
|\
| * fs: ramfs: get chunks zero initializedSascha Hauer2018-08-101-1/+1
| | | | | | | | | | | | | | Initialize new chunks to zero, otherwise a ->truncate call may result in uninitialized data in files. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: squashfs: Switch to dentry cache implementationSascha Hauer2018-07-139-177/+365
| | | | | | | | | | | | While at it implement symlink support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: cramfs: Switch to dentry cache implementationSascha Hauer2018-07-132-251/+273
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: tftp: Switch to dentry cache implementationSascha Hauer2018-07-132-43/+55
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: nfs: Switch to dentry cache implementationSascha Hauer2018-07-132-309/+234
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: ubifs: Switch to dentry cache implementationSascha Hauer2018-07-136-484/+313
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: ext4: Switch to dentry cache implementationSascha Hauer2018-07-113-123/+160
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: devfs: Switch to dentry cache implementationSascha Hauer2018-07-112-66/+85
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>