[toolchain/uClibc] backport upstream fix for dst computation
[openwrt.git] / tools / e2fsprogs / patches / 003-darwin_directio_fix.patch
1 --- a/lib/ext2fs/unix_io.c
2 +++ b/lib/ext2fs/unix_io.c
3 @@ -428,6 +428,7 @@ static errcode_t unix_open(const char *n
4 struct unix_private_data *data = NULL;
5 errcode_t retval;
6 int open_flags;
7 + int f_nocache = 0;
8 struct stat st;
9 #ifdef __linux__
10 struct utsname ut;
11 @@ -464,7 +465,11 @@ static errcode_t unix_open(const char *n
12 if (flags & IO_FLAG_EXCLUSIVE)
13 open_flags |= O_EXCL;
14 if (flags & IO_FLAG_DIRECT_IO)
15 +#if !defined(O_DIRECT) && defined(F_NOCACHE)
16 + f_nocache = F_NOCACHE;
17 +#else
18 open_flags |= O_DIRECT;
19 +#endif
20 data->flags = flags;
21
22 #ifdef HAVE_OPEN64
23 @@ -477,6 +482,13 @@ static errcode_t unix_open(const char *n
24 goto cleanup;
25 }
26
27 + if (f_nocache) {
28 + if (fcntl(data->dev, f_nocache, 1) < 0) {
29 + retval = errno;
30 + goto cleanup;
31 + }
32 + }
33 +
34 #ifdef BLKSSZGET
35 if (flags & IO_FLAG_DIRECT_IO) {
36 if (ioctl(data->dev, BLKSSZGET, &data->align) != 0)
This page took 0.043269 seconds and 5 git commands to generate.