summaryrefslogtreecommitdiffstats
path: root/fdisk/sfdisk.c
diff options
context:
space:
mode:
authorSamuel Thibault2008-07-24 00:46:05 +0200
committerKarel Zak2008-07-24 00:52:52 +0200
commit6b0054a2c6dddb43155220cac13848df98d74423 (patch)
tree27208ec3336d4785d6fcb8b068e9657b96556a6b /fdisk/sfdisk.c
parentlib: blkdev.c clean up, non-linux support (diff)
downloadkernel-qcow2-util-linux-6b0054a2c6dddb43155220cac13848df98d74423.tar.gz
kernel-qcow2-util-linux-6b0054a2c6dddb43155220cac13848df98d74423.tar.xz
kernel-qcow2-util-linux-6b0054a2c6dddb43155220cac13848df98d74423.zip
fdisk: non-linux support (BLK* and HDIO_*)
BLK* and HDIO_* are not available on all platform. Work around this in a few places. [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>
Diffstat (limited to 'fdisk/sfdisk.c')
-rw-r--r--fdisk/sfdisk.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index d737d69d1..f70b1629c 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -446,7 +446,10 @@ get_geometry(char *dev, int fd, int silent) {
unsigned long long sectors;
struct geometry R;
- if (ioctl(fd, HDIO_GETGEO, &g)) {
+#ifdef HDIO_GETGEO
+ if (ioctl(fd, HDIO_GETGEO, &g))
+#endif
+ {
g.heads = g.sectors = g.cylinders = g.start = 0;
if (!silent)
do_warn(_("Disk %s: cannot get geometry\n"), dev);
@@ -790,7 +793,12 @@ add_sector_and_offset(struct disk_desc *z) {
/* tell the kernel to reread the partition tables */
static int
reread_ioctl(int fd) {
- if (ioctl(fd, BLKRRPART)) {
+#ifdef BLKRRPART
+ if (ioctl(fd, BLKRRPART))
+#else
+ errno = ENOSYS;
+#endif
+ {
perror("BLKRRPART");
/* 2.6.8 returns EIO for a zero table */