On 9/4/23 18:48, Simon Glass wrote:
Hi Heinrich,

On Sat, 2 Sept 2023 at 01:34, Heinrich Schuchardt
<heinrich.schucha...@canonical.com> wrote:

Rename disk_partition_type_uuid to disk_partition_type_guid.

Provide function descriptions for the getter and setter.

Fixes: bcd645428c34 ("part: Add accessors for struct disk_partition type_uuid")
Signed-off-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com>
---
v2:
         new patch
---
  disk/part_efi.c |  2 +-
  include/part.h  | 26 +++++++++++++++++++++++---
  2 files changed, 24 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <s...@chromium.org>

But this doesn't look like a rename

We replace *uuid by *guid. So the function is renamed.

Best regards

Heinrich




diff --git a/disk/part_efi.c b/disk/part_efi.c
index 39382c5fae..b7aef3731b 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -299,7 +299,7 @@ int part_get_info_efi(struct blk_desc *desc, int part,
         }
         if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) {
                 uuid_bin_to_str(gpt_pte[part - 1].partition_type_guid.b,
-                               (char *)disk_partition_type_uuid(info),
+                               (char *)disk_partition_type_guid(info),
                                 UUID_STR_FORMAT_GUID);
         }

diff --git a/include/part.h b/include/part.h
index f321479a5e..db34bc6bb7 100644
--- a/include/part.h
+++ b/include/part.h
@@ -108,18 +108,38 @@ static inline void disk_partition_clr_uuid(struct 
disk_partition *info)
  }

  /* Accessors for struct disk_partition field ->type_guid */
-extern char *__invalid_use_of_disk_partition_type_uuid;
+extern char *__invalid_use_of_disk_partition_type_guid;

+/**
+ * disk_partition_type_guid() - get partition type GUID
+ *
+ * By using this function to get the partition type GUID we can use
+ * 'if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID))' instead of
+ * '#ifdef CONFIG_PARTITION_TYPE_GUID'.
+ *
+ * @info:      partition information
+ * Return:     partition type GUID
+ */
  static inline const
-char *disk_partition_type_uuid(const struct disk_partition *info)
+char *disk_partition_type_guid(const struct disk_partition *info)
  {
  #ifdef CONFIG_PARTITION_TYPE_GUID
         return info->type_guid;
  #else
-       return __invalid_use_of_disk_partition_type_uuid;
+       return __invalid_use_of_disk_partition_type_guid;
  #endif
  }

+/**
+ * disk_partition_set_type_guid() - set partition type GUID
+ *
+ * By using this function to set the partition type GUID we can use
+ * 'if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID))' instead of
+ * '#ifdef CONFIG_PARTITION_TYPE_GUID'.
+ *
+ * @info:      partition information
+ * @val:       partition type GUID as string
+ */
  static inline void disk_partition_set_type_guid(struct disk_partition *info,
                                                 const char *val)
  {
--
2.40.1

Reply via email to