diff options
Diffstat (limited to 'src/lib9')
-rw-r--r-- | src/lib9/_p9dir.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/src/lib9/_p9dir.c b/src/lib9/_p9dir.c index 517dc773..555d20d0 100644 --- a/src/lib9/_p9dir.c +++ b/src/lib9/_p9dir.c @@ -10,6 +10,10 @@ #if defined(__FreeBSD__) || defined(__OpenBSD__) #include <sys/disklabel.h> #include <sys/ioctl.h> +#define _HAVEDISKLABEL +#endif + +#if defined(__OpenBSD__) static int diskdev[] = { 151, /* aacd */ 116, /* ad */ @@ -41,9 +45,44 @@ isdisk(struct stat *st) return 1; return 0; } -#define _HAVEDISKLABEL #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; + + if(!S_ISCHR(st->st_mode)) + return 0; + name = devname(st->st_rdev, S_IFCHR); + for(i=0; i<nelem(diskdev); i++) + if(strcmp(diskdev[i], name) == 0) + return 1; + return 0; +} +#endif + + #if defined(__linux__) #include <linux/hdreg.h> #include <linux/fs.h> |