summaryrefslogtreecommitdiff
path: root/src/lib9
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-11-10 23:42:21 -0800
committerRuss Cox <rsc@golang.org>2009-11-10 23:42:21 -0800
commit9e5c0682b59d564cab020da3e50511e5df700f7a (patch)
tree3ce2a560e87da9c178a163af21d2ab0ce03e3e87 /src/lib9
parent5b92ea95ef4018802f1463def0585eebb551d724 (diff)
downloadgolang-9e5c0682b59d564cab020da3e50511e5df700f7a.tar.gz
lib9: rip out platform specific code that breaks on pclinuxos
R=r CC=golang-dev http://codereview.appspot.com/154049
Diffstat (limited to 'src/lib9')
-rw-r--r--src/lib9/_p9dir.c116
1 files changed, 7 insertions, 109 deletions
diff --git a/src/lib9/_p9dir.c b/src/lib9/_p9dir.c
index 1c1aa6582..733defe30 100644
--- a/src/lib9/_p9dir.c
+++ b/src/lib9/_p9dir.c
@@ -32,119 +32,17 @@ THE SOFTWARE.
#include <pwd.h>
#include <grp.h>
-#if defined(__FreeBSD__)
-#include <sys/disk.h>
-#include <sys/disklabel.h>
-#include <sys/ioctl.h>
-#endif
-
-#if defined(__OpenBSD__)
-#include <sys/disklabel.h>
-#include <sys/ioctl.h>
-#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; i<nelem(diskdev); i++)
- if(diskdev[i] == dev)
- return 1;
- return 0;
-}
-#endif
-
-#if defined(__FreeBSD__) /* maybe OpenBSD too? */
-char *diskdev[] = {
- "aacd",
- "ad",
- "ar",
- "afd",
- "amrd",
- "da",
- "fla",
- "idad",
- "md",
- "mlxd",
- "pst",
- "twed",
- "vn",
- "wd",
- "wfd",
- "da",
-};
-static int
-isdisk(struct stat *st)
-{
- char *name;
- int i, len;
-
- if(!S_ISCHR(st->st_mode))
- return 0;
- name = devname(st->st_rdev, S_IFCHR);
- for(i=0; i<nelem(diskdev); i++){
- len = strlen(diskdev[i]);
- if(strncmp(diskdev[i], name, len) == 0 && isdigit((uchar)name[len]))
- return 1;
- }
- return 0;
-}
-#endif
-
-
-#if defined(__linux__)
-#include <linux/hdreg.h>
-#include <linux/fs.h>
-#include <sys/ioctl.h>
-#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;
/*