borisb / rpms / btrfs-progs

Forked from rpms/btrfs-progs 2 years ago
Clone
Josef Bacik 4ec8d5
--- btrfs-progs-0.19/btrfsck.c	
Josef Bacik 4ec8d5
+++ btrfs-progs-0.19/btrfsck.c	
Josef Bacik 4ec8d5
@@ -21,6 +21,9 @@ 
Josef Bacik 4ec8d5
 #include <stdio.h>
Josef Bacik 4ec8d5
 #include <stdlib.h>
Josef Bacik 4ec8d5
 #include <fcntl.h>
Josef Bacik 4ec8d5
+#include <sys/types.h>
Josef Bacik 4ec8d5
+#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 4ec8d5
--- btrfs-progs-0.19/mkfs.c	
Josef Bacik 4ec8d5
+++ btrfs-progs-0.19/mkfs.c	
Josef Bacik 4ec8d5
@@ -341,7 +341,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 4ec8d5
@@ -398,7 +398,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);