diff options
Diffstat (limited to 'meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch')
| -rw-r--r-- | meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch b/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch deleted file mode 100644 index aa874dbec3..0000000000 --- a/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch +++ /dev/null | |||
| @@ -1,155 +0,0 @@ | |||
| 1 | From 9e3b15adf86147fe581cd2159cb99708abe26158 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Thu, 10 Nov 2022 12:31:22 -0800 | ||
| 4 | Subject: [PATCH] restripe.c: Use _FILE_OFFSET_BITS to enable largefile support | ||
| 5 | |||
| 6 | Instead of using the lseek64 and friends, its better to enable it via | ||
| 7 | the feature macro _FILE_OFFSET_BITS = 64 and let the C library deal with | ||
| 8 | the width of types | ||
| 9 | |||
| 10 | Upstream-Status: Submitted [https://lore.kernel.org/linux-raid/20221110225546.337164-1-raj.khem@gmail.com/] | ||
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 12 | --- | ||
| 13 | raid6check.c | 11 +++++++---- | ||
| 14 | restripe.c | 13 ++++++++----- | ||
| 15 | swap_super.c | 13 +++++++------ | ||
| 16 | 3 files changed, 22 insertions(+), 15 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/raid6check.c b/raid6check.c | ||
| 19 | index 99477761..8e7f1421 100644 | ||
| 20 | --- a/raid6check.c | ||
| 21 | +++ b/raid6check.c | ||
| 22 | @@ -22,6 +22,9 @@ | ||
| 23 | * Based on "restripe.c" from "mdadm" codebase | ||
| 24 | */ | ||
| 25 | |||
| 26 | +/* Enable largefile support */ | ||
| 27 | +#define _FILE_OFFSET_BITS 64 | ||
| 28 | + | ||
| 29 | #include "mdadm.h" | ||
| 30 | #include <stdint.h> | ||
| 31 | #include <sys/mman.h> | ||
| 32 | @@ -284,9 +287,9 @@ int manual_repair(int chunk_size, int syndrome_disks, | ||
| 33 | } | ||
| 34 | |||
| 35 | int write_res1, write_res2; | ||
| 36 | - off64_t seek_res; | ||
| 37 | + off_t seek_res; | ||
| 38 | |||
| 39 | - seek_res = lseek64(source[fd1], | ||
| 40 | + seek_res = lseek(source[fd1], | ||
| 41 | offsets[fd1] + start * chunk_size, SEEK_SET); | ||
| 42 | if (seek_res < 0) { | ||
| 43 | fprintf(stderr, "lseek failed for failed_disk1\n"); | ||
| 44 | @@ -294,7 +297,7 @@ int manual_repair(int chunk_size, int syndrome_disks, | ||
| 45 | } | ||
| 46 | write_res1 = write(source[fd1], blocks[failed_slot1], chunk_size); | ||
| 47 | |||
| 48 | - seek_res = lseek64(source[fd2], | ||
| 49 | + seek_res = lseek(source[fd2], | ||
| 50 | offsets[fd2] + start * chunk_size, SEEK_SET); | ||
| 51 | if (seek_res < 0) { | ||
| 52 | fprintf(stderr, "lseek failed for failed_disk2\n"); | ||
| 53 | @@ -379,7 +382,7 @@ int check_stripes(struct mdinfo *info, int *source, unsigned long long *offsets, | ||
| 54 | goto exitCheck; | ||
| 55 | } | ||
| 56 | for (i = 0 ; i < raid_disks ; i++) { | ||
| 57 | - off64_t seek_res = lseek64(source[i], offsets[i] + start * chunk_size, | ||
| 58 | + off_t seek_res = lseek(source[i], offsets[i] + start * chunk_size, | ||
| 59 | SEEK_SET); | ||
| 60 | if (seek_res < 0) { | ||
| 61 | fprintf(stderr, "lseek to source %d failed\n", i); | ||
| 62 | diff --git a/restripe.c b/restripe.c | ||
| 63 | index 5e126eb7..af76c634 100644 | ||
| 64 | --- a/restripe.c | ||
| 65 | +++ b/restripe.c | ||
| 66 | @@ -22,6 +22,9 @@ | ||
| 67 | * Email: <neilb@suse.de> | ||
| 68 | */ | ||
| 69 | |||
| 70 | +/* Enable largefile support */ | ||
| 71 | +#define _FILE_OFFSET_BITS 64 | ||
| 72 | + | ||
| 73 | #include "mdadm.h" | ||
| 74 | #include "xmalloc.h" | ||
| 75 | |||
| 76 | @@ -583,7 +586,7 @@ int save_stripes(int *source, unsigned long long *offsets, | ||
| 77 | raid_disks, level, layout); | ||
| 78 | if (dnum < 0) abort(); | ||
| 79 | if (source[dnum] < 0 || | ||
| 80 | - lseek64(source[dnum], | ||
| 81 | + lseek(source[dnum], | ||
| 82 | offsets[dnum] + offset, 0) < 0 || | ||
| 83 | read(source[dnum], buf+disk * chunk_size, | ||
| 84 | chunk_size) != chunk_size) { | ||
| 85 | @@ -756,8 +759,8 @@ int restore_stripes(int *dest, unsigned long long *offsets, | ||
| 86 | raid_disks, level, layout); | ||
| 87 | if (src_buf == NULL) { | ||
| 88 | /* read from file */ | ||
| 89 | - if (lseek64(source, read_offset, 0) != | ||
| 90 | - (off64_t)read_offset) { | ||
| 91 | + if (lseek(source, read_offset, 0) != | ||
| 92 | + (off_t)read_offset) { | ||
| 93 | rv = -1; | ||
| 94 | goto abort; | ||
| 95 | } | ||
| 96 | @@ -818,7 +821,7 @@ int restore_stripes(int *dest, unsigned long long *offsets, | ||
| 97 | } | ||
| 98 | for (i=0; i < raid_disks ; i++) | ||
| 99 | if (dest[i] >= 0) { | ||
| 100 | - if (lseek64(dest[i], | ||
| 101 | + if (lseek(dest[i], | ||
| 102 | offsets[i]+offset, 0) < 0) { | ||
| 103 | rv = -1; | ||
| 104 | goto abort; | ||
| 105 | @@ -868,7 +871,7 @@ int test_stripes(int *source, unsigned long long *offsets, | ||
| 106 | int disk; | ||
| 107 | |||
| 108 | for (i = 0 ; i < raid_disks ; i++) { | ||
| 109 | - if ((lseek64(source[i], offsets[i]+start, 0) < 0) || | ||
| 110 | + if ((lseek(source[i], offsets[i]+start, 0) < 0) || | ||
| 111 | (read(source[i], stripes[i], chunk_size) != | ||
| 112 | chunk_size)) { | ||
| 113 | free(q); | ||
| 114 | diff --git a/swap_super.c b/swap_super.c | ||
| 115 | index b6db5743..18c89e2b 100644 | ||
| 116 | --- a/swap_super.c | ||
| 117 | +++ b/swap_super.c | ||
| 118 | @@ -1,3 +1,6 @@ | ||
| 119 | +/* Enable largefile support */ | ||
| 120 | +#define _FILE_OFFSET_BITS 64 | ||
| 121 | + | ||
| 122 | #include <unistd.h> | ||
| 123 | #include <stdlib.h> | ||
| 124 | #include <fcntl.h> | ||
| 125 | @@ -16,8 +19,6 @@ | ||
| 126 | |||
| 127 | #define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) | ||
| 128 | |||
| 129 | -extern long long lseek64(int, long long, int); | ||
| 130 | - | ||
| 131 | int main(int argc, char *argv[]) | ||
| 132 | { | ||
| 133 | int fd, i; | ||
| 134 | @@ -38,8 +39,8 @@ int main(int argc, char *argv[]) | ||
| 135 | exit(1); | ||
| 136 | } | ||
| 137 | offset = MD_NEW_SIZE_SECTORS(size) * 512LL; | ||
| 138 | - if (lseek64(fd, offset, 0) < 0LL) { | ||
| 139 | - perror("lseek64"); | ||
| 140 | + if (lseek(fd, offset, 0) < 0LL) { | ||
| 141 | + perror("lseek"); | ||
| 142 | exit(1); | ||
| 143 | } | ||
| 144 | if (read(fd, super, 4096) != 4096) { | ||
| 145 | @@ -68,8 +69,8 @@ int main(int argc, char *argv[]) | ||
| 146 | super[32*4+10*4 +i] = t; | ||
| 147 | } | ||
| 148 | |||
| 149 | - if (lseek64(fd, offset, 0) < 0LL) { | ||
| 150 | - perror("lseek64"); | ||
| 151 | + if (lseek(fd, offset, 0) < 0LL) { | ||
| 152 | + perror("lseek"); | ||
| 153 | exit(1); | ||
| 154 | } | ||
| 155 | if (write(fd, super, 4096) != 4096) { | ||
