XINU
system
getdev.c
Go to the documentation of this file.
1
/* getdev.c - getdev */
2
3
#include <
xinu.h
>
4
#include <
string.h
>
5
6
/*------------------------------------------------------------------------
7
* getdev - Convert a device name to a device ID
8
*------------------------------------------------------------------------
9
*/
10
did32
getdev
(
11
char
*devname
/* Name of the device */
12
)
13
{
14
intmask
mask;
/* Saved interrupt mask */
15
did32
id;
/* Value to return to caller */
16
17
mask =
disable
();
18
for
(
id
= 0;
id
<
NDEVS
;
id
++) {
19
if
(
strncmp
(devname,
devtab
[
id
].
dvname
,
DEVNAMLEN
)) {
20
restore
(mask);
21
return
id;
22
}
23
}
24
restore
(mask);
25
return
(
did32
)
SYSERR
;
26
}
strncmp
int32 strncmp(const char *, const char *, int32)
restore
void restore(intmask)
string.h
NDEVS
#define NDEVS
Definition:
conf.h:74
xinu.h
全てのシステムヘッダファイルをインクルードする。
SYSERR
#define SYSERR
処理が失敗した場合
Definition:
kernel.h:79
devtab
struct dentry devtab[]
Definition:
conf.c:11
intmask
uint32 intmask
保存された割り込みマスク
Definition:
kernel.h:38
did32
int32 did32
デバイスID
Definition:
kernel.h:28
dentry::dvname
char * dvname
Definition:
conf.h:9
DEVNAMLEN
#define DEVNAMLEN
デバイス名の最大サイズ
Definition:
device.h:7
getdev
did32 getdev(char *devname)
Definition:
getdev.c:10
disable
intmask disable(void)
割り込み禁止(intr.Sに定義がある)
Generated by
1.8.13