osandov / rpms / btrfs-progs

Forked from rpms/btrfs-progs 2 years ago
Clone
Josef Bacik a37e25
diff --git a/btrfsck.c b/btrfsck.c
Josef Bacik a37e25
index 63e44d1..1e040c4 100644
Josef Bacik a37e25
--- a/btrfsck.c
Josef Bacik a37e25
+++ b/btrfsck.c
Josef Bacik a37e25
@@ -22,7 +22,9 @@
Josef Bacik 4ec8d5
 #include <stdlib.h>
Josef Bacik a37e25
 #include <unistd.h>
Josef Bacik 4ec8d5
 #include <fcntl.h>
Josef Bacik 4ec8d5
+#include <sys/types.h>
Josef Bacik a37e25
 #include <sys/stat.h>
Josef Bacik 4ec8d5
+#include <unistd.h>
Josef Bacik 4ec8d5
 #include "kerncompat.h"
Josef Bacik 4ec8d5
 #include "ctree.h"
Josef Bacik 4ec8d5
 #include "disk-io.h"
Josef Bacik a37e25
diff --git a/mkfs.c b/mkfs.c
Josef Bacik a37e25
index 2e99b95..638f4c2 100644
Josef Bacik a37e25
--- a/mkfs.c
Josef Bacik a37e25
+++ b/mkfs.c
Josef Bacik a37e25
@@ -348,7 +348,7 @@ int main(int ac, char **av)
Josef Bacik 4ec8d5
 	u64 alloc_start = 0;
Josef Bacik 4ec8d5
 	u64 metadata_profile = BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_DUP;
Josef Bacik 4ec8d5
 	u64 data_profile = BTRFS_BLOCK_GROUP_RAID0;
Josef Bacik 4ec8d5
-	u32 leafsize = getpagesize();
Josef Bacik 4ec8d5
+	u32 leafsize = sysconf(_SC_PAGESIZE);
Josef Bacik 4ec8d5
 	u32 sectorsize = 4096;
Josef Bacik 4ec8d5
 	u32 nodesize = leafsize;
Josef Bacik 4ec8d5
 	u32 stripesize = 4096;
Josef Bacik a37e25
@@ -405,7 +405,7 @@ int main(int ac, char **av)
Josef Bacik 4ec8d5
 				print_usage();
Josef Bacik 4ec8d5
 		}
Josef Bacik 4ec8d5
 	}
Josef Bacik 4ec8d5
-	sectorsize = max(sectorsize, (u32)getpagesize());
Josef Bacik 4ec8d5
+	sectorsize = max(sectorsize, (u32)sysconf(_SC_PAGESIZE));
Josef Bacik 4ec8d5
 	if (leafsize < sectorsize || (leafsize & (sectorsize - 1))) {
Josef Bacik 4ec8d5
 		fprintf(stderr, "Illegal leafsize %u\n", leafsize);
Josef Bacik 4ec8d5
 		exit(1);