summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* fat fs: Fix compile warningSascha Hauer2012-01-051-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: pass flags to open functionSascha Hauer2011-12-152-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'pu/cramfs-fix' into nextSascha Hauer2011-12-052-59/+36
|\
| * fix cramfs support broken since zlib updateSascha Hauer2011-12-052-59/+36
| | | | | | | | | | | | | | cramfs does not compile since we updated zlib to the kernel version. Fix this by using the kernel version of uncompress.c Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ramfs: increase chunk size to 8192 bytesSascha Hauer2011-12-051-1/+1
|/ | | | | | | | dlmalloc seems to work more efficient with this chunk size. Copying a bigger file (3MB) takes 271ms vs. 125ms on a i.MX27 board. Even bigger chunk sizes do not further improve performance. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'master' into nextSascha Hauer2011-11-292-0/+9
|\ | | | | | | | | | | | | Conflicts: drivers/ata/disk_drive.c Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs/fat: Initialize local variable finfoFranck Jullien2011-11-171-0/+2
| | | | | | | | | | | | | | | | | | | | fat_stat in fs/fat.c declares finfo but doesn't initialize it. When get_fileinfo is called, fno->lfname and fno->lfsize are tested but haven't been zeroed...This can lead to a wrong behavior. Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mount: Fix the printing of device nameFranck Jullien2011-11-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mount without argument always print a "none" as device name mounted because entry->parent_device is always NULL. The problem is the mount function in fs/fs.c. parent_device is initialized to NULL and never updated. With this patch, parent_device is set with the mounted device name. Moreover, the mount function has been modified to print the device name plus device id using the dev_name function. Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Create a unique cdev number for on demand devicesJuergen Beisert2011-11-281-0/+14
|/ | | | | | | | For disk like devices attached to MCI, ATA or USB it depends on the order they will be recognized. So an unique number for all disk like devices is required. Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: read: do not call read op when count is 0Sascha Hauer2011-11-091-0/+4
| | | | | | | Some ops do not handle read with count = 0 correctly. They do not have to if this is catched in the upper layer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fix bug introduced with fixing path_check_prereq()Sascha Hauer2011-10-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | This fixes a bug introduced with: commit 74c36329c3531acf59d76a09cd0c4cf11ce6b6a0 Author: Antony Pavlov <antonynpavlov@gmail.com> Date: Tue Oct 18 13:48:44 2011 +0400 fs: fix path_check_prereq() This patch makes impossible the situations than path_check_prereq() can make 'return 0' without changing errno. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> path_check_prereq is supposed to return 0 when a file does not exist and S_UB_DOES_NOT_EXIST is given. stat() changes errno, so we have to set errno back to 0 before returning. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: fix chdir()Antony Pavlov2011-10-181-1/+2
| | | | | | | | chdir() allocates memory using mormalise_path(). But if path_check_prereq() returns error than memory isn't freed. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: fix path_check_prereq()Antony Pavlov2011-10-181-3/+4
| | | | | | | | This patch makes impossible the situations than path_check_prereq() can make 'return 0' without changing errno. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>