mirror of
https://github.com/netbirdio/FreeBSD-ports.git
synced 2026-05-22 18:42:42 -07:00
Unbreak `sysutils/linuxfdisk' after r276737, which removed DIOCGDINFO once
and for all; the code in `sys_bsd.c' is already using working alternatives DIOCGMEDIASIZE and DIOCGSECTORSIZE except in sys_bsd_getgeometry(), but it returns -1 for me even on stable/8. While here, clean up Makefile a bit.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
PORTNAME= linuxfdisk
|
||||
PORTVERSION= 2.11z
|
||||
CATEGORIES= sysutils
|
||||
MASTER_SITES= http://ftp.sunet.se/pub/Linux/kernel.org/linux/utils/util-linux/v2.11/ \
|
||||
MASTER_SITES= KERNEL_ORG/linux/utils/util-linux/v2.11/ \
|
||||
http://ftp.be.debian.org/pub/linux/utils/util-linux/v2.11/ \
|
||||
ftp://segfault.kiev.ua/pub/
|
||||
DISTNAME= util-linux-${PORTVERSION}
|
||||
@@ -17,8 +17,7 @@ USES= tar:bzip2
|
||||
ONLY_FOR_ARCHS= i386 amd64
|
||||
|
||||
pre-patch:
|
||||
@rm -f ${WRKSRC}/Makefile
|
||||
@cp ${FILESDIR}/linuxfdisk-Makefile ${WRKSRC}/Makefile
|
||||
@cp ${FILESDIR}/linuxfdisk-sys_bsd.c ${WRKSRC}/sys_bsd.c
|
||||
@${CP} ${FILESDIR}/linuxfdisk-Makefile ${WRKSRC}/Makefile
|
||||
@${CP} ${FILESDIR}/linuxfdisk-sys_bsd.c ${WRKSRC}/sys_bsd.c
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
||||
@@ -20,11 +20,13 @@ sys_bsd_sectorsize(int fd)
|
||||
return d;
|
||||
}
|
||||
#endif
|
||||
#ifdef DIOCGDINFO
|
||||
;{
|
||||
struct disklabel dl;
|
||||
if (ioctl(fd, DIOCGDINFO, &dl) == 0)
|
||||
return dl.d_secsize;
|
||||
}
|
||||
#endif
|
||||
#ifdef DIOCGSLICEINFO
|
||||
;{
|
||||
struct diskslices dss;
|
||||
@@ -75,11 +77,13 @@ sys_bsd_getsectors(int fd, unsigned long *s)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef DIOCGDINFO
|
||||
/* Fallback method. */
|
||||
if (ioctl(fd, DIOCGDINFO, &dl) == 0) {
|
||||
*s = (unsigned long) dl.d_secperunit;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -103,7 +107,9 @@ sys_bsd_getgeometry(int fd, struct hd_geometry *g)
|
||||
{
|
||||
/* XXX */
|
||||
struct disklabel dl;
|
||||
#ifdef DIOCGDINFO
|
||||
if (ioctl(fd, DIOCGDINFO, &dl) < 0)
|
||||
#endif
|
||||
return -1;
|
||||
g->cylinders = dl.d_ncylinders;
|
||||
g->heads = dl.d_ntracks;
|
||||
|
||||
Reference in New Issue
Block a user