Commit graph

11 commits

Author SHA1 Message Date
Davidlohr Bueso
ba32692970 blkdev: add blkdev_is_misaligned()
This functions returns the status of the device's alignment. It will
be 0 when aligned, otherwise return the offset.

[kzak@redhat.com: - returns 0 if the ioctl failed]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 13:08:52 +02:00
Fabian Groffen
eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
Solaris lacks err, errx, warn and warnx.  This also means the err.h header
doesn't exist.  Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-02-14 17:45:24 +01:00
Karel Zak
fab1c0463a lib: fix syntax error in blkdev.c
Reported-by: Tuco <tuco.xyz@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-08-23 11:06:08 +02:00
Karel Zak
abbd79ac35 lib: fix blkdev_find_size()
echo l | fdisk/fdisk /dev/zero

FYI that however now spins forever doing:

offset=3074457345618258603)
    at ../lib/blkdev.c:31
    at ../lib/blkdev.c:151
    at ../lib/blkdev.c:161

Reported-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-16 17:31:39 +01:00
Jim Meyering
1675ed7819 lib: avoid compilation failure on rawhide
* lib/blkdev.c: Include <sys/stat.h>, for use of S_ISREG.
2010-03-16 14:31:23 +01:00
Karel Zak
530381d2d5 lib: use fstat() as fallback in blkdev_get_size()
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-11 00:59:04 +01:00
Karel Zak
3069624180 liblkid: move getsize.c code to lib/
.. and cleanup blkdev_get_size() usage in libblkid.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-10 15:41:40 +01:00
Karel Zak
2a1dfbad1c libblkid: use BLKSSZGET for GPT sectors
The current implementation uses fixed sector size (512 bytes), that's
wrong. UEFI standard requires real logical sector size -- it means
BLKSSZGET for Linux.

The size of GPT header is not static, but whole sector is allocated
for the header. In theory the HeaderSize field could be greater than
sizeof(struct gpt_header). It means we have to read whole sector with
the header, because the header crc32 checksum is counted according to
HeaderSize.

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-22 14:52:39 +02:00
Karel Zak
33bbc95937 lib: add test_ismounted for regression test
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18 15:43:34 +01:00
Samuel Thibault
268cefe6cb lib: blkdev.c clean up, non-linux support
[kzak@redhat.com: split the original patch to small patches]

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-07-24 00:52:52 +02:00
Stefan Krah
3738a48e08 lib: add blkdev.{c,h}
Now we duplicate BLK* ioctls on many places... This patch also
fix BLKGETSIZE64 usage in dependence on kernel version.

Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Stefan Krah <stefan@bytereef.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-11-07 12:37:30 +01:00