summaryrefslogtreecommitdiffstats
path: root/fs/devfs-core.c
Commit message (Collapse)AuthorAgeFilesLines
* cdev: implement setter/getter for cdev device nodeAhmad Fatoum2024-03-051-1/+1
| | | | | | | | | | | | | A cdev has two device tree node pointers, one directly at struct cdev.device_node and another indirectly via cdev.dev->device_node. We may want to remove cdev::device_node in future, but till then to avoid users having to guess, which device_node is the correct one, add a helper to set and get the device tree node. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240304190038.3486881-19-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: move cdev open count to cdev_open()/cdev_close()Sascha Hauer2024-02-161-2/+11
| | | | | | | | | | All code opening a cdev goes through cdev_open(), so open counting must be done there and not in devfs_open() which itself only calls cdev_open(). Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20240215074757.960200-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2024-01-231-8/+18
|\
| * cdev: add cdev_alloc helper for creating cdevsAhmad Fatoum2024-01-111-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | We have different helpers for creating cdevs, depending on whether they are loop devices, partitions or links. Create a common cdev_alloc function, so it's easier to instrument cdev creation during debugging. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240103102035.2630735-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * cdev: simplify loop in cdev_by_device_nodeAhmad Fatoum2024-01-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to compare the cdev's device node pointer both against NULL and against the searched for device node on each iteration. Instead, it's sufficient to just compare the device nodes directly. To maintain previous behavior, when searching for a NULL device node, we shouldn't return the first cdev, but return NULL. Do that via an early exit instead of doing it after iterating over all cdevs. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240103102035.2630735-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | cdev: delete partitions when deleting master cdevAhmad Fatoum2024-01-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | blockdevice_unregister only calls devfs_remove on the root cdev and leaves the partition cdevs dangling. This doesn't break until the block device parent struct device is freed at which time, it will iterate over its cdevs to free them. If there's partitions there, list_del on the partitions triggers a use after free. Fix this by removing partitions whenever the master cdev is deleted. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240103101629.2629497-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | cdev: export and use cdevfs_del_partitionAhmad Fatoum2024-01-081-8/+15
| | | | | | | | | | | | | | | | | | | | | | Like what's the case with cdevfs_add_partition, a couple of users already have a cdev, so it's wasteful to get its name and do a lookup only to arrive at the same cdev. Export a cdevfs_del_partition that directly works on the cdev and start using it instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240103101629.2629497-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | cdev: export cdevfs_add_partition for general useAhmad Fatoum2024-01-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | __devfs_add_partition was added, so it can internally be used by functions that already have a cdev and don't require looking it up first by file path. This is useful elsewhere as well, so create an exported wrapper around it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240103101629.2629497-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | cdev: make __devfs_add_partition's last argument optionalAhmad Fatoum2024-01-081-6/+8
|/ | | | | | | | | | Follow-up commit will expose __devfs_add_partition after rename to more users. Most of these don't care about the last parameter, so accept NULL to indicate that it won't be read back. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240103101629.2629497-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: check for valid flags before removing a partitionSascha Hauer2023-10-121-5/+5
| | | | | | | | When a partition is a mtd device then it is removed before checking if the cdev actually a partition. move the call to mtd_del_partition() further down to a point where we know the operation is valid. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/state'Sascha Hauer2023-06-221-16/+51
|\
| * cdev: have devfs_add_partition return existing identical partition, not NULLAhmad Fatoum2023-06-081-11/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting with commit 7f9f45b9bfef ("devfs: Do not create overlapping partitions"), any overlapping is disallowed. Overlapping can be useful though to bridge the gap between partition described in DT and via on-disk partition tables. Let's handle the case of identical partitions specially and have it neither be an error or a duplicate partition, but instead just return the existing partition and create a cdev link to it if the name differs. This existing partition will be given a device tree node and thus enabling schemes like: &{/state} { backend = <&state_part>; }; &mmc1 { partitions { compatible = "fixed-partitions"; #address-cells = <2>; #size-cells = <2>; state_part: partition@5300000 { label = "barebox-state"; /* will be folded with overlapping GPT partition if found */ reg = <0x0 0x5300000 0x0 0x100000>; }; }; }; Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230607120714.3083182-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * cdev: use more descriptive struct cdev::diskuuid/partuuidAhmad Fatoum2023-06-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UUID field has different meanings: For a master cdev: - GPT Header DiskGUID if GPT-formatted - MBR Header NT Disk Signature if MBR-formatted For a partition cdev: - GPT UniquePartitionGUID - MBR Header NT Disk Signature followed by "-${partititon_number}" Later code will add yet another UUID (Partition Type GUID), so let's make existing code more readable by using either diskuuid or partuuid as appropriate. No functional change. Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230607120714.3083182-10-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * driver: add new cdev_is_partition helperAhmad Fatoum2023-06-081-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Partitions will have cdev->master != NULL, so often code will just do if (cdev->master) to check if a cdev is a partition. This is suboptimal as it may be misinterpreted by readers as meaning that the cdev is the master device, while it's the other way round. Let's define cdev_is_partition instead and use it everywhere, where cdev->master is only checked, but not dereferenced. Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230607120714.3083182-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: stat: add basic handling for cdev linksAhmad Fatoum2023-06-011-0/+3
|/ | | | | | | | | | | | | | cdev links are not symlinks and cdev_by_name will always resolve them. As the barebox stat command is a convenience for VFS developers, it's useful to have the command identify links, so let's teach it just that. There's no behavior difference between specifying -L and not. This should be rather achieved by removing the concept of cdev links and using symlinks instead, but that's some refactoring for another time. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230531132331.2152268-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs: implement cdev_fdopenAhmad Fatoum2023-01-311-0/+20
| | | | | | | | | | | As an alternative to cdev_open and using cdev_read/write, we define a new cdev_fdopen function that returns a file descriptor. The benefit of this is that code using it may use all the more high level helpers we have for reading/writing file descriptors. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20230130072707.2423294-2-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-101-5/+5
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: Fix device name in overlap error messageUwe Kleine-König2022-07-111-1/+1
| | | | | | | | | cpart->name contains the partition name, not the device name. Use cdev->name instead. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.barebox.org/20220711090915.1487105-2-u.kleine-koenig@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: take into account for the partitions check that mtd is differentUwe Kleine-König2022-07-111-2/+13
| | | | | | | | | | | mtd partitions are separate devices. Their partition info is relative to these subdevices and so offset is 0 for them. This needs to be taken into account for the overlap check. Fixes: 7f9f45b9bfef ("devfs: Do not create overlapping partitions") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.barebox.org/20220711090915.1487105-1-u.kleine-koenig@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: create iterator for cdev listSascha Hauer2022-02-081-5/+5
| | | | | | | | This creates an iterator to iterate over all availabe cdevs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220207094953.949868-7-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: Create missing cdev_* functionsSascha Hauer2022-02-081-0/+61
| | | | | | | | | | We have several functions like cdev_read(), cdev_write() and others. For consistency create the remaining functions: cdev_lseek(), cdev_protect(), cdev_discard_range(), cdev_memmap() and cdev_truncate() Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220207094953.949868-6-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: implement cdev_open()Sascha Hauer2022-02-081-5/+11
| | | | | | | | | | | Implement cdev_open() with the expected semantics that takes a struct cdev * argument. We already have an unimplemented prototype cdev_do_open(), remove this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220207094953.949868-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename cdev_open() -> cdev_open_by_name()Sascha Hauer2022-02-081-1/+1
| | | | | | | | | | | | The cdev_* functions normally take a struct cdev * argument, with the exception of cdev_open(). Rename cdev_open() to cdev_open_by_name() to be able to implement cdev_open() with the expected semantics in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220207094953.949868-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: add diskuuid supportMichael Olbrich2022-02-081-0/+14
| | | | | | | | | | | | This allows identifying disks by UUID. For disks with GPT the disk GUID is used. For DOS partition tables the NT signature ist used, similar to how the partuuid is generated. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Link: https://lore.barebox.org/20220124100458.2924679-3-m.olbrich@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220207094953.949868-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: rename partuuid to uuidMichael Olbrich2022-02-081-1/+1
| | | | | | | | | | | Partitions are not the only devices that can have UUIDs. Change the name to something more generic to prepare for other users. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Link: https://lore.barebox.org/20220124100458.2924679-2-m.olbrich@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220207094953.949868-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: /dev/mem: handle copy at offset 0 correctlyAhmad Fatoum2021-12-071-1/+4
| | | | | | | | | | | | | | | | | | | Despite that /dev/mem has a size of 0, the check preventing out-of-bounds access works for /dev/mem as well, because of unsigned wrap around. Corner case is when offset is zero. There will be no wrap around and count = min(count, 0 - 0) = 0 Leading to unexpected behavior with e.g. memcmp -s /dev/mem 0 on systems without MMU. Fix this. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20211129071454.2014315-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: Do not create overlapping partitionsSascha Hauer2021-10-121-0/+34
| | | | | | | | | | | | | | | Until now it has been possible to create overlapping partitions. Go away from that and allow to create partitions only in unallocated areas of a device. This lowers the risk of having inconsistent partitioning and increases the chance that inconsistent partitioning is recognized by the user. We had explicit overlap checking for the environment partition which becomes unnecessary with this change and is removed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20211011073025.4187545-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nvmem: add support for new read-only memory (rmem) bindingAhmad Fatoum2021-06-211-1/+1
| | | | | | | | | | | | | Only upstream user of this binding is the raspberry pi 4 DT, where it's used to pass along bootloader-provided info to Linux. We have instances in barebox, where a previous stage bootloader passes along a memory region with info for barebox to interpret. This could in future be modelled as nvmem-rmem nodes. The binding is also quite handy for debugging. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619034516.6737-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: remove references to CREDITSUwe Kleine-König2020-04-271-3/+0
| | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs-core: do a case-insensitive compare of partuuidsAhmad Fatoum2019-10-231-1/+1
| | | | | | | | | | partuuids are represented as hexadecimal strings, where case doesn't matter. barebox formats them as lower case internally, forcing the partuuid device tree property to be lower case too. Use strcasecmp to be case-insensitive. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs-core: have device_find_partition search symlinksAhmad Fatoum2019-10-151-0/+21
| | | | | | | | | | | | | | | | | The barebox,environment binding documentation notes following for the device-path property's second string: > <partname> can be the label for MTD partitions, the number for DOS > partitions (beginning with 0) or the name for GPT partitions. This doesn't work currently because the named partitions are realized as symlinks and those aren't searched by device_find_partition. Fix this by having symlinks feature an appropriate partname if the cdev they link at has one and then have device_find_partition search those as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Share code between mem_write()/mem_read()Andrey Smirnov2019-02-061-22/+24
| | | | | | | | Rename memcpy_sz() to mem_copy() and move all of the identical code from mem_write()/mem_read() there. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Avoid division in memcpy_sz()Andrey Smirnov2019-02-061-2/+3
| | | | | | | | Instead of dividing count by rwsize, use ALIGN_DOWN() and change the loop to decrement by "rwsize" bytes. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: Drop dev_lseek_default()Andrey Smirnov2019-01-291-1/+0
| | | | | | | | | | | | | | | | | | | | | Only the following cdevs do not declare an .lseek() operation: - Console devices in common/console.c - Firmware framework in common/firmware.c - JTAG driver in drivers/misc/jtag.c - UBI in drivers/mtd/ubi/barebox.c Of those four, first two are marked DEVFS_IS_CHARACTER_DEV and implement only .write() operation and the last two don't implement anything but .ioctl(). While there's probably no meaningful way to use lseek() against any of those devices, there doesn't seem to be any harm in allowing it either. Change devfs_lseek() to ignore absense of .lseek() callback and drop dev_lseek_default() and all references to it in the codebase. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs-core: Make use of devpath_to_name()Andrey Smirnov2018-06-251-4/+2
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Move mem_write/mem_read to devfs-coreSascha Hauer2018-04-061-0/+68
| | | | | | | fs.c is already heavily filled with code. Move mem_write/mem_read to devfs-core where it fits better. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename file_operations -> cdev_operationsSascha Hauer2018-04-061-1/+1
| | | | | | | | Linux also has struct file_operations which are something different. Rename our file_operations to cdev_operations which better matches what we have. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: add support loop mount offsetPhilipp Zabel2018-02-051-4/+4
| | | | | | | | When loop mounting, allow to specify an offset into the file, similarly to the losetup offset option. Multiplicative suffixes are supported. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs-core: add function to find cdev by partuuidSteffen Trumtrar2017-07-101-0/+14
| | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* fs: add cdev_create_loop and cdev_remove_loop for loop mount optionPhilipp Zabel2017-06-061-0/+90
| | | | | | | | | | | | | | | | | | | Allow to create a loopback cdev from a file. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Fixed up with: fs: Makefile: Add parseopt to all builds parseopt.h was included to fs.c with commit 9248b, but parseopt.o has a dependency to CONFIG_FS_NFS. Moved parseopt.o to the default build to eliminate build failures. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Create automount entries for the default mount pathesSascha Hauer2017-05-101-0/+2
| | | | | | | | | | In barebox the default mount path for a cdev is /mnt/<cdevname> which can be mounted with "mount <cdevname>" without specifying a target path explicitly. Simplify this further by creating automount entries for the default mount pathes which makes a manual mount completely unnecessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs-core: replace DEVFS_IS_PARTITION flag with pointer to the master cdevSascha Hauer2017-03-311-4/+4
| | | | | | | | Instead of having a flag indicating a cdev is a partition on some master cdev, just add a master pointer to the cdev, so that we can also find out who the master is. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs-core: remove unused codeSascha Hauer2017-03-311-68/+0
| | | | | | | | | Partitions on mtd devices are implemented as mtd devices themselves which have a ioctl hook. The DEVFS_IS_PARTITION flag is never set for these devices, so the partition offset translation code in fs/devfs-core.c is unused. Remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: Collect partitions on listSascha Hauer2017-03-311-0/+8
| | | | | | | We currently do not have a way to iterate over all partitions of a cdev. Change this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Add support for marking blocks as goodSascha Hauer2016-03-151-0/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Fix erasing of devices >4GiBSascha Hauer2016-02-091-1/+1
| | | | | | | | | When a device >4GiB is erased, not only the offset can be bigger than 4GiB, but also the size. This happens with the simplest command to erase a device: erase /dev/nand0. Make the size argument a 64bit type to make this work. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: Add symlink supportSascha Hauer2016-01-081-13/+63
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: When creating a new cdev, initialize device_nodeTrent Piepho2016-01-081-1/+4
| | | | | | | | | | | | | | | If a new cdev doesn't have a device_node defined when passed to devfs_create(), set it to the device_node of the parent device, if one exists. For non-partitions, like ocotp or eeprom devices, this is the correct thing to do. Partitions need to use, and do use, a different node. The code from commit 274e0b8dc48956babeaa2faf70bf8066e656b621 to set device_node in ocotp can be removed. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs: Allow mount path in cdev_openSascha Hauer2015-10-151-1/+5
| | | | | | | When opening a cdev also allow a path beginning with /dev/ as some users of cdev_open already open coded this behaviour. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>