summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* fs: fix standard zero, full devicesSascha Hauer2012-07-042-5/+6
| | | | | | | | | | | | | | | | The standard devices are currently broken since they have the size ~0. As now files use loff_t as file size which is a signed type the read implementation gets confused and now returns -1. The current implementation also has the (somewhat theorical) problem that we do not have real streaming devices, so /dev/zero went out of zeroes after reading 4GB (or now LLONG_MAX). This patch introduces a new cdev flag DEVFS_IS_CHARACTER_DEV and a new file size flag FILE_SIZE_STREAM which makes it possible to create real stream devices instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/resource-size'Sascha Hauer2012-07-022-3/+3
|\ | | | | | | | | | | Conflicts: drivers/base/resource.c fs/fs.c
| * resource: store 'end' instead of 'size' in struct resourceSascha Hauer2012-07-012-3/+3
| | | | | | | | | | | | | | | | | | | | Storing the size instead of the resource end in struct resource was a mistake. 'size' ranges from 0 to UINT[32|64]_MAX + 1 which obviously leads to problems. 'end' on the other hand will never exceed UINT[32|64]_MAX. Also this way we can express a iomem region covering the whole address space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/fs'Sascha Hauer2012-07-021-0/+30
|\ \
| * | fs: Fix file create bug when parent is not a directorySascha Hauer2012-06-301-0/+30
| |/ | | | | | | | | | | | | When creating a file or a directory we have to check if the parent is actually a directory. Otherwise trying it results in a crash. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/sparse'Sascha Hauer2012-07-021-5/+5
|\ \
| * | fs FAT: fix warning: Using plain integer as NULL pointerSascha Hauer2012-06-301-5/+5
| |/ | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2012-07-021-0/+6
|\ \
| * | fs/devfs.c: disallow write and erase if a partition is read-onlyJan Luebbe2012-06-301-0/+6
| |/ | | | | | | | | Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | partitions: Make 64bit capableSascha Hauer2012-06-301-1/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | make cdev 64bit capableSascha Hauer2012-06-303-7/+8
| | | | | | | | | | | | Next step to 64bit support: Make cdev size a 64bit type. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | use loff_t for file offsetsSascha Hauer2012-06-307-15/+15
| | | | | | | | | | | | | | This is a first step for 64bit file support: Make the file sizes/offsets 64bit. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: fix arguments to bad block ioctlsSascha Hauer2012-06-301-3/+3
|/ | | | | | | | | In the Kernel the mtd ioctls expect a pointer to the offset, whereas barebox interprets the pointer itself as an offset. Since we want to add 64bit support for file sizes a pointer may not be sufficient, so align with the kernel and convert it to a pointer to the offset. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs tftp: Fix short file transfersSascha Hauer2012-06-241-1/+2
| | | | | | | | | With files smaller than the tftp block size the whole transfer is done in tftp_do_open already. In this case we are in STATE_DONE, but there is no error. Set priv->err to 0 and check for it to be able to transfer small files. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: limit flash erase and protect to the partiton boundaryJohannes Stezenbach2012-06-071-10/+8
| | | | | | | | | | | | | Passing a too large size or offset to erase could affect flash outside the partition boundary. Addresses for SPI flash wrap around, thus giving a count + offset going past the end of the flash would wrap around and erase flash at offset 0. Add the same check for protect. Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: don't erase past the end of the partitionJohannes Stezenbach2012-06-071-0/+3
| | | | | | | | "erase /dev/myflash0.mypart 0xf0000+0xf0000" could erase past the end of the partition. Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'next'Sascha Hauer2012-06-065-138/+1313
|\
| * lseek: return -1 instead of -errnoSascha Hauer2012-05-181-2/+2
| | | | | | | | | | | | | | | | | | | | The patch making errno a positive value has another bug: lseek was switched to return -errno instead of -1. This does not work since we can lseek we can address the whole 4G address space, have of which has a negative offset when interpreted as a signed integer. Let lseek return -1 on failure again instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ramfs: rember last accessed chunkJan Weitzel2012-05-161-10/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Writing big files takes longer and longer because of the chunk list By storing a pointer of the recent used chunk in the inode, access times are improved. Testet on with tftp 10M: OMAP4 chunk size 4096: 12244ms 8192: 4239ms patched 2647ms 2785ms i.MX35 chunk size 8192: 7225ms patched 2691ms No impact on much smaller files seen Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs readdir: check for NULL pointer againSascha Hauer2012-05-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This got lost in: commit 6188685091c58c9772b990cf0ca6ac522f97a9d0 Author: Sascha Hauer <s.hauer@pengutronix.de> Date: Sun May 13 12:43:58 2012 +0200 Make errno a positive value Normally errno contains a positive error value. A certain unnamed developer mixed this up while implementing U-Boot-v2. Also, normally errno is never set to zero by any library function. This patch fixes this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: Add NFS supportSascha Hauer2012-05-143-0/+1059
| | | | | | | | | | | | | | | | This patch adds readonly NFS support. Currently no links are supported. This is based on the previous U-Boot/NetBSD based code and some Kernel bits. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * Make errno a positive valueSascha Hauer2012-05-141-132/+218
| | | | | | | | | | | | | | | | | | Normally errno contains a positive error value. A certain unnamed developer mixed this up while implementing U-Boot-v2. Also, normally errno is never set to zero by any library function. This patch fixes this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs tftp: depend on NET, not on NET_TFTPSascha Hauer2012-05-311-1/+1
| | | | | | | | | | | | | | The tftp filesystem support is by no means dependent on the old tftp support, it depends on NET though. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs/tftp: depend on NET_TFTPEric Bénard2012-05-171-0/+1
|/ | | | | | | else the option remains selected when network gets disabled Signed-off-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* complete: add delpart complete supportJean-Christophe PLAGNIOL-VILLARD2012-04-301-0/+19
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Merge branch 'work/dns' into nextSascha Hauer2012-04-161-1/+1
|\
| * fs tftp: use resolv to resolv ip addressSascha Hauer2012-04-151-1/+1
| | | | | | | | | | | | | | instead of assuming the backingstore is a ip address, use resolv() to make it possible to pass in a hostname. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | automount: remove existing automountpointSascha Hauer2012-04-151-0/+2
| | | | | | | | | | | | | | Before creating a new mountpoint on an already existing mountpoint we have to remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | automount: Pass automount pass as environment variableSascha Hauer2012-04-151-4/+9
|/ | | | | | | | This makes it possible to pass a command sequence to the automount command instead of only a script (a command sequence would get confused by the additional argument) Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* FAT: Fix error pathSascha Hauer2012-03-182-6/+16
| | | | | | | - forward the return value of chk_mounted to detect whether mount succeeded - free resources on mount failure Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs open: pass error from statSascha Hauer2012-03-181-6/+6
| | | | | | | | We used to simply answer with -ENOENT in open() when the initial call to stat() failed. Instead, forward the error from stat(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add automount supportSascha Hauer2012-03-182-0/+122
| | | | | | | | | | | | | | This patch adds an automount command which makes it possible to execute a script when a certain directory is first accessed. It's the commands responsibility to make this directory available (bringing devices up and mounting it). This results in automount support which makes sure that from the shell every file can be accessed without having to care for device bringup. Bringing up devices may be expensive (USB, dhcp). The automount support makes it easy for the environment to bringup devices when they are actually needed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: drop struct mtab_entrySascha Hauer2012-03-171-45/+43
| | | | | | | | | | every struct fs_device_d contains a struct mtab_entry, so they have a 1:1 relationship. Instead of having to use container_of to get from a struct mtab_entry to a struct fs_device_d we can better embed the members of struct mtab_entry into struct fs_device_d directly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: change get_fs_device_by_path prototypeSascha Hauer2012-03-171-34/+31
| | | | | | | | | | get_fs_device_by_path returns a struct device_d instead of what the name suggests a struct fs_device_d. Also it returns the rootpath of the corresponding fs_device. This patch changes the name of this function to get_fs_device_and_root_path to better reflect what the function does and changes the return type to struct fs_device_d. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: get fs device using container_ofSascha Hauer2012-02-256-11/+5
| | | | | | This reduces the usage of dev->type_data. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: get fs driver using container_ofSascha Hauer2012-02-251-17/+16
| | | | | | This reduces the usage of dev->type_data. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add suport for tftp as a filesystemSascha Hauer2012-02-193-0/+649
| | | | | | | | | | | | | | | | | | This adds tftp filesystem support. It currently duplicates significant amounts of the tftp (command) support. This is ok since we can eventually drop the original tftp command later. tftp is not really suitable to be handled as a filesystem. It lacks support for stat, reading directories and other things. Handling it as a filesystem has one big advantage though: tftp is no special case for boot scripts and/or commands anymore which makes them simpler. This implementation has some improvements to the original tftp command. It supports blocksize negotiation which speeds up transfers if the tftp server supports it. Also we can determine the filesize to transfer if the remote end supports it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'pu/device-cleanup' into nextSascha Hauer2012-02-171-126/+107
|\
| * fs: allow to mount on subdirectoriesSascha Hauer2012-02-171-6/+7
| | | | | | | | | | | | | | | | | | Since get_mtab_entry_by_path() is a bit more flexible now we no longer have to force the user to mount on the root directory only. Instead, we can allow to mount on subdirectories aswell. Nested mounts are still not possible though. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: put fs devices on its own busSascha Hauer2012-02-171-46/+76
| | | | | | | | | | | | | | | | | | | | | | By putting the fs devices/drivers on a bus on its own we can hook into the bus remove function to cleanup the fs device. This way we can unmount a device by simply unregistering the device which is useful for for example USB mass storage devices. These can now unregister the assoiated filesystems by unregistering their child devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: remove fs devices listSascha Hauer2012-02-171-22/+1
| | | | | | | | | | | | | | | | | | | | We store the fs devices in a list only because we want to check if the fs driver needs a backingstore or not. The driver will bail out anyway if it needs a backingstore and doesn't find one. So we can remove this check and thus remove the list of fs devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: remove only once used variableSascha Hauer2012-02-171-4/+2
| | | | | | | | | | | | | | dev is used only once, so make the code a tiny bit simpler by not using an extra variable but dereference it when needed directly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: simplify get_mtab_entry_by_pathSascha Hauer2012-02-171-17/+6
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: remove unused function fsdev_get_mountpointSascha Hauer2012-02-171-5/+0
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: Store mtab path in allocated stringSascha Hauer2012-02-171-2/+3
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: make locally used function get_mtab_entry_by_path staticSascha Hauer2012-02-171-1/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: Store mtab entries in listSascha Hauer2012-02-171-45/+33
| | | | | | | | | | | | | | To make the code a bit easier to read. Also, do not allow to umount / when something else is mounted. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fat: revert fat caching mechanismSascha Hauer2012-02-151-73/+20
|/ | | | | | | | There seems to be a bug in this mechanism. It's easy to get the cached fat out of sync with the device. Revert it for now. This includes a huge write performance drop. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs-code: fix warningJean-Christophe PLAGNIOL-VILLARD2012-01-161-1/+2
| | | | | | | | /opt/work/barebox/fs/devfs-core.c: In function 'partition_ioctl': /opt/work/barebox/fs/devfs-core.c:109:27: warning: unused variable 'reg' Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ioctl: add support for ECCGETSTATS and MEMGETREGIONINFOAlexander Aring2012-01-061-6/+33
| | | | | | | | | | Support added for ioctl of ECCGETSTATS and MEMGETREGIONINFO. Fix default handling in core.c to return -EINVAL, if request was unknown. Signed-off-by: Alexander Aring <a.aring@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>