From: Russ Cox Date: Wed, 11 Nov 2009 07:42:21 +0000 (-0800) Subject: lib9: rip out platform specific code that breaks on pclinuxos X-Git-Tag: weekly.2009-11-12~38 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=cd0cbd3ed2a01d10f14e04ee7f4dc1748af06f02;p=gostls13.git lib9: rip out platform specific code that breaks on pclinuxos R=r CC=golang-dev https://golang.org/cl/154049 --- diff --git a/src/lib9/_p9dir.c b/src/lib9/_p9dir.c index 1c1aa65821..733defe303 100644 --- a/src/lib9/_p9dir.c +++ b/src/lib9/_p9dir.c @@ -32,119 +32,17 @@ THE SOFTWARE. #include #include -#if defined(__FreeBSD__) -#include -#include -#include -#endif - -#if defined(__OpenBSD__) -#include -#include -#define _HAVEDISKLABEL -static int diskdev[] = { - 151, /* aacd */ - 116, /* ad */ - 157, /* ar */ - 118, /* afd */ - 133, /* amrd */ - 13, /* da */ - 102, /* fla */ - 109, /* idad */ - 95, /* md */ - 131, /* mlxd */ - 168, /* pst */ - 147, /* twed */ - 43, /* vn */ - 3, /* wd */ - 87, /* wfd */ - 4, /* da on FreeBSD 5 */ -}; -static int -isdisk(struct stat *st) -{ - int i, dev; - - if(!S_ISCHR(st->st_mode)) - return 0; - dev = major(st->st_rdev); - for(i=0; ist_mode)) - return 0; - name = devname(st->st_rdev, S_IFCHR); - for(i=0; i -#include -#include -#undef major -#define major(dev) ((int)(((dev) >> 8) & 0xff)) +/* + * No need for a real disk size function here: + * the Go build isn't looking at raw disk devices, + * so this avoids portability problems. + */ +#define _HAVEDISKSIZE static vlong -disksize(int fd, int dev) +disksize(int fd, int x) { - u64int u64; - long l; - struct hd_geometry geo; - - memset(&geo, 0, sizeof geo); - l = 0; - u64 = 0; -#ifdef BLKGETSIZE64 - if(ioctl(fd, BLKGETSIZE64, &u64) >= 0) - return u64; -#endif - if(ioctl(fd, BLKGETSIZE, &l) >= 0) - return l*512; - if(ioctl(fd, HDIO_GETGEO, &geo) >= 0) - return (vlong)geo.heads*geo.sectors*geo.cylinders*512; return 0; } -#define _HAVEDISKSIZE -#endif - -#if !defined(__linux__) && !defined(__sun__) -#define _HAVESTGEN -#endif int _p9usepwlibrary = 1; /*