On Fri, Apr 08, 2011 at 09:20:49PM -0300, Davidlohr Bueso wrote: > This functions returns the status of the device's alignment. It will > be 0 when aligned, otherwise return the offset. > > Signed-off-by: Davidlohr Bueso <dave@xxxxxxx> > --- > include/blkdev.h | 3 +++ > lib/blkdev.c | 12 ++++++++++++ > 2 files changed, 15 insertions(+), 0 deletions(-) Applied, thanks. > +/* > + * Return the alignment status of a device > + */ > +int blkdev_is_misaligned(int fd) > +{ > + int aligned; > + > + if (ioctl(fd, BLKALIGNOFF, &aligned) < 0) > + return -1; return 0; The function should not report any problem on old kernels. We have to print the warning only if we are really sure that the device is misaligned. > + return aligned; > +} Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html