btrfs-progs: Use sysconf instead of getpagesize

Rawhide is getting cranky with posix compliance, and a few
things have stopped building.

getpagesize() is now only available -with- __USE_XOPEN_EXTENDED
or __USE_BSD, and NOT __USE_XOPEN2K.

_GNU_SOURCE must define __USE_XOPEN2K because getpagesize()
has gone away for mkfs.  I gave up and used sysconf.

Also, something used to pull in stat that no longer does, so
things like S_ISREG weren't getting defined.

The following fixes things for me.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
master
Eric Sandeen 2013-01-19 13:06:17 -05:00 committed by David Sterba
parent cdbe16b309
commit 5cdc0913dd
2 changed files with 4 additions and 2 deletions

View File

@ -22,7 +22,9 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <getopt.h>
#include "kerncompat.h"
#include "ctree.h"

4
mkfs.c
View File

@ -1206,7 +1206,7 @@ int main(int ac, char **av)
u64 alloc_start = 0;
u64 metadata_profile = 0;
u64 data_profile = 0;
u32 leafsize = getpagesize();
u32 leafsize = sysconf(_SC_PAGESIZE);
u32 sectorsize = 4096;
u32 nodesize = leafsize;
u32 stripesize = 4096;
@ -1282,7 +1282,7 @@ int main(int ac, char **av)
print_usage();
}
}
sectorsize = max(sectorsize, (u32)getpagesize());
sectorsize = max(sectorsize, (u32)sysconf(_SC_PAGESIZE));
if (check_leaf_or_node_size(leafsize, sectorsize))
exit(1);
if (check_leaf_or_node_size(nodesize, sectorsize))