summaryrefslogtreecommitdiffstats
path: root/sbin/geom
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2011-05-24 16:49:34 +0000
committerae <ae@FreeBSD.org>2011-05-24 16:49:34 +0000
commit0567ac733b1a16f92fcebe9e7030923a9b59efd9 (patch)
treec53cdf07734527f1d8b5034568304b78f28b3a39 /sbin/geom
parentf4e35def4a48178d9be0cf83db88ac8b4dccf463 (diff)
downloadFreeBSD-src-0567ac733b1a16f92fcebe9e7030923a9b59efd9.zip
FreeBSD-src-0567ac733b1a16f92fcebe9e7030923a9b59efd9.tar.gz
Fix calculation of alignment for odd values. Also do not change value
when it is already aligned.
Diffstat (limited to 'sbin/geom')
-rw-r--r--sbin/geom/class/part/geom_part.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/geom/class/part/geom_part.c b/sbin/geom/class/part/geom_part.c
index 19d1502..e11edd5 100644
--- a/sbin/geom/class/part/geom_part.c
+++ b/sbin/geom/class/part/geom_part.c
@@ -295,8 +295,8 @@ fmtattrib(struct gprovider *pp)
return (buf);
}
-#define ALIGNDOWN(d, a) (-(a) & (d))
-#define ALIGNUP(d, a) (-(-(a) & -(d)))
+#define ALIGNDOWN(d, a) ((d) % (a) ? (d) - (d) % (a): (d))
+#define ALIGNUP(d, a) ((d) % (a) ? (d) - (d) % (a) + (a): (d))
static int
gpart_autofill_resize(struct gctl_req *req)
OpenPOWER on IntegriCloud