diff --git a/main/mdadm/APKBUILD b/main/mdadm/APKBUILD index 78f24686e3d..3d8f6dd8a91 100644 --- a/main/mdadm/APKBUILD +++ b/main/mdadm/APKBUILD @@ -2,20 +2,23 @@ # Contributor: Carlo Landmeter # Maintainer: Natanael Copa pkgname=mdadm -pkgver=4.2 -pkgrel=4 +pkgver=4.3 +pkgrel=0 pkgdesc="a tool for managing Linux Software RAID arrays" url="https://raid.wiki.kernel.org/index.php/A_guide_to_mdadm" arch="all" license="GPL-2.0-only" depends="lsblk" -makedepends="groff linux-headers" +makedepends="eudev-dev groff linux-headers" checkdepends="bash eudev e2fsprogs" subpackages="$pkgname-doc $pkgname-udev::noarch $pkgname-misc::noarch $pkgname-openrc" source="https://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-$pkgver.tar.gz $pkgname.initd $pkgname.confd $pkgname-raid.initd + basename.patch + Create.c-fix-build.patch + util.c-include-limits.h.patch lfs64.patch no-werror.patch mdadm-include-sysmacros.patch @@ -66,12 +69,15 @@ misc() { } sha512sums=" -112a897c6943d7343f44ffe32a8d7ef11e1f1624f51385c0f1d27458d661202bb378678a3ddc78ed2e24533be234441ea15cf33769345d5709b72b72ad9ec540 mdadm-4.2.tar.gz +a77af2b371ed27b7bd89b7991302282f0fc77999eb93d7959446fc4b1c28388582d08ff0abfc470a9f9a8c8036acb0158edc44d9a8d406f807ca28111bf74459 mdadm-4.3.tar.gz ca5f4e3ff5b284102b44e818d11622e1889066e3d18edce2d62c1a44ee8f4cfdc0979121c0462a916c638423c5ebc706c46aa996a7c4f68e030589adc62803f4 mdadm.initd 7d45bf489ef93a4f217ffcf72311eb661b8de7fbf63a5344697252c0d3a684b0123ff60efa5f218da4eb4cda7c88d91c2ef3625d5e44a588e3e1210cb60b0ab9 mdadm.confd 10d2456ca82c353c9b8540ca996de48575a60b83ede5b0bb7e960b4dd28aac2aa73eaeff4bdb99d03ce9630f986c2023b38fe332c5be74e0234985af6273a934 mdadm-raid.initd -df8b5d78000c416652da07e46d94c5c3b8afa48619a360b0a33290420f718bf88069ff4cf62537cc510208fae95b5632a9f340fe97d1aa31661b031bd4dc5d71 lfs64.patch -d3e67b8d4f41996007a4b6dd28666e844925e071cd59530b9611590d536dd206375e372f56bca25cbdf45def41ffe199bd4bf64688436cdd5ac71a6ff699d95d no-werror.patch -e711c15fada5fc98984f43f90a8ab3b6a2a20e9b91c56b5672fdb0ea127b61934b2f0c6ca986bd91c96c56b66f46326cb616101a62e4bfebe3a2b0d33ed2465c mdadm-include-sysmacros.patch -d7aeac1ce8e1b17bfdc6178551aaee364b731003e03b1d0c713ee879ac3f82164dff70999ad56c0e91c4bf90c5bca7708bdbb5d2a57e032fd0291828a917b054 fix-monitor-tv_sec.patch +cb980a8f0249aa56e01afb34f4e456a1486dd32aca418f723277ffb1e30d311e27f54991d6c82cc02b2f4e6d98c34f2fbaf96b416414dd32bdc2478a75c9f71a basename.patch +40c1935a0f0491bac6b33205883c1920b4ce5830f100462ae448f8f34d143d0de716007d6b14a207879192c73c10141e7ecf414a866b51cf52652950d781e0cc Create.c-fix-build.patch +6513bef2ccf2bfa9caa536f1475161f6a207f202be48dde4d4516b5817f03e1da77cdbf646666d39729a34296ed14413348518f96727926e8b7398f17c8d9e2a util.c-include-limits.h.patch +0516df3117618e46b9699d427f3c3601701906bbdb1b2f8fb913e443c21f0fba021e66fb352f9d97678e1394e05c9f4fd041fc3f1f14953d219bbcd804eb6d55 lfs64.patch +e01f1eeb35c0890505004f1e35c8f73de5d1b406c64bc24d0d8577ab3fdbd60b1b912f9321e266a298251cbd92f0fe35a8663d174eedd4c77609e1613c57368c no-werror.patch +40994227cb4cab3cd890e674ad78cb1fd1d5dcb4a577c86dc1948d465fe5e95092809788bf97c917cee038f5be1cd376c453e69dc28ecb6accb3a1aa3d79c01d mdadm-include-sysmacros.patch +5d337f39d8f9b95447d4b6e0b9b1442a9893ea7f47b25687df0c7ad67a47f151900bfbcbd4ebf43ee2833f8643696df163b931c389b0a6498be7e2377913b965 fix-monitor-tv_sec.patch " diff --git a/main/mdadm/Create.c-fix-build.patch b/main/mdadm/Create.c-fix-build.patch new file mode 100644 index 00000000000..8ec0c127266 --- /dev/null +++ b/main/mdadm/Create.c-fix-build.patch @@ -0,0 +1,41 @@ +From 52bead95d2957437c691891fcdc49bd6afccdd49 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Fri, 12 Apr 2024 18:45:13 +0200 +Subject: [PATCH] Create.c: fix uclibc build + +Define FALLOC_FL_ZERO_RANGE if needed as FALLOC_FL_ZERO_RANGE is only +defined for aarch64 on uclibc-ng resulting in the following or1k build +failure since commit 577fd10486d8d1472a6b559066f344ac30a3a391: + +Create.c: In function 'write_zeroes_fork': +Create.c:155:35: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function) + 155 | if (fallocate(fd, FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE, + | ^~~~~~~~~~~~~~~~~~~~ + +Fixes: + - http://autobuild.buildroot.org/results/0e04bcdb591ca5642053e1f7e31384f06581e989 + +Signed-off-by: Fabrice Fontaine +Signed-off-by: Mariusz Tkaczyk +--- + Create.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/Create.c b/Create.c +index 4397ff49..d94253b1 100644 +--- a/Create.c ++++ b/Create.c +@@ -32,6 +32,10 @@ + #include + #include + ++#ifndef FALLOC_FL_ZERO_RANGE ++#define FALLOC_FL_ZERO_RANGE 16 ++#endif ++ + static int round_size_and_verify(unsigned long long *size, int chunk) + { + if (*size == 0) +-- +2.45.0 + diff --git a/main/mdadm/basename.patch b/main/mdadm/basename.patch new file mode 100644 index 00000000000..8e79c43771c --- /dev/null +++ b/main/mdadm/basename.patch @@ -0,0 +1,17 @@ +--- a/mdadm.h ++++ b/mdadm.h +@@ -248,6 +248,14 @@ static inline void __put_unaligned32(__u + } + + /* ++ * Ensure GNU basename behavior for musl libc ++ */ ++#ifndef __GLIBC__ ++#define basename(path) \ ++ (strrchr((path),'/') ? strrchr((path),'/')+1 : (path)) ++#endif ++ ++/* + * Check at compile time that something is of a particular type. + * Always evaluates to 1 so you may use it easily in comparisons. + */ diff --git a/main/mdadm/fix-monitor-tv_sec.patch b/main/mdadm/fix-monitor-tv_sec.patch index f40d940026a..01dbddc509b 100644 --- a/main/mdadm/fix-monitor-tv_sec.patch +++ b/main/mdadm/fix-monitor-tv_sec.patch @@ -2,7 +2,7 @@ diff --git monitor.c monitor.c index 81537ed..08027ac 100644 --- a/monitor.c +++ b/monitor.c -@@ -447,9 +447,9 @@ static int read_and_act(struct active_array *a, fd_set *fds) +@@ -449,9 +449,9 @@ static int read_and_act(struct active_array *a, fd_set *fds) } gettimeofday(&tv, NULL); diff --git a/main/mdadm/lfs64.patch b/main/mdadm/lfs64.patch index 414f76d3e68..20ed30598b8 100644 --- a/main/mdadm/lfs64.patch +++ b/main/mdadm/lfs64.patch @@ -4,7 +4,7 @@ diff --git a/Grow.c b/Grow.c index 9c6fc95..bb21333 100644 --- a/Grow.c +++ b/Grow.c -@@ -4260,10 +4260,10 @@ static int grow_backup(struct mdinfo *sra, +@@ -4268,10 +4268,10 @@ static int grow_backup(struct mdinfo *sr bsb.magic[15] = '2'; for (i = 0; i < dests; i++) if (part) @@ -17,7 +17,7 @@ index 9c6fc95..bb21333 100644 rv = save_stripes(sources, offsets, disks, chunk, level, layout, dests, destfd, offset * 512 * odata, -@@ -4282,14 +4282,14 @@ static int grow_backup(struct mdinfo *sra, +@@ -4290,14 +4290,14 @@ static int grow_backup(struct mdinfo *sr ((char*)&bsb.sb_csum2)-((char*)&bsb)); rv = -1; @@ -34,7 +34,7 @@ index 9c6fc95..bb21333 100644 destoffsets[i]+stripes*chunk*odata) break; if (write(destfd[i], &bsb, 512) != 512) -@@ -4339,7 +4339,7 @@ static int forget_backup(int dests, int *destfd, +@@ -4347,7 +4347,7 @@ static int forget_backup(int dests, int if (memcmp(bsb.magic, "md_backup_data-2", 16) == 0) bsb.sb_csum2 = bsb_csum((char*)&bsb, ((char*)&bsb.sb_csum2)-((char*)&bsb)); @@ -43,7 +43,7 @@ index 9c6fc95..bb21333 100644 destoffsets[i]-4096) rv = -1; if (rv == 0 && write(destfd[i], &bsb, 512) != 512) -@@ -4367,7 +4367,7 @@ static void validate(int afd, int bfd, unsigned long long offset) +@@ -4375,7 +4375,7 @@ static void validate(int afd, int bfd, u */ if (afd < 0) return; @@ -52,7 +52,7 @@ index 9c6fc95..bb21333 100644 if (read(bfd, &bsb2, 512) != 512) fail("cannot read bsb"); if (bsb2.sb_csum != bsb_csum((char*)&bsb2, -@@ -4398,12 +4398,12 @@ static void validate(int afd, int bfd, unsigned long long offset) +@@ -4406,12 +4406,12 @@ static void validate(int afd, int bfd, u } } @@ -67,7 +67,7 @@ index 9c6fc95..bb21333 100644 if ((unsigned long long)read(afd, abuf, len) != len) fail("read first from array failed"); if (memcmp(bbuf, abuf, len) != 0) { -@@ -4431,10 +4431,10 @@ static void validate(int afd, int bfd, unsigned long long offset) +@@ -4439,10 +4439,10 @@ static void validate(int afd, int bfd, u bbuf = xmalloc(abuflen); } @@ -80,7 +80,7 @@ index 9c6fc95..bb21333 100644 if ((unsigned long long)read(afd, abuf, len) != len) fail("read second from array failed"); if (memcmp(bbuf, abuf, len) != 0) -@@ -4711,7 +4711,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, +@@ -4719,7 +4719,7 @@ int Grow_restart(struct supertype *st, s st->ss->getinfo_super(st, &dinfo, NULL); st->ss->free_super(st); @@ -89,7 +89,7 @@ index 9c6fc95..bb21333 100644 (dinfo.data_offset + dinfo.component_size - 8) <<9, 0) < 0) { pr_err("Cannot seek on device %d\n", i); -@@ -4811,7 +4811,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, +@@ -4819,7 +4819,7 @@ int Grow_restart(struct supertype *st, s goto nonew; /* No new data here */ } } @@ -98,7 +98,7 @@ index 9c6fc95..bb21333 100644 second_fail: if (verbose) pr_err("Failed to verify secondary backup-metadata block on %s\n", -@@ -4819,7 +4819,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, +@@ -4827,7 +4827,7 @@ int Grow_restart(struct supertype *st, s continue; /* Cannot seek */ } /* There should be a duplicate backup superblock 4k before here */ @@ -107,11 +107,9 @@ index 9c6fc95..bb21333 100644 read(fd, &bsb2, sizeof(bsb2)) != sizeof(bsb2)) goto second_fail; /* Cannot find leading superblock */ if (bsb.magic[15] == '1') -diff --git a/raid6check.c b/raid6check.c -index a8e6005..392cf29 100644 --- a/raid6check.c +++ b/raid6check.c -@@ -206,7 +206,7 @@ int autorepair(int *disk, unsigned long long start, int chunk_size, +@@ -211,7 +211,7 @@ int autorepair(int *disk, unsigned long for(j = 0; j < (chunk_size >> CHECK_PAGE_BITS); j++) { if(page_to_write[j] == 1) { int slot = block_index_for_slot[disk[j]]; @@ -120,7 +118,7 @@ index a8e6005..392cf29 100644 write_res += write(source[slot], blocks[disk[j]] + j * CHECK_PAGE_SIZE, CHECK_PAGE_SIZE); -@@ -279,9 +279,9 @@ int manual_repair(int chunk_size, int syndrome_disks, +@@ -284,9 +284,9 @@ int manual_repair(int chunk_size, int sy } int write_res1, write_res2; @@ -132,7 +130,7 @@ index a8e6005..392cf29 100644 offsets[fd1] + start * chunk_size, SEEK_SET); if (seek_res < 0) { fprintf(stderr, "lseek failed for failed_disk1\n"); -@@ -289,7 +289,7 @@ int manual_repair(int chunk_size, int syndrome_disks, +@@ -294,7 +294,7 @@ int manual_repair(int chunk_size, int sy } write_res1 = write(source[fd1], blocks[failed_slot1], chunk_size); @@ -141,7 +139,7 @@ index a8e6005..392cf29 100644 offsets[fd2] + start * chunk_size, SEEK_SET); if (seek_res < 0) { fprintf(stderr, "lseek failed for failed_disk2\n"); -@@ -374,7 +374,7 @@ int check_stripes(struct mdinfo *info, int *source, unsigned long long *offsets, +@@ -379,7 +379,7 @@ int check_stripes(struct mdinfo *info, i goto exitCheck; } for (i = 0 ; i < raid_disks ; i++) { @@ -150,8 +148,6 @@ index a8e6005..392cf29 100644 SEEK_SET); if (seek_res < 0) { fprintf(stderr, "lseek to source %d failed\n", i); -diff --git a/restripe.c b/restripe.c -index a7a7229..eec3619 100644 --- a/restripe.c +++ b/restripe.c @@ -581,7 +581,7 @@ int save_stripes(int *source, unsigned long long *offsets, @@ -196,7 +192,7 @@ diff --git a/super-ddf.c b/super-ddf.c index 3f304cd..7b10568 100644 --- a/super-ddf.c +++ b/super-ddf.c -@@ -816,7 +816,7 @@ static int load_ddf_header(int fd, unsigned long long lba, +@@ -809,7 +809,7 @@ static int load_ddf_header(int fd, unsig if (lba >= size-1) return 0; @@ -205,7 +201,7 @@ index 3f304cd..7b10568 100644 return 0; if (read(fd, hdr, 512) != 512) -@@ -870,7 +870,7 @@ static void *load_section(int fd, struct ddf_super *super, void *buf, +@@ -863,7 +863,7 @@ static void *load_section(int fd, struct else offset += be64_to_cpu(super->active->secondary_lba); @@ -214,7 +210,7 @@ index 3f304cd..7b10568 100644 if (dofree) free(buf); return NULL; -@@ -889,7 +889,7 @@ static int load_ddf_headers(int fd, struct ddf_super *super, char *devname) +@@ -882,7 +882,7 @@ static int load_ddf_headers(int fd, stru get_dev_size(fd, NULL, &dsize); @@ -223,7 +219,7 @@ index 3f304cd..7b10568 100644 if (devname) pr_err("Cannot seek to anchor block on %s: %s\n", devname, strerror(errno)); -@@ -1691,7 +1691,7 @@ static int copy_metadata_ddf(struct supertype *st, int from, int to) +@@ -1689,7 +1689,7 @@ static int copy_metadata_ddf(struct supe if (!get_dev_size(from, NULL, &dsize)) goto err; @@ -232,7 +228,7 @@ index 3f304cd..7b10568 100644 goto err; if (read(from, buf, 512) != 512) goto err; -@@ -1710,8 +1710,8 @@ static int copy_metadata_ddf(struct supertype *st, int from, int to) +@@ -1708,8 +1708,8 @@ static int copy_metadata_ddf(struct supe bytes = dsize - offset; @@ -243,7 +239,7 @@ index 3f304cd..7b10568 100644 goto err; while (written < bytes) { int n = bytes - written; -@@ -3037,7 +3037,7 @@ static int __write_ddf_structure(struct dl *d, struct ddf_super *ddf, __u8 type) +@@ -2967,7 +2967,7 @@ static int __write_ddf_structure(struct header->openflag = 1; header->crc = calc_crc(header, 512); @@ -252,7 +248,7 @@ index 3f304cd..7b10568 100644 if (write(fd, header, 512) < 0) goto out; -@@ -3101,7 +3101,7 @@ out: +@@ -3031,7 +3031,7 @@ out: header->openflag = 0; header->crc = calc_crc(header, 512); @@ -261,7 +257,7 @@ index 3f304cd..7b10568 100644 if (write(fd, header, 512) < 0) ret = 0; -@@ -3154,7 +3154,7 @@ static int _write_super_to_disk(struct ddf_super *ddf, struct dl *d) +@@ -3084,7 +3084,7 @@ static int _write_super_to_disk(struct d if (!__write_ddf_structure(d, ddf, DDF_HEADER_SECONDARY)) return 0; @@ -270,7 +266,7 @@ index 3f304cd..7b10568 100644 if (write(fd, &ddf->anchor, 512) < 0) return 0; -@@ -3909,7 +3909,7 @@ static int store_super_ddf(struct supertype *st, int fd) +@@ -3836,7 +3836,7 @@ static int store_super_ddf(struct supert return 1; memset(buf, 0, 512); @@ -279,11 +275,9 @@ index 3f304cd..7b10568 100644 rc = write(fd, buf, 512); free(buf); if (rc < 0) -diff --git a/super-intel.c b/super-intel.c -index d5fad10..236e2ee 100644 --- a/super-intel.c +++ b/super-intel.c -@@ -3092,7 +3092,7 @@ static int read_imsm_migr_rec(int fd, struct intel_super *super) +@@ -3195,7 +3195,7 @@ static int read_imsm_migr_rec(int fd, st unsigned long long dsize; get_dev_size(fd, NULL, &dsize); @@ -292,7 +286,7 @@ index d5fad10..236e2ee 100644 SEEK_SET) < 0) { pr_err("Cannot seek to anchor block: %s\n", strerror(errno)); -@@ -3283,7 +3283,7 @@ static int write_imsm_migr_rec(struct supertype *st) +@@ -3386,7 +3386,7 @@ static int write_imsm_migr_rec(struct su continue; get_dev_size(sd->fd, NULL, &dsize); @@ -301,7 +295,7 @@ index d5fad10..236e2ee 100644 sector_size), SEEK_SET) < 0) { pr_err("Cannot seek to anchor block: %s\n", -@@ -4404,7 +4404,7 @@ static int load_imsm_mpb(int fd, struct intel_super *super, char *devname) +@@ -4511,7 +4511,7 @@ static int load_imsm_mpb(int fd, struct return 1; } @@ -310,7 +304,7 @@ index d5fad10..236e2ee 100644 if (devname) pr_err("Cannot seek to anchor block on %s: %s\n", devname, strerror(errno)); -@@ -4472,7 +4472,7 @@ static int load_imsm_mpb(int fd, struct intel_super *super, char *devname) +@@ -4580,7 +4580,7 @@ static int load_imsm_mpb(int fd, struct } /* read the extended mpb */ @@ -319,7 +313,7 @@ index d5fad10..236e2ee 100644 if (devname) pr_err("Cannot seek to extended mpb on %s: %s\n", devname, strerror(errno)); -@@ -5994,7 +5994,7 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, +@@ -6111,7 +6111,7 @@ static int add_to_super_imsm(struct supe /* clear migr_rec when adding disk to container */ memset(super->migr_rec_buf, 0, MIGR_REC_BUF_SECTORS*MAX_SECTOR_SIZE); @@ -328,7 +322,7 @@ index d5fad10..236e2ee 100644 SEEK_SET) >= 0) { if ((unsigned int)write(fd, super->migr_rec_buf, MIGR_REC_BUF_SECTORS*member_sector_size) != -@@ -6219,7 +6219,7 @@ static int write_super_imsm(struct supertype *st, int doclose) +@@ -6336,7 +6336,7 @@ static int write_super_imsm(struct super unsigned long long dsize; get_dev_size(d->fd, NULL, &dsize); @@ -337,7 +331,7 @@ index d5fad10..236e2ee 100644 SEEK_SET) >= 0) { if ((unsigned int)write(d->fd, super->migr_rec_buf, -@@ -6302,7 +6302,7 @@ static int write_ppl_header(unsigned long long ppl_sector, int fd, void *buf) +@@ -6419,7 +6419,7 @@ static int write_ppl_header(unsigned lon ppl_hdr->checksum = __cpu_to_le32(~crc32c_le(~0, buf, PPL_HEADER_SIZE)); @@ -346,7 +340,7 @@ index d5fad10..236e2ee 100644 ret = -errno; perror("Failed to seek to PPL header location"); return ret; -@@ -6396,7 +6396,7 @@ static int validate_ppl_imsm(struct supertype *st, struct mdinfo *info, +@@ -6513,7 +6513,7 @@ static int validate_ppl_imsm(struct supe dprintf("Checking potential PPL at offset: %llu\n", ppl_offset); @@ -355,7 +349,7 @@ index d5fad10..236e2ee 100644 SEEK_SET) < 0) { perror("Failed to seek to PPL header location"); ret = -1; -@@ -8858,7 +8858,7 @@ static int store_imsm_mpb(int fd, struct imsm_super *mpb) +@@ -9022,7 +9022,7 @@ static int store_imsm_mpb(int fd, struct sectors = mpb_sectors(mpb, sector_size) - 1; /* write the extended mpb to the sectors preceeding the anchor */ @@ -364,7 +358,7 @@ index d5fad10..236e2ee 100644 SEEK_SET) < 0) return 1; -@@ -8868,7 +8868,7 @@ static int store_imsm_mpb(int fd, struct imsm_super *mpb) +@@ -9032,7 +9032,7 @@ static int store_imsm_mpb(int fd, struct } /* first block is stored on second to last sector of the disk */ @@ -373,7 +367,7 @@ index d5fad10..236e2ee 100644 return 1; if ((unsigned int)write(fd, buf, sector_size) != sector_size) -@@ -11058,7 +11058,7 @@ int recover_backup_imsm(struct supertype *st, struct mdinfo *info) +@@ -11213,7 +11213,7 @@ int recover_backup_imsm(struct supertype skipped_disks++; continue; } @@ -382,7 +376,7 @@ index d5fad10..236e2ee 100644 pr_err("Cannot seek to block: %s\n", strerror(errno)); skipped_disks++; -@@ -11070,7 +11070,7 @@ int recover_backup_imsm(struct supertype *st, struct mdinfo *info) +@@ -11225,7 +11225,7 @@ int recover_backup_imsm(struct supertype skipped_disks++; continue; } @@ -391,7 +385,7 @@ index d5fad10..236e2ee 100644 pr_err("Cannot seek to block: %s\n", strerror(errno)); skipped_disks++; -@@ -12320,7 +12320,7 @@ static int imsm_manage_reshape( +@@ -12473,7 +12473,7 @@ static int imsm_manage_reshape( unsigned long long dsize; get_dev_size(d->fd, NULL, &dsize); @@ -400,7 +394,7 @@ index d5fad10..236e2ee 100644 SEEK_SET) >= 0) { if ((unsigned int)write(d->fd, super->migr_rec_buf, MIGR_REC_BUF_SECTORS*sector_size) != -@@ -12476,7 +12476,7 @@ static int validate_internal_bitmap_for_drive(struct supertype *st, +@@ -12629,7 +12629,7 @@ static int validate_internal_bitmap_for_ } } @@ -409,7 +403,7 @@ index d5fad10..236e2ee 100644 goto abort; if (read(fd, read_buf, IMSM_BITMAP_HEADER_SIZE) != IMSM_BITMAP_HEADER_SIZE) -@@ -12605,7 +12605,7 @@ static int locate_bitmap_imsm(struct supertype *st, int fd, int node_num) +@@ -12747,7 +12747,7 @@ static int locate_bitmap_imsm(struct sup offset = get_bitmap_header_sector(super, super->current_vol); dprintf("bitmap header offset is %llu\n", offset); @@ -418,7 +412,7 @@ index d5fad10..236e2ee 100644 return 0; } -@@ -12659,7 +12659,7 @@ static int write_init_bitmap_imsm(struct supertype *st, int fd, +@@ -12801,7 +12801,7 @@ static int write_init_bitmap_imsm(struct return -1; memset(buf, 0xFF, MAX_SECTOR_SIZE); offset = get_bitmap_sector(super, vol_idx); @@ -427,11 +421,9 @@ index d5fad10..236e2ee 100644 while (written < IMSM_BITMAP_AREA_SIZE) { to_write = IMSM_BITMAP_AREA_SIZE - written; if (to_write > MAX_SECTOR_SIZE) -diff --git a/super0.c b/super0.c -index b79b97a..74bb418 100644 --- a/super0.c +++ b/super0.c -@@ -327,12 +327,12 @@ static int copy_metadata0(struct supertype *st, int from, int to) +@@ -327,12 +327,12 @@ static int copy_metadata0(struct superty offset *= 512; @@ -446,7 +438,7 @@ index b79b97a..74bb418 100644 goto err; super = buf; if (super->md_magic != MD_SB_MAGIC || -@@ -862,7 +862,7 @@ static int store_super0(struct supertype *st, int fd) +@@ -885,7 +885,7 @@ static int store_super0(struct supertype offset = dsize/512 - 8*2; offset &= ~(4*2-1); offset *= 512; @@ -455,7 +447,7 @@ index b79b97a..74bb418 100644 ret = 3; else if (write(fd, st->other, 1024) != 1024) ret = 4; -@@ -877,7 +877,7 @@ static int store_super0(struct supertype *st, int fd) +@@ -900,7 +900,7 @@ static int store_super0(struct supertype offset *= 512; @@ -464,7 +456,7 @@ index b79b97a..74bb418 100644 return 3; if (write(fd, super, sizeof(*super)) != sizeof(*super)) -@@ -1004,7 +1004,7 @@ static int load_super0(struct supertype *st, int fd, char *devname) +@@ -1027,7 +1027,7 @@ static int load_super0(struct supertype offset *= 512; @@ -473,7 +465,7 @@ index b79b97a..74bb418 100644 if (devname) pr_err("Cannot seek to superblock on %s: %s\n", devname, strerror(errno)); -@@ -1189,7 +1189,7 @@ static int locate_bitmap0(struct supertype *st, int fd, int node_num) +@@ -1212,7 +1212,7 @@ static int locate_bitmap0(struct superty offset += MD_SB_BYTES; @@ -482,7 +474,7 @@ index b79b97a..74bb418 100644 return 0; } -@@ -1214,7 +1214,7 @@ static int write_bitmap0(struct supertype *st, int fd, enum bitmap_update update +@@ -1237,7 +1237,7 @@ static int write_bitmap0(struct supertyp offset *= 512; @@ -491,11 +483,9 @@ index b79b97a..74bb418 100644 return 3; if (posix_memalign(&buf, 4096, 4096)) -diff --git a/super1.c b/super1.c -index a12a5bc..4e098b0 100644 --- a/super1.c +++ b/super1.c -@@ -761,7 +761,7 @@ static int copy_metadata1(struct supertype *st, int from, int to) +@@ -745,7 +745,7 @@ static int copy_metadata1(struct superty goto err; } @@ -504,7 +494,7 @@ index a12a5bc..4e098b0 100644 goto err; if (read(from, buf, bufsize) != bufsize) goto err; -@@ -775,7 +775,7 @@ static int copy_metadata1(struct supertype *st, int from, int to) +@@ -759,7 +759,7 @@ static int copy_metadata1(struct superty calc_sb_1_csum(sb) != super.sb_csum) goto err; @@ -513,7 +503,7 @@ index a12a5bc..4e098b0 100644 goto err; if (write(to, buf, bufsize) != bufsize) goto err; -@@ -791,9 +791,9 @@ static int copy_metadata1(struct supertype *st, int from, int to) +@@ -775,9 +775,9 @@ static int copy_metadata1(struct superty bitmap_offset += (int32_t)__le32_to_cpu(super.bitmap_offset); @@ -525,7 +515,7 @@ index a12a5bc..4e098b0 100644 goto err; for (written = 0; written < bytes ; ) { -@@ -832,9 +832,9 @@ static int copy_metadata1(struct supertype *st, int from, int to) +@@ -816,9 +816,9 @@ static int copy_metadata1(struct superty bb_offset += (int32_t)__le32_to_cpu(super.bblog_offset); @@ -537,7 +527,7 @@ index a12a5bc..4e098b0 100644 goto err; for (written = 0; written < bytes ; ) { -@@ -940,7 +940,7 @@ static int examine_badblocks_super1(struct supertype *st, int fd, char *devname) +@@ -920,7 +920,7 @@ static int examine_badblocks_super1(stru offset = __le64_to_cpu(sb->super_offset) + (int)__le32_to_cpu(sb->bblog_offset); offset <<= 9; @@ -546,7 +536,7 @@ index a12a5bc..4e098b0 100644 pr_err("Cannot seek to bad-blocks list\n"); return 1; } -@@ -1797,7 +1797,7 @@ static int store_super1(struct supertype *st, int fd) +@@ -1810,7 +1810,7 @@ static int store_super1(struct supertype abort(); } @@ -555,7 +545,7 @@ index a12a5bc..4e098b0 100644 return 3; sbsize = ROUND_UP(sizeof(*sb) + 2 * __le32_to_cpu(sb->max_dev), 512); -@@ -1866,7 +1866,7 @@ static int write_init_ppl1(struct supertype *st, struct mdinfo *info, int fd) +@@ -1879,7 +1879,7 @@ static int write_init_ppl1(struct supert sizeof(sb->set_uuid))); ppl_hdr->checksum = __cpu_to_le32(~crc32c_le(~0, buf, PPL_HEADER_SIZE)); @@ -564,7 +554,7 @@ index a12a5bc..4e098b0 100644 ret = errno; perror("Failed to seek to PPL header location"); } -@@ -1911,7 +1911,7 @@ static int write_empty_r5l_meta_block(struct supertype *st, int fd) +@@ -1924,7 +1924,7 @@ static int write_empty_r5l_meta_block(st crc = crc32c_le(crc, (void *)mb, META_BLOCK_SIZE); mb->checksum = crc; @@ -573,7 +563,7 @@ index a12a5bc..4e098b0 100644 pr_err("cannot seek to offset of the meta block\n"); goto fail_to_write; } -@@ -2268,7 +2268,7 @@ static int load_super1(struct supertype *st, int fd, char *devname) +@@ -2290,7 +2290,7 @@ static int load_super1(struct supertype return -EINVAL; } @@ -582,7 +572,7 @@ index a12a5bc..4e098b0 100644 if (devname) pr_err("Cannot seek to superblock on %s: %s\n", devname, strerror(errno)); -@@ -2639,7 +2639,7 @@ static int locate_bitmap1(struct supertype *st, int fd, int node_num) +@@ -2675,7 +2675,7 @@ static int locate_bitmap1(struct superty } if (mustfree) free(sb); @@ -591,8 +581,6 @@ index a12a5bc..4e098b0 100644 return ret; } -diff --git a/swap_super.c b/swap_super.c -index b6db574..9c39aff 100644 --- a/swap_super.c +++ b/swap_super.c @@ -16,7 +16,7 @@ @@ -630,7 +618,7 @@ diff --git a/util.c b/util.c index 3d05d07..6109fd4 100644 --- a/util.c +++ b/util.c -@@ -2344,7 +2344,7 @@ int zero_disk_range(int fd, unsigned long long sector, size_t count) +@@ -2387,7 +2387,7 @@ int zero_disk_range(int fd, unsigned lon return -1; } diff --git a/main/mdadm/mdadm-include-sysmacros.patch b/main/mdadm/mdadm-include-sysmacros.patch index 09d755e9398..0919c4b257b 100644 --- a/main/mdadm/mdadm-include-sysmacros.patch +++ b/main/mdadm/mdadm-include-sysmacros.patch @@ -1,10 +1,10 @@ --- a/mdadm.h +++ b/mdadm.h -@@ -34,6 +34,7 @@ - #endif +@@ -35,6 +35,7 @@ extern __off64_t lseek64 __P ((int __fd, + #include #include +#include #include + #include #include - #include diff --git a/main/mdadm/no-werror.patch b/main/mdadm/no-werror.patch index f1a6b10a4ca..08bbd93dec7 100644 --- a/main/mdadm/no-werror.patch +++ b/main/mdadm/no-werror.patch @@ -1,13 +1,11 @@ -diff --git a/Makefile b/Makefile -index 5fd7f16..5095a42 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ ifeq ($(origin CC),default) CC := $(CROSS_COMPILE)gcc endif CXFLAGS ?= -ggdb --CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -+CWFLAGS = -Wall -Wstrict-prototypes -Wextra -Wno-unused-parameter +-CWFLAGS ?= -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIE -Warray-bounds ++CWFLAGS ?= -Wall -Wstrict-prototypes -Wextra -Wno-unused-parameter -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIE -Warray-bounds ifdef WARN_UNUSED - CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3 + CWFLAGS += -Wp -O3 endif diff --git a/main/mdadm/util.c-include-limits.h.patch b/main/mdadm/util.c-include-limits.h.patch new file mode 100644 index 00000000000..ddb4aacccff --- /dev/null +++ b/main/mdadm/util.c-include-limits.h.patch @@ -0,0 +1,29 @@ +From 8bda86099089b44129ef6206764f9de47a45f0db Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Tue, 12 Mar 2024 11:01:50 +0100 +Subject: [PATCH] util.c: add limits.h include for NAME_MAX definition + +Add limits.h include for NAME_MAX definition. + +Signed-off-by: Alexander Kanavin +Signed-off-by: Mariusz Tkaczyk +--- + util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util.c b/util.c +index 05ad3343..49a9c6e2 100644 +--- a/util.c ++++ b/util.c +@@ -36,7 +36,7 @@ + #include + #include + #include +- ++#include + + /* + * following taken from linux/blkpg.h because they aren't +-- +2.45.0 +