summaryrefslogtreecommitdiffstats
path: root/include/file-list.h
Commit message (Collapse)AuthorAgeFilesLines
* file-list: remove unused variableSascha Hauer9 days1-2/+1
| | | | | | | | | | struct file_list::num_entries is only ever used to check if a file list is empty. Do this check with list_empty() instead and remove the unused member. Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20240417061936.3104764-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* file_list: implement file_list_add_cdev_entryAhmad Fatoum2023-06-121-0/+5
| | | | | | | | | | | | | Follow-up commit will add a first user that wants to add a cdev and more may follow, so let's provide a common file_list_add_cdev_entry they can call. The benefit of doing that in common/file-list.c is that we can avoid an extra allocation for prefixing /dev. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230609075229.1093397-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: gadget: fastboot: introduce optional flag for fastboot partitionsJohannes Zink2022-09-261-0/+1
| | | | | | | | | | | | | | | | | | | On some boards, some partitions exposed to fastboot may become unavailable under certain circumstances, e.g. if an SD-Card exposed to fastboot is removed. Previously, this lead to an error and the fastboot gadget did not initialize the remaining partitions exposed via fastboot, e.g. an eMMC which usually is permanently soldered on the board. This patch allows to append an optional flag 'o' to the description of a fastboot partition. If this partition is unavailable at the initialization of the fastboot gadget, said partition is skipped, while the remaining available partitions are still exposed. Signed-off-by: Johannes Zink <j.zink@pengutronix.de> Link: https://lore.barebox.org/20220922132410.2653284-1-j.zink@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* file_list: factor out file_list_newAhmad Fatoum2022-08-081-0/+1
| | | | | | | | | | We have the sequence for creating a new file_list at two places and follow-up commit will add a third one outside of the file, so it's a good occasion to use a common helper. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220730094615.1762042-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* file_list: add file_list_parse_null()Rouven Czerwinski2021-10-051-0/+1
| | | | | | | | | | Move the usbgadget parse() function to file_list and rename it to file_list_parse_null() which will return a NULL pointer instead of an error. Also adjust the callers in the usbgadget code. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Link: https://lore.barebox.org/20210810052928.101783-1-r.czerwinski@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* file_list: add file_list_detect_all()Ahmad Fatoum2021-05-121-0/+2
| | | | | | | | | | This is a common theme along the code that uses file_lists. Add a function that abstracts it. This could later be used to simplify this operation in the fastboot code. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-15-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fastboot/dfu: use system partitions as fall backAhmad Fatoum2021-05-121-0/+5
| | | | | | | | | | | | | Use the new system partitions infrastructure to have fastboot and DFU fall back to using the same partitions if the global.usbgadget.dfu_function and global.fastboot_partitions are not set, respectively. No functional change intended for configurations that have SYSTEM_PARTITIONS disabled. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: add generic system partitions interfaceAhmad Fatoum2021-05-121-0/+2
| | | | | | | | | | | | | | | | | | | Both Fastboot and DFU have their own global variables that allow specifying the partitions that can be flashed via the environment. With the upcoming addition of the USB mass storage gadget, we will need some way to define the partitions there as well. Instead of adding yet another way download method-specific variable, add a generic global.system.partitions variable that can be specified on a per-board basis and can be used for all methods. Existing variables will still remain for backwards-compatibility, but when unset, it should fall back to this new parameter. This is done in the follow-up patches. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* param: introduce file-list parameter typeAhmad Fatoum2021-05-121-0/+3
| | | | | | | | | | | | | | DFU, fastboot and incoming mass storage support all use file lists as input, but individually check syntax correctness only on use. A dedicated file list parameter would improve the user experience and makes the code using it easier to handle: the struct file_list can be passed around directly instead of having to parse it first on use. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: add SPDX GPL-2.0-only license tags for files without licensing ↵Roland Hieber2020-02-171-0/+1
| | | | | | | | | | | information According to our /README, GPL-2.0-only applies for the whole project except noted otherwise. Signed-off-by: Roland Hieber <rohieb@rohieb.name> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* file_list: Add ubi flagSascha Hauer2018-01-171-0/+1
| | | | | | | | | | | This flag is added to better support flashing UBI image with Android sparse images. Android fastboot splits images which are bigger than the free memory into multiple images which are then transferred in multiple fastboot sessions. In a session which is not the first one we can no longer detect if an image is a UBI image or not, so we need a flag to make this explicit. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* file_list: Add function to get entry by its nameSascha Hauer2017-09-271-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* file_list: Add function to add an entry to the listSascha Hauer2017-09-271-0/+3
| | | | | | | | Add file_list_add_entry() to add a single entry to a file_list. Then use it in file_list_parse_one() instead of open coding adding a new entry. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add function to parse a string in dfu formatSascha Hauer2014-07-221-0/+26
The dfu command parses a string which contains a list of devices and flags. This format is useful for other users aswell, so add common helper functions to parse it and let the dfu command use this format. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>