diff options
author | Khem Raj <raj.khem@gmail.com> | 2022-12-21 09:55:46 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-22 23:05:50 +0000 |
commit | e6335a09852f945757dda4a5cb236fe5d8b297e1 (patch) | |
tree | 484f9d660875b771066b8bfb645d0a7031a068a0 /meta/recipes-connectivity | |
parent | 4e935952b663dbf288d6b6f740515b2ddc680872 (diff) | |
download | poky-e6335a09852f945757dda4a5cb236fe5d8b297e1.tar.gz |
nfs-utils: Replace statfs64 with statfs
Fixes LFS64 builds
(From OE-Core rev: ce6a6cc8e468603a1ccec68ec70fc1a079411fca)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity')
-rw-r--r-- | meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch | 171 | ||||
-rw-r--r-- | meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.2.bb | 1 |
2 files changed, 172 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch new file mode 100644 index 0000000000..40ceff9ae9 --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch | |||
@@ -0,0 +1,171 @@ | |||
1 | From e89652b853ca7de671093ae44305fa3435e13d3d Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 15 Dec 2022 13:29:43 -0800 | ||
4 | Subject: [PATCH] Replace statfs64 with statfs | ||
5 | |||
6 | autoconf AC_SYS_LARGEFILE is used by configure to add needed defines | ||
7 | when needed for enabling 64bit off_t, therefore replacing statfs64 with | ||
8 | statfs should be functionally same. Additionally this helps compiling | ||
9 | with latest musl where 64bit LFS functions like statfs64 and friends are | ||
10 | now moved under _LARGEFILE64_SOURCE feature test macro, this works on | ||
11 | glibc systems because _GNU_SOURCE macros also enables | ||
12 | _LARGEFILE64_SOURCE indirectly. This is not case with musl and this | ||
13 | latest issue is exposed. | ||
14 | |||
15 | Upstream-Status: Submitted [https://lore.kernel.org/linux-nfs/20221215213605.4061853-1-raj.khem@gmail.com/T/#u] | ||
16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
17 | --- | ||
18 | support/export/cache.c | 14 +++++++------- | ||
19 | support/include/nfsd_path.h | 6 +++--- | ||
20 | support/misc/nfsd_path.c | 24 ++++++++++++------------ | ||
21 | utils/exportfs/exportfs.c | 4 ++-- | ||
22 | 4 files changed, 24 insertions(+), 24 deletions(-) | ||
23 | |||
24 | diff --git a/support/export/cache.c b/support/export/cache.c | ||
25 | index a5823e9..2497d4f 100644 | ||
26 | --- a/support/export/cache.c | ||
27 | +++ b/support/export/cache.c | ||
28 | @@ -346,27 +346,27 @@ static int uuid_by_path(char *path, int type, size_t uuidlen, char *uuid) | ||
29 | |||
30 | /* Possible sources of uuid are | ||
31 | * - blkid uuid | ||
32 | - * - statfs64 uuid | ||
33 | + * - statfs uuid | ||
34 | * | ||
35 | - * On some filesystems (e.g. vfat) the statfs64 uuid is simply an | ||
36 | + * On some filesystems (e.g. vfat) the statfs uuid is simply an | ||
37 | * encoding of the device that the filesystem is mounted from, so | ||
38 | * it we be very bad to use that (as device numbers change). blkid | ||
39 | * must be preferred. | ||
40 | - * On other filesystems (e.g. btrfs) the statfs64 uuid contains | ||
41 | + * On other filesystems (e.g. btrfs) the statfs uuid contains | ||
42 | * important info that the blkid uuid cannot contain: This happens | ||
43 | * when multiple subvolumes are exported (they have the same | ||
44 | - * blkid uuid but different statfs64 uuids). | ||
45 | + * blkid uuid but different statfs uuids). | ||
46 | * We rely on get_uuid_blkdev *knowing* which is which and not returning | ||
47 | - * a uuid for filesystems where the statfs64 uuid is better. | ||
48 | + * a uuid for filesystems where the statfs uuid is better. | ||
49 | * | ||
50 | */ | ||
51 | - struct statfs64 st; | ||
52 | + struct statfs st; | ||
53 | char fsid_val[17]; | ||
54 | const char *blkid_val = NULL; | ||
55 | const char *val; | ||
56 | int rc; | ||
57 | |||
58 | - rc = nfsd_path_statfs64(path, &st); | ||
59 | + rc = nfsd_path_statfs(path, &st); | ||
60 | |||
61 | if (type == 0 && rc == 0) { | ||
62 | const unsigned long *bad; | ||
63 | diff --git a/support/include/nfsd_path.h b/support/include/nfsd_path.h | ||
64 | index 3b73aad..aa1e1dd 100644 | ||
65 | --- a/support/include/nfsd_path.h | ||
66 | +++ b/support/include/nfsd_path.h | ||
67 | @@ -7,7 +7,7 @@ | ||
68 | #include <sys/stat.h> | ||
69 | |||
70 | struct file_handle; | ||
71 | -struct statfs64; | ||
72 | +struct statfs; | ||
73 | |||
74 | void nfsd_path_init(void); | ||
75 | |||
76 | @@ -18,8 +18,8 @@ char * nfsd_path_prepend_dir(const char *dir, const char *pathname); | ||
77 | int nfsd_path_stat(const char *pathname, struct stat *statbuf); | ||
78 | int nfsd_path_lstat(const char *pathname, struct stat *statbuf); | ||
79 | |||
80 | -int nfsd_path_statfs64(const char *pathname, | ||
81 | - struct statfs64 *statbuf); | ||
82 | +int nfsd_path_statfs(const char *pathname, | ||
83 | + struct statfs *statbuf); | ||
84 | |||
85 | char * nfsd_realpath(const char *path, char *resolved_path); | ||
86 | |||
87 | diff --git a/support/misc/nfsd_path.c b/support/misc/nfsd_path.c | ||
88 | index 65e53c1..c3dea4f 100644 | ||
89 | --- a/support/misc/nfsd_path.c | ||
90 | +++ b/support/misc/nfsd_path.c | ||
91 | @@ -184,46 +184,46 @@ nfsd_path_lstat(const char *pathname, struct stat *statbuf) | ||
92 | return nfsd_run_stat(nfsd_wq, nfsd_lstatfunc, pathname, statbuf); | ||
93 | } | ||
94 | |||
95 | -struct nfsd_statfs64_data { | ||
96 | +struct nfsd_statfs_data { | ||
97 | const char *pathname; | ||
98 | - struct statfs64 *statbuf; | ||
99 | + struct statfs *statbuf; | ||
100 | int ret; | ||
101 | int err; | ||
102 | }; | ||
103 | |||
104 | static void | ||
105 | -nfsd_statfs64func(void *data) | ||
106 | +nfsd_statfsfunc(void *data) | ||
107 | { | ||
108 | - struct nfsd_statfs64_data *d = data; | ||
109 | + struct nfsd_statfs_data *d = data; | ||
110 | |||
111 | - d->ret = statfs64(d->pathname, d->statbuf); | ||
112 | + d->ret = statfs(d->pathname, d->statbuf); | ||
113 | if (d->ret < 0) | ||
114 | d->err = errno; | ||
115 | } | ||
116 | |||
117 | static int | ||
118 | -nfsd_run_statfs64(struct xthread_workqueue *wq, | ||
119 | +nfsd_run_statfs(struct xthread_workqueue *wq, | ||
120 | const char *pathname, | ||
121 | - struct statfs64 *statbuf) | ||
122 | + struct statfs *statbuf) | ||
123 | { | ||
124 | - struct nfsd_statfs64_data data = { | ||
125 | + struct nfsd_statfs_data data = { | ||
126 | pathname, | ||
127 | statbuf, | ||
128 | 0, | ||
129 | 0 | ||
130 | }; | ||
131 | - xthread_work_run_sync(wq, nfsd_statfs64func, &data); | ||
132 | + xthread_work_run_sync(wq, nfsd_statfsfunc, &data); | ||
133 | if (data.ret < 0) | ||
134 | errno = data.err; | ||
135 | return data.ret; | ||
136 | } | ||
137 | |||
138 | int | ||
139 | -nfsd_path_statfs64(const char *pathname, struct statfs64 *statbuf) | ||
140 | +nfsd_path_statfs(const char *pathname, struct statfs *statbuf) | ||
141 | { | ||
142 | if (!nfsd_wq) | ||
143 | - return statfs64(pathname, statbuf); | ||
144 | - return nfsd_run_statfs64(nfsd_wq, pathname, statbuf); | ||
145 | + return statfs(pathname, statbuf); | ||
146 | + return nfsd_run_statfs(nfsd_wq, pathname, statbuf); | ||
147 | } | ||
148 | |||
149 | struct nfsd_realpath_data { | ||
150 | diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c | ||
151 | index 0897b22..6d79a5b 100644 | ||
152 | --- a/utils/exportfs/exportfs.c | ||
153 | +++ b/utils/exportfs/exportfs.c | ||
154 | @@ -513,7 +513,7 @@ validate_export(nfs_export *exp) | ||
155 | */ | ||
156 | struct stat stb; | ||
157 | char *path = exportent_realpath(&exp->m_export); | ||
158 | - struct statfs64 stf; | ||
159 | + struct statfs stf; | ||
160 | int fs_has_fsid = 0; | ||
161 | |||
162 | if (stat(path, &stb) < 0) { | ||
163 | @@ -528,7 +528,7 @@ validate_export(nfs_export *exp) | ||
164 | if (!can_test()) | ||
165 | return; | ||
166 | |||
167 | - if (!statfs64(path, &stf) && | ||
168 | + if (!statfs(path, &stf) && | ||
169 | (stf.f_fsid.__val[0] || stf.f_fsid.__val[1])) | ||
170 | fs_has_fsid = 1; | ||
171 | |||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.2.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.2.bb index 4b5c28c27b..21df1803c5 100644 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.2.bb +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.2.bb | |||
@@ -32,6 +32,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x | |||
32 | file://clang-warnings.patch \ | 32 | file://clang-warnings.patch \ |
33 | file://0005-mountd-Check-for-return-of-stat-function.patch \ | 33 | file://0005-mountd-Check-for-return-of-stat-function.patch \ |
34 | file://0006-Fix-function-prototypes.patch \ | 34 | file://0006-Fix-function-prototypes.patch \ |
35 | file://0001-Replace-statfs64-with-statfs.patch \ | ||
35 | " | 36 | " |
36 | SRC_URI[sha256sum] = "5200873e81c4d610e2462fc262fe18135f2dbe78b7979f95accd159ae64d5011" | 37 | SRC_URI[sha256sum] = "5200873e81c4d610e2462fc262fe18135f2dbe78b7979f95accd159ae64d5011" |
37 | 38 | ||