- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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 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>
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>
This fixes a bug introduced with:
commit 74c36329c3
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>
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>
This code is based on:
http://elm-chan.org/fsw/ff/00index_e.html
FatFs Generic FAT File System Module
This patch offers a read/write implementation for barebox. The code
does not exaclty match barebox coding style, but works nicely and
should be ready to give it a try.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
If we register a device we have to unregister it later when
the driver did not accept the device. Also, do not forget to
free the backingstore string.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This makes it possible to compile without devfs. devfs_create/devfs_remove
is used by drivers and thus must still be present even without devfs support.
Also, this patch adds cdev_open/cdev_close/cdev_flush/cdev_ioctl calls to
work with devices without using the file api.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Otherwise we end up with errno not being set correctly
if a filesystem driver uses the standard open/close/read/write
functions to access its backing store.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We need to assign a new device id if we want to register
a fs with the same type of an already registered fstype.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>