From 916490f8bfc84987b21f453e65c43720b64f07d7 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Thu, 17 Aug 2006 18:23:44 +0000 Subject: [PATCH] Add lvm_getpagesize wrapper. --- WHATS_NEW | 1 + include/.symlinks | 1 + lib/Makefile.in | 1 + lib/config/config.c | 2 +- lib/device/dev-io.c | 2 +- lib/format_text/format-text.c | 2 +- lib/format_text/layout.h | 2 +- lib/metadata/metadata.h | 2 +- lib/misc/lib.h | 1 + lib/mm/memlock.c | 2 +- tools/lvconvert.c | 2 +- tools/lvcreate.c | 2 +- 12 files changed, 12 insertions(+), 8 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index abb1d0759..084435aa4 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.09 - ================================== + Add lvm_getpagesize wrapper. Add --maxphysicalvolumes to vgchange. Version 2.02.08 - 15th August 2006 diff --git a/include/.symlinks b/include/.symlinks index 21ee43f4e..4f4c7aeb2 100644 --- a/include/.symlinks +++ b/include/.symlinks @@ -41,6 +41,7 @@ ../lib/misc/lvm-exec.h ../lib/misc/lvm-file.h ../lib/misc/lvm-string.h +../lib/misc/lvm-wrappers.h ../lib/misc/sharedlib.h ../lib/regex/matcher.h ../lib/report/report.h diff --git a/lib/Makefile.in b/lib/Makefile.in index 60e403b96..fe84ec166 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -78,6 +78,7 @@ SOURCES =\ misc/lvm-exec.c \ misc/lvm-file.c \ misc/lvm-string.c \ + misc/lvm-wrappers.c \ mm/memlock.c \ regex/matcher.c \ regex/parse_rx.c \ diff --git a/lib/config/config.c b/lib/config/config.c index 99d7f2e70..fec486e54 100644 --- a/lib/config/config.c +++ b/lib/config/config.c @@ -187,7 +187,7 @@ int read_config_fd(struct config_tree *cft, struct device *dev, use_mmap = 0; if (use_mmap) { - mmap_offset = offset % getpagesize(); + mmap_offset = offset % lvm_getpagesize(); /* memory map the file */ p->fb = mmap((caddr_t) 0, size + mmap_offset, PROT_READ, MAP_PRIVATE, dev_fd(dev), offset - mmap_offset); diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c index f0fd39305..afa2dedb3 100644 --- a/lib/device/dev-io.c +++ b/lib/device/dev-io.c @@ -176,7 +176,7 @@ static int _aligned_io(struct device_area *where, void *buffer, } if (!block_size) - block_size = getpagesize(); + block_size = lvm_getpagesize(); _widen_region(block_size, where, &widened); diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 1ce29fe37..7586dca63 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -1005,7 +1005,7 @@ static int _mda_setup(const struct format_type *fmt, uint64_t start1, mda_size1; /* First area - start of disk */ uint64_t start2, mda_size2; /* Second area - end of disk */ uint64_t wipe_size = 8 << SECTOR_SHIFT; - size_t pagesize = getpagesize(); + size_t pagesize = lvm_getpagesize(); if (!pvmetadatacopies) { /* Space available for PEs */ diff --git a/lib/format_text/layout.h b/lib/format_text/layout.h index 40eae479b..f74ba606b 100644 --- a/lib/format_text/layout.h +++ b/lib/format_text/layout.h @@ -83,6 +83,6 @@ struct mda_context { #define FMTT_VERSION 1 #define MDA_HEADER_SIZE 512 #define LVM2_LABEL "LVM2 001" -#define MDA_SIZE_MIN (8 * (unsigned) getpagesize()) +#define MDA_SIZE_MIN (8 * (unsigned) lvm_getpagesize()) #endif diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h index 95a5ae62c..88db68009 100644 --- a/lib/metadata/metadata.h +++ b/lib/metadata/metadata.h @@ -29,7 +29,7 @@ #define MAX_STRIPES 128U #define SECTOR_SHIFT 9L #define SECTOR_SIZE ( 1L << SECTOR_SHIFT ) -#define STRIPE_SIZE_MIN ( (unsigned) getpagesize() >> SECTOR_SHIFT) /* PAGESIZE in sectors */ +#define STRIPE_SIZE_MIN ( (unsigned) lvm_getpagesize() >> SECTOR_SHIFT) /* PAGESIZE in sectors */ #define STRIPE_SIZE_MAX ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */ #define STRIPE_SIZE_LIMIT ((UINT_MAX >> 2) + 1) #define PV_MIN_SIZE ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */ diff --git a/lib/misc/lib.h b/lib/misc/lib.h index 62c6fa885..1f9716528 100644 --- a/lib/misc/lib.h +++ b/lib/misc/lib.h @@ -28,6 +28,7 @@ #include "log.h" #include "intl.h" #include "lvm-types.h" +#include "lvm-wrappers.h" #include diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c index 3c5039b02..c4c845065 100644 --- a/lib/mm/memlock.c +++ b/lib/mm/memlock.c @@ -58,7 +58,7 @@ static int _default_priority; static void _touch_memory(void *mem, size_t size) { - size_t pagesize = getpagesize(); + size_t pagesize = lvm_getpagesize(); void *pos = mem; void *end = mem + size - sizeof(long); diff --git a/tools/lvconvert.c b/tools/lvconvert.c index cb3b56e1a..0aa0c9084 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -102,7 +102,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd, int argc, char **argv) { int region_size; - int pagesize = getpagesize(); + int pagesize = lvm_getpagesize(); memset(lp, 0, sizeof(*lp)); diff --git a/tools/lvcreate.c b/tools/lvcreate.c index 2c3338887..89304c003 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -249,7 +249,7 @@ static int _read_mirror_params(struct lvcreate_params *lp, { int argc = *pargc; int region_size; - int pagesize = getpagesize(); + int pagesize = lvm_getpagesize(); if (argc && (unsigned) argc < lp->mirrors) { log_error("Too few physical volumes on "