-/* $OpenBSD: editor.c,v 1.390 2023/01/17 23:56:51 krw Exp $ */
+/* $OpenBSD: editor.c,v 1.391 2023/01/18 00:48:14 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <millert@openbsd.org>
#ifdef SUN_CYLCHECK
if (lp->d_flags & D_VENDOR) {
/* Align to cylinder boundaries. */
- start = ((start + cylsecs - 1) / cylsecs) *
- cylsecs;
+ start = ROUNDUP(start, lp_org->d_secpercyl);
stop = (stop / cylsecs) * cylsecs;
if (start > stop)
start = stop;
}
#ifdef SUN_CYLCHECK
if (lp->d_flags & D_VENDOR) {
- secs = ((secs + cylsecs - 1) / cylsecs) * cylsecs;
+ secs = ROUNDUP(secs, lp_org->d_secpercyl);
while (secs > chunksize)
secs -= cylsecs;
}
}
#ifdef SUN_CYLCHECK
- if (lp->d_flags & D_VENDOR) {
- u_int64_t cylsecs;
- cylsecs = lp->d_secpercyl;
- ui = ((ui + cylsecs - 1) / cylsecs) * cylsecs;
- }
+ if (lp->d_flags & D_VENDOR)
+ ui = ROUNDUP(ui, lp->d_secpercyl);
#endif
if (DL_GETPOFFSET(pp) + ui > ending_sector) {
fputs("Amount too big\n", stderr);
start = DL_GETPOFFSET(pp);
if ((flags & ROUND_OFFSET_UP) == ROUND_OFFSET_UP)
- start = ((start + startalign - 1) / startalign) * startalign;
+ start = ROUNDUP(start, startalign);
else if ((flags & ROUND_OFFSET_DOWN) == ROUND_OFFSET_DOWN)
start = (start / startalign) * startalign;
stop = DL_GETPOFFSET(pp) + DL_GETPSIZE(pp);
if ((flags & ROUND_SIZE_UP) == ROUND_SIZE_UP)
- stop = ((stop + stopalign - 1) / stopalign) * stopalign;
+ stop = ROUNDUP(stop, stopalign);
else if ((flags & ROUND_SIZE_DOWN) == ROUND_SIZE_DOWN)
stop = (stop / stopalign) * stopalign;
if (stop > maxstop)