summaryrefslogtreecommitdiffstats
path: root/lib/blkdev.c
Commit message (Collapse)AuthorAgeFilesLines
* lib/blkdev: fix compiler warning [-Wreturn-type]Karel Zak2012-04-101-1/+3
| | | | | | | ../lib/blkdev.c: In function ‘blkdev_get_geometry’: ../lib/blkdev.c:287:1: warning: control reaches end of non-void function [-Wreturn-type] Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: move kernel geometry into blkdevDavidlohr Bueso2012-04-101-0/+23
| | | | | | This is a more generic place for this ioctl. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* blkdev: add is_blkdev functionDavidlohr Bueso2012-01-051-0/+6
| | | | | | We should have the most basic of checks in this library to see whether or not a block device is being used. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* fdisk: use CDROM_GET_CAPABILITY ioctlDavidlohr Bueso2012-01-021-0/+13
| | | | | | And replace the current archaic logic of is_ide_cdrom_or_tape(). Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* lib: [blkdev.c] remove kernel version check from blkdev_get_sector_size()Karel Zak2011-06-271-10/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [blkdev.c] more robust blkdev_is_misaligned()Karel Zak2011-06-271-1/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [blkdev.c] add blkdev_get_physector_size()Davidlohr Bueso2011-06-271-4/+33
| | | | | | | | This function uses the BLKPBSZGET ioctl to get the physical block size of the device. Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: hurd build fixesSamuel Thibault2011-06-201-0/+4
| | | | | | | | | | | | * Make blkdev_is_misaligned return 0 when BLKALIGNOFF is not available. * Make procutils.c include c.h to get a PATH_MAX replacement. * Provide agetty.c USE_SYSLOG, DEFAULT_VCTERM and DEFAULT_STERM defaults for Hurd. * Make agetty.c only deal with OFDEL, XCASE and VSWTCH if they are available. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* blkdev: add blkdev_is_misaligned()Davidlohr Bueso2011-04-121-0/+12
| | | | | | | | | | 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>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-1/+1
| | | | | | | | 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>
* lib: fix syntax error in blkdev.cKarel Zak2010-08-231-1/+1
| | | | | Reported-by: Tuco <tuco.xyz@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: fix blkdev_find_size()Karel Zak2010-03-161-4/+16
| | | | | | | | | | | | | | 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>
* lib: avoid compilation failure on rawhideJim Meyering2010-03-161-0/+1
| | | | * lib/blkdev.c: Include <sys/stat.h>, for use of S_ISREG.
* lib: use fstat() as fallback in blkdev_get_size()Karel Zak2010-03-111-0/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* liblkid: move getsize.c code to lib/Karel Zak2010-03-101-8/+79
| | | | | | .. and cleanup blkdev_get_size() usage in libblkid. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: use BLKSSZGET for GPT sectorsKarel Zak2009-10-221-1/+5
| | | | | | | | | | | | | | 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>
* lib: add test_ismounted for regression testKarel Zak2009-02-181-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: blkdev.c clean up, non-linux supportSamuel Thibault2008-07-241-8/+59
| | | | | | | [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>
* lib: add blkdev.{c,h}Stefan Krah2007-11-071-0/+93
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>