Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 May 2011 16:49:34 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222263 - head/sbin/geom/class/part
Message-ID:  <201105241649.p4OGnYSS077869@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Tue May 24 16:49:34 2011
New Revision: 222263
URL: http://svn.freebsd.org/changeset/base/222263

Log:
  Fix calculation of alignment for odd values. Also do not change value
  when it is already aligned.

Modified:
  head/sbin/geom/class/part/geom_part.c

Modified: head/sbin/geom/class/part/geom_part.c
==============================================================================
--- head/sbin/geom/class/part/geom_part.c	Tue May 24 16:06:26 2011	(r222262)
+++ head/sbin/geom/class/part/geom_part.c	Tue May 24 16:49:34 2011	(r222263)
@@ -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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105241649.p4OGnYSS077869>