[PATCH 18/18] state: allow lookup of barebox state partition by Type GUID

Sascha Hauer sha at pengutronix.de
Thu Jun 1 01:05:26 PDT 2023


On Wed, May 31, 2023 at 04:59:27PM +0200, Ahmad Fatoum wrote:
> The backend device tree property so far always pointed at a partition.
> Let's allow pointing it at GPT storage devices directly and lookup
> the correct barebox state partition by the well-known type GUID:
> 
>   4778ed65-bf42-45fa-9c5b-287a1dc4aab1
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  common/state/state.c | 22 ++++++++++++++++++++++
>  include/driver.h     | 17 +++++++++++++++++
>  include/state.h      |  4 ++++
>  3 files changed, 43 insertions(+)
> 
> diff --git a/common/state/state.c b/common/state/state.c
> index 88e246198fb8..8f56c60b0e82 100644
> --- a/common/state/state.c
> +++ b/common/state/state.c
> @@ -21,8 +21,10 @@
>  #include <fs.h>
>  #include <crc.h>
>  #include <init.h>
> +#include <block.h>
>  #include <linux/err.h>
>  #include <linux/list.h>
> +#include <linux/uuid.h>
>  
>  #include <linux/mtd/mtd-abi.h>
>  #include <malloc.h>
> @@ -595,6 +597,8 @@ static char *cdev_to_devpath(struct cdev *cdev, off_t *offset, size_t *size)
>  }
>  #endif
>  
> +static guid_t barebox_state_partition_guid = BAREBOX_STATE_PARTITION_GUID;
> +
>  /*
>   * state_new_from_node - create a new state instance from a device_node
>   *
> @@ -641,6 +645,24 @@ struct state *state_new_from_node(struct device_node *node, bool readonly)
>  		goto out_release_state;
>  	}
>  
> +	/* Is the backend referencing an on-disk partitonable block device? */

s/partitonable/partitionable/

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list