summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* devfs-core: return new cdev also for mtd partitionsSascha Hauer2014-04-091-1/+1
| | | | | | | __devfs_add_partition returns the newly created cdev, but in case of mtd partitions it accidently returns 0. Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubi'Sascha Hauer2014-03-073-16/+29
|\ | | | | | | | | Conflicts: drivers/mtd/ubi/cdev.c
| * fs: ubifs: rework loggingSascha Hauer2014-02-283-16/+27
| | | | | | | | | | | | | | | | By default UBIFS is very verbose. Decrease the verbosity, turn printf messages into ubifs_ messages and add device parameters for the values which are not printed anymore. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: ubifs: Fix unused function warningSascha Hauer2014-02-281-0/+2
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/partitionhelper'Sascha Hauer2014-03-071-17/+83
|\ \ | | | | | | | | | | | | Conflicts: fs/devfs-core.c
| * | devfs: partitioning: add new helper devfs_create_partitionsUwe Kleine-König2014-02-281-17/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compared to devfs_add_partition which adds a single partition devfs_create_partitions creates several partitions at once. One nice benefit is that this simplifies appending partitions because the start of the latter partition doesn't need to be specified explicitly. Also dev_add_bb_dev() is called by the new helper if the bbname is specified for a partition. Note that adding partitions is also more flexible now (also via devfs_add_partition) because negative values for offset and size now have a proper meaning instead of creating broken partitions. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | devfs_add_partition: make flags parameter unsignedUwe Kleine-König2014-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The value is only used to assign to a (*struct cdev)->flags which is an unsigned int and it is passed as fourth parameter of mtd_add_partition which is an unsigned long. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | devfs: partitioning: add missing free in error pathUwe Kleine-König2014-02-281-0/+1
| |/ | | | | | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/nfs'Sascha Hauer2014-03-075-319/+702
|\ \ | | | | | | | | | | | | Conflicts: defaultenv/defaultenv-2-base/bin/ifup
| * | run_command: remove unused flag parameterSascha Hauer2014-03-071-1/+1
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nfs: parse nfsport and mount port from file system optionsUwe Kleine-König2014-02-104-12/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows to use unfs3 on the server side which doesn't integrate into portmap/rpcbind which results in the port not being impossible to lookup via rpc calls to the portmap program. Use it like: mount -t nfs -o port=2703,mountport=2703 192.168.77.157:/root /mnt/nfs Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mount: support filesystem options passed via -oUwe Kleine-König2014-02-101-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to mount(8) the barebox command mount now supports passing a string to the file system driver via -o. This is used in the next commit to let the user specify port numbers for nfs mounts. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nfs: switch to nfs3Uwe Kleine-König2014-02-101-269/+625
| | | | | | | | | | | | | | | | | | | | | This was tested against nfs-kernel-server and unfs3. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nfs: drop an unneeded variable from nfs_do_open()Uwe Kleine-König2014-02-101-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | While at it also fix the type of flen holding a string length (int -> size_t). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nfs: simplify rpc_lookup_reqUwe Kleine-König2014-02-101-18/+6
| | | | | | | | | | | | | | | | | | | | | | | | Instead of letting rpc_lookup_req set mount_port and nfs_port, let it return the port found and let the caller use that information. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nfs: shorten and simplify rpc_add_credentials a bitUwe Kleine-König2014-02-101-21/+5
| | | | | | | | | | | | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nfs: skip over stale rpc packetsUwe Kleine-König2014-02-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a former transaction was aborted by hitting Ctrl-C the old reply might still hang in the ethernet controller making all further transactions fail. So just skip over old replies. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nfs: fix mount prog version in portmap lookupUwe Kleine-König2014-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | We're speaking rpc mount version 2 (i.e. the same version as the implemented nfs protocol), so also specify that in the lookup. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/mtd'Sascha Hauer2014-03-071-16/+14
|\ \ \ | | | | | | | | | | | | | | | | | | | | Conflicts: drivers/mtd/core.c net/eth.c
| * | | mtd: register mtd partitions as real mtd devicesSascha Hauer2014-02-261-16/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far mtd partitions were mtd devices, but these were not registered. This patch changes this. mtd partitions are now registered like real mtd devices. This makes them part of the device hierarchy. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | Merge branch 'for-next/misc'Sascha Hauer2014-03-071-2/+1
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | Conflicts: common/environment.c
| * | | bpkfs: fix compiler warningAlexander Aring2014-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Correct formatstring of size_t is %zu otherwise we get: fs/bpkfs.c: In function ‘bpkfs_probe’: fs/bpkfs.c:440:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat=] dev_dbg(dev, "%d: offset = %d\n", i, d->offset); Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | bpkfs: remove twice include of fs.hAlexander Aring2014-02-101-1/+0
| | |/ | |/| | | | | | | | | | Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | fs: tftp: Fix writing files to tftpSascha Hauer2014-02-261-1/+9
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Copying files to tftp is broken since: | commit d4f5bb1e011ac653a167031554f0ac9e028e9e36 | Author: Sascha Hauer <s.hauer@pengutronix.de> | Date: Sat Sep 28 13:12:50 2013 +0200 | | copy_file: Add missing O_TRUNC | | Without it, when copying a smaller file over a larger file the | resulting file still has the remaining space from the larger file. | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Since this commit copy_file passes O_TRUNC to open(). This results in the fs layer calling fsdrv->truncate. tftp returns -ENOSYS here and open returns with an error. To fix this return 0 for the truncate callback in tftp. Also enforce the O_TRUNC flag when opening a file for writing on tftp as the files are always truncated on tftp anyway. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: andreas.willig@rafi.de
* | read_file: Use read_fullSascha Hauer2014-02-131-1/+2
|/ | | | | | | | At least NFS does not fulfill read requests > 1024 bytes at once. Use read_full in read_file as read doesn't guarantee that the whole request can be read at once. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBIFS: implement readlink entry pointRenaud Barbier2014-01-301-0/+38
| | | | | | | Implement the readlink entry point for future use by the DA923RC. Signed-off-by: Renaud Barbier <renaud.barbier@ge.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs ubifs: Use pr_* for printing messagesSascha Hauer2014-01-162-8/+8
| | | | | | | Unline the printk(KERN_* the pr_* functions cooperate with the barebox loglevel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Add subpagesize to mtd_info_userSascha Hauer2013-12-201-0/+1
| | | | | | | | | ubiformat needs the subpagesize to work correctly. The kernel uses sysfs to pass the subpagesize, but in barebox we have the possibility to extend struct mtd_info_user. Add a corresponding field and use it in ubiformat. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Fix endless loop in automount codeSascha Hauer2013-11-271-0/+2
| | | | | | | | | | A chdir to a path registered as an automount path followed by a 'ls' results in an endless loop. This happens because the command the automounter executes results in another automount request. Fix this by running the automounter from the chdir code before the cwd is actually changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Add function to get cdev by mountpathSascha Hauer2013-11-051-0/+13
| | | | | | This is useful to know for the bootloader spec implementation. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubifs: Remove redundant assignmentAlexander Shiyan2013-10-222-2/+0
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: ignore O_TRUNC open flag for devicesSascha Hauer2013-10-161-2/+1
| | | | | | | | | | | | | | | | | | The O_TRUNC flag has to be ignored when opening devices. Otherwise cp /somefile /dev/somedev fails. This is broken since: | commit d4f5bb1e011ac653a167031554f0ac9e028e9e36 | Author: Sascha Hauer <s.hauer@pengutronix.de> | Date: Sat Sep 28 13:12:50 2013 +0200 | | copy_file: Add missing O_TRUNC | | Without it, when copying a smaller file over a larger file the | resulting file still has the remaining space from the larger file. | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mount'Sascha Hauer2013-10-075-52/+126
|\
| * fs: add cdev mount helpersSascha Hauer2013-09-301-0/+80
| | | | | | | | | | | | | | Introduce helpers to iterate over cdevs and mount them to a known path. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: use bus_for_each_driverSascha Hauer2013-09-291-4/+1
| | | | | | | | | | | | Instead of using for_each_driver and testing for the bus type. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: cleanup backingstore handlingSascha Hauer2013-09-295-48/+45
| | | | | | | | | | | | | | | | | | | | | | All filesystem drivers which need a backingstore device do the same ignoring of '/dev/' in the backingstore followed by a cdev_open. Add a helper function for it and let the core handle the cdev. As a side effect this makes sure that fsdev->cdev is also set when a device is mounted without the leading '/dev/' which was previously ignored by the mount code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/fs'Sascha Hauer2013-10-073-0/+559
|\ \ | | | | | | | | | | | | | | | Conflicts: fs/Kconfig fs/Makefile
| * | fs: add uimagefsJean-Christophe PLAGNIOL-VILLARD2013-09-273-0/+559
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this will provide the image data and information via file # ls -l /tmp/ -rwxrwxrwx 3 arch -rwxrwxrwx 12 compression -rwxrwxrwx 16 name -rwxrwxrwx 5 os -rwxrwxrwx 24 time -rwxrwxrwx 12 type -rwxrwxrwx 10 load_addr -rwxrwxrwx 10 entry_point -rwxrwxrwx 2199875 data0 -rwxrwxrwx 2199875 data -rwxrwxrwx 10 data.crc if it's multi image # ls -l /tmp-multi/ -rwxrwxrwx 3 arch -rwxrwxrwx 12 compression -rwxrwxrwx 16 name -rwxrwxrwx 5 os -rwxrwxrwx 24 time -rwxrwxrwx 16 type -rwxrwxrwx 10 load_addr -rwxrwxrwx 10 entry_point -rwxrwxrwx 1292 data0 -rwxrwxrwx 983 data1 -rwxrwxrwx 2287 data -rwxrwxrwx 10 data.crc you can get the image header via an ioctl on any file UIMAGEFS_METADATA if you want to check the crc do # crc32 -f /tmp-multi/data -V /tmp-multi/data.crc CRC32 for /tmp-multi/data 0x00000000 ... 0x000008ee ==> 0x88d5a0db Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / fs: add BPKFS supportJean-Christophe PLAGNIOL-VILLARD2013-10-063-0/+530
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simple update file format developed for Somfy, tools and library are available under LGPLv2 (https://www.gitorious.org/libbpk). This format in the v1.0 allow you to store 6 types a binary stream for a unique hardware id: - bootloader - bootloader_version - description.gz - kernel - rootfs - firmware_version and you can easly add more binary stream type. The fs will display you in a directory per hw id and if a binary stream type is unknown will be display as unknown_%08x # mount image.bpk /tmp # ls -l /tmp/hw_id_0/ -rwxrwxrwx 10 firmware_version -rwxrwxrwx 8 firmware_version.crc -rwxrwxrwx 1845968 kernel -rwxrwxrwx 8 kernel.crc -rwxrwxrwx 5062656 rootfs -rwxrwxrwx 8 rootfs.crc -rwxrwxrwx 248 bootloader -rwxrwxrwx 8 bootloader.crc -rwxrwxrwx 248925 description.gz -rwxrwxrwx 8 description.gz.crc -rwxrwxrwx 4 bootloader_version -rwxrwxrwx 8 bootloader_version.crc -rwxrwxrwx 4 unknown_1234567g -rwxrwxrwx 8 unknown_1234567g.crc Why BPK and not CPIO or uImage 1) CPIO cpio does not handle > 4GiB image and does not have any crc checksum 2) uImage uImage only provide one crc32 for the all data part and only a list of binary stream with no information about what is what (in multi-image format) 3) BPK BPK provide a crc32 for the header part and one crc32 per binary stream so if you does not care of some data you are not force to check them And you known exactly the binary stream type and for which hw to use it. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Fargier Sylvain <sylvain.fargier@somfy.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Fix lseek on fat filesystems.Fargier Sylvain2013-09-181-0/+1
| | | | | | | | FILE object was not updated properly when seeking. Signed-off-by: Fargier Sylvain <sylvain.fargier@somfy.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2013-09-051-1/+1
|\
| * fs: tftp: don't duplicate timeout informationBaruch Siach2013-08-121-1/+1
| | | | | | | | | | Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: Add ubifs supportSascha Hauer2013-08-0728-0/+15531
|/ | | | | | | | This adds ubifs support from u-boot-2013.07. This is taken mostly as-is, only the necessary adjustments to attach to the barebox fs layer have been made. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: add device_find_partitionSascha Hauer2013-07-151-0/+27
| | | | | | | device_find_partition allows to find a partition of a device with a particular name. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: allow to open a struct cdevSascha Hauer2013-07-151-5/+11
| | | | | | | cdev_open() opens a cdev by name. This introduces cdev_do_open which allows to open a cdev when the cdev is already found by other means. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: introduce partition namesSascha Hauer2013-07-151-0/+3
| | | | | | | | currently most partition cdevs have the name <devname>.<partname> This makes it hard to find a partition by <partname>. This introduces a partname field in struct cdev so that. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: let devfs_add_partition return the new partitionSascha Hauer2013-07-151-6/+6
| | | | | | Useful for unregistering later or for adding addional flags. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* read_file: Make it work on tftp servers which do not pass sizeSascha Hauer2013-06-202-1/+22
| | | | | | | | Some tftp servers (for example netkit-tftp) do not pass the filesize. Add a workaround for read_file which reads the file into a temporary file which then is copied to a buffer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/pr_print'Sascha Hauer2013-04-041-6/+6
|\
| * ext4: switch debug and printf to dev_xxxJean-Christophe PLAGNIOL-VILLARD2013-03-091-6/+6
| | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>