Skip to content

Commit

Permalink
e2fsprogs: fix build on glibc-based systems
Browse files Browse the repository at this point in the history
  • Loading branch information
nmeum committed Feb 13, 2019
1 parent 7a220c7 commit b2a71b3
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 5dfa895fe4b4aa45c73dbfa3b231e1fdf7d00135 Mon Sep 17 00:00:00 2001
From 31dc73f6fbb0da8f142c46bfc17f1d8bd1dd09e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <[email protected]>
Date: Tue, 19 Jun 2018 12:44:59 +0000
Subject: [PATCH] linux/types.h seem to already define __bitwise
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From 020c9832b21f5a612dc4c6dc9acdaae110ed2a52 Mon Sep 17 00:00:00 2001
From: Anatol Pomozov <[email protected]>
Date: Tue, 12 Feb 2019 23:52:50 +0100
Subject: [PATCH] create_inode: don't define copy_file_range twice

glibc defines a copy_file_range prototype when `_GNU_SOURCE` is set when
`unistd.h` is included. Rename the android function to prevent this
conflict.
---
misc/create_inode.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/misc/create_inode.c b/misc/create_inode.c
index 1373b46b..e6f34bd9 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -403,7 +403,7 @@ static ssize_t my_pread(int fd, void *buf, size_t count, off_t offset)
}
#endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */

-static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
+static errcode_t e2_copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
off_t start, off_t end, char *buf,
char *zerobuf)
{
@@ -477,7 +477,7 @@ static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf,

data_blk = data & ~(fs->blocksize - 1);
hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1);
- err = copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf,
+ err = e2_copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf,
zerobuf);
if (err)
return err;
@@ -527,7 +527,7 @@ static errcode_t try_fiemap_copy(ext2_filsys fs, int fd, ext2_file_t e2_file,
}
for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents;
i++, ext++) {
- err = copy_file_range(fs, fd, e2_file, ext->fe_logical,
+ err = e2_copy_file_range(fs, fd, e2_file, ext->fe_logical,
ext->fe_logical + ext->fe_length,
buf, zerobuf);
if (err)
@@ -580,7 +580,7 @@ static errcode_t copy_file(ext2_filsys fs, int fd, struct stat *statbuf,
goto out;
#endif

- err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
+ err = e2_copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
zerobuf);
out:
ext2fs_free_mem(&zerobuf);

0 comments on commit b2a71b3

Please sign in to comment.