mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
use device names for FreeBSD (Lou Kamenov)
This commit is contained in:
parent
97e4432344
commit
69bdb78dec
1 changed files with 40 additions and 1 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue