From: Joe Thornber <thornber@btconnect.com>
To: linux-lvm@sistina.com
Subject: Re: [linux-lvm] [PATCH] LVM 1.0 & Linux 2.4.9
Date: Fri, 17 Aug 2001 11:25:28 +0100 [thread overview]
Message-ID: <20010817112527.C450@btconnect.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0108162238310.5208-100000@greebo.foobarhouse.com>; from jamesp@foobarhouse.com on Thu, Aug 16, 2001 at 10:40:52PM +0100
On Thu, Aug 16, 2001 at 10:40:52PM +0100, James Pattinson wrote:
> Hi!
>
> Another day, another kernel to compile! But after applying LVM 1.0 to
> 2.4.9 this evening, I found it didn't compile. It's to do with a mismatch
> between the max and min macros in the kernel and in LVM. Here's a patch to
> make things work:
This is what I've checked in, just a few changes to ensure we still work
with older kernels.
- Joe
--- kernel/lvm-internal.h 2001/07/10 13:19:25 1.5
+++ kernel/lvm-internal.h 2001/08/17 10:21:19
@@ -53,6 +53,12 @@
extern struct block_device_operations lvm_blk_dops;
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 9)
+#undef min
+#undef max
+#define min(type, a, b) (((a) < (b)) ? (a) : (b))
+#define max(type, a, b) (((a) > (b)) ? (a) : (b))
+#endif
/* debug macros */
#ifdef DEBUG_IOCTL
--- kernel/lvm-snap.c 2001/06/27 12:03:09 1.5
+++ kernel/lvm-snap.c 2001/08/17 10:21:20
@@ -373,8 +373,8 @@
blksize_org = lvm_get_blksize(org_phys_dev);
blksize_snap = lvm_get_blksize(snap_phys_dev);
- max_blksize = max(blksize_org, blksize_snap);
- min_blksize = min(blksize_org, blksize_snap);
+ max_blksize = max(int, blksize_org, blksize_snap);
+ min_blksize = min(int, blksize_org, blksize_snap);
max_sectors = KIO_MAX_SECTORS * (min_blksize>>9);
if (chunk_size % (max_blksize>>9))
@@ -382,7 +382,7 @@
while (chunk_size)
{
- nr_sectors = min(chunk_size, max_sectors);
+ nr_sectors = min(int, chunk_size, max_sectors);
chunk_size -= nr_sectors;
iobuf->length = nr_sectors << 9;
@@ -508,7 +508,7 @@
buckets = lv->lv_remap_end;
max_buckets = calc_max_buckets();
- buckets = min(buckets, max_buckets);
+ buckets = min(unsigned long, buckets, max_buckets);
while (buckets & (buckets-1))
buckets &= (buckets-1);
--- kernel/lvm.c 2001/07/13 11:40:42 1.39
+++ kernel/lvm.c 2001/08/17 10:21:24
@@ -2452,7 +2452,7 @@
/* save availiable i/o statistic data */
if (old_lv->lv_stripes < 2) { /* linear logical volume */
- end = min(old_lv->lv_current_le, new_lv->lv_current_le);
+ end = min(uint, old_lv->lv_current_le, new_lv->lv_current_le);
for (l = 0; l < end; l++) {
new_lv->lv_current_pe[l].reads +=
old_lv->lv_current_pe[l].reads;
@@ -2466,7 +2466,7 @@
old_stripe_size = old_lv->lv_allocated_le / old_lv->lv_stripes;
new_stripe_size = new_lv->lv_allocated_le / new_lv->lv_stripes;
- end = min(old_stripe_size, new_stripe_size);
+ end = min(uint, old_stripe_size, new_stripe_size);
for (i = source = dest = 0; i < new_lv->lv_stripes; i++) {
for (j = 0; j < end; j++) {
--- kernel/lvm.h 2001/08/16 14:31:45 1.25
+++ kernel/lvm.h 2001/08/17 10:21:25
@@ -165,14 +165,6 @@
#define LVM_DIR_PREFIX "/dev/"
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-#ifndef max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
-
-
/*
* i/o protocol version
*
--- tools/lib/pv_read_uuidlist.c 2001/04/24 14:29:21 1.4
+++ tools/lib/pv_read_uuidlist.c 2001/08/17 10:21:25
@@ -74,7 +74,10 @@
goto pv_read_uuidlist_end;
}
- num = min(pv->pv_uuidlist_on_disk.size, LIST_SIZE);
+ num = pv->pv_uuidlist_on_disk.size;
+ if (LIST_SIZE < num)
+ num = LIST_SIZE;
+
if (read(pv_handle, this_pv_uuidlist, num) != num) {
ret = -LVM_EPV_READ_UUIDLIST_READ;
goto pv_read_uuidlist_end;
next prev parent reply other threads:[~2001-08-17 10:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-16 21:40 [linux-lvm] [PATCH] LVM 1.0 & Linux 2.4.9 James Pattinson
2001-08-17 9:28 ` Joe Thornber
2001-08-17 10:25 ` Joe Thornber [this message]
2001-08-17 12:25 ` Eric Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010817112527.C450@btconnect.com \
--to=thornber@btconnect.com \
--cc=linux-lvm@sistina.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.