]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Merge branch 'include/parttypes' of https://github.com/t-8ch/util-linux
authorKarel Zak <kzak@redhat.com>
Thu, 11 Jan 2024 14:25:43 +0000 (15:25 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 11 Jan 2024 14:25:43 +0000 (15:25 +0100)
* 'include/parttypes' of https://github.com/t-8ch/util-linux:
  include: add U-Boot environment partition type
  include: add some more ChromeOS partition types

libfdisk/src/bsd.c
libfdisk/src/dos.c
libfdisk/src/fdiskP.h
libfdisk/src/gpt.c
libfdisk/src/parttype.c
libfdisk/src/sgi.c
libfdisk/src/sun.c

index c138d54b98ec05531771c4624430fabe630ef4f9..cb45e3f1ae1c98159e770cbfe7f0ef1ee5c1c7ec 100644 (file)
@@ -46,7 +46,7 @@ static const char * const bsd_dktypenames[] = {
 };
 #define BSD_DKMAXTYPES (ARRAY_SIZE(bsd_dktypenames) - 1)
 
-static struct fdisk_parttype bsd_fstypes[] = {
+static const struct fdisk_parttype bsd_fstypes[] = {
         {BSD_FS_UNUSED, "unused"},
        {BSD_FS_SWAP,   "swap"},
        {BSD_FS_V6,     "Version 6"},
index 33dbca8c311426f28bf779297810bfdfd015e1c5..ecf0b367857242f55b681114ad0968300264f635 100644 (file)
@@ -67,7 +67,7 @@ struct fdisk_dos_label {
 /*
  * Partition types
  */
-static struct fdisk_parttype dos_parttypes[] = {
+static const struct fdisk_parttype dos_parttypes[] = {
        #include "pt-mbr-partnames.h"
 };
 
index 7c0830e5737a60d05ab58469b042f05fb1c9c91c..49e057f1139e2f4189af006de067501f6ae63274 100644 (file)
@@ -286,7 +286,7 @@ enum {
 struct fdisk_label {
        const char              *name;          /* label name */
        enum fdisk_labeltype    id;             /* FDISK_DISKLABEL_* */
-       struct fdisk_parttype   *parttypes;     /* supported partitions types */
+       const struct fdisk_parttype *parttypes; /* supported partitions types */
        size_t                  nparttypes;     /* number of items in parttypes[] */
 
        const struct fdisk_shortcut *parttype_cuts;     /* partition type shortcuts */
index e4e67294be48a5f0776c5cb8d0af90130c440fe8..17ffcda8bf1290b8c8ac9d5d260c7d7d6dd55f38 100644 (file)
@@ -152,7 +152,7 @@ struct gpt_legacy_mbr {
                .name = (_n),    \
        }
 
-static struct fdisk_parttype gpt_parttypes[] =
+static const struct fdisk_parttype gpt_parttypes[] =
 {
        #include "pt-gpt-partnames.h"
 };
index 271b671464cfc42b9bc2bc124c24e827da67338b..85669327cd4b2972e3fe8f038ee151cc7d357fd1 100644 (file)
@@ -145,7 +145,7 @@ struct fdisk_parttype *fdisk_label_get_parttype(const struct fdisk_label *lb, si
 {
        if (!lb || n >= lb->nparttypes)
                return NULL;
-       return &lb->parttypes[n];
+       return (struct fdisk_parttype *)&lb->parttypes[n];
 }
 
 /**
@@ -237,7 +237,7 @@ struct fdisk_parttype *fdisk_label_get_parttype_from_code(
 
        for (i = 0; i < lb->nparttypes; i++)
                if (lb->parttypes[i].code == code)
-                       return &lb->parttypes[i];
+                       return (struct fdisk_parttype *)&lb->parttypes[i];
        return NULL;
 }
 
@@ -265,7 +265,7 @@ struct fdisk_parttype *fdisk_label_get_parttype_from_string(
        for (i = 0; i < lb->nparttypes; i++)
                if (lb->parttypes[i].typestr
                    && strcasecmp(lb->parttypes[i].typestr, str) == 0)
-                       return &lb->parttypes[i];
+                       return (struct fdisk_parttype *)&lb->parttypes[i];
 
        return NULL;
 }
@@ -324,7 +324,8 @@ static struct fdisk_parttype *parttype_from_data(
                                unsigned int *xcode,
                                int use_seqnum)
 {
-       struct fdisk_parttype *types, *ret = NULL;
+       const struct fdisk_parttype *types;
+       struct fdisk_parttype *ret = NULL;
        char *end = NULL;
 
        assert(lb);
@@ -369,7 +370,7 @@ static struct fdisk_parttype *parttype_from_data(
                        if (use_seqnum && errno == 0
                            && *end == '\0' && i > 0
                            && i - 1 < (int) lb->nparttypes)
-                               ret = &types[i - 1];
+                               ret = (struct fdisk_parttype *)&types[i - 1];
                }
        }
 
@@ -428,7 +429,7 @@ static struct fdisk_parttype *parttype_from_name(
                const char *name = lb->parttypes[i].name;
 
                if (name && *name && ul_stralnumcmp(name, str) == 0)
-                       return &lb->parttypes[i];
+                       return (struct fdisk_parttype *)&lb->parttypes[i];
        }
 
        return NULL;
index 4a2c9bbdc31e11edb1c26c9988e280a714f11808..23aafd9e340486e2c07e8288da6aab57e3f8820b 100644 (file)
@@ -41,7 +41,7 @@ struct fdisk_sgi_label {
        } freelist[SGI_MAXPARTITIONS + 1];
 };
 
-static struct fdisk_parttype sgi_parttypes[] =
+static const struct fdisk_parttype sgi_parttypes[] =
 {
        {SGI_TYPE_VOLHDR,       N_("SGI volhdr")},
        {SGI_TYPE_TRKREPL,      N_("SGI trkrepl")},
index 66fd223808160d155f0f86e18b3f32deaea350a5..cd965ab137b6c9751aec2b17bcab2c3c731da1d5 100644 (file)
@@ -35,7 +35,7 @@ struct fdisk_sun_label {
        struct sun_disklabel   *header;         /* on-disk data (pointer to cxt->firstsector) */
 };
 
-static struct fdisk_parttype sun_parttypes[] = {
+static const struct fdisk_parttype sun_parttypes[] = {
        {SUN_TAG_UNASSIGNED, N_("Unassigned")},
        {SUN_TAG_BOOT, N_("Boot")},
        {SUN_TAG_ROOT, N_("SunOS root")},