XINU
Functions
getdev.c File Reference
#include <xinu.h>
#include <string.h>
Include dependency graph for getdev.c:

Go to the source code of this file.

Functions

did32 getdev (char *devname)
 

Function Documentation

◆ getdev()

did32 getdev ( char *  devname)

Definition at line 10 of file getdev.c.

References DEVNAMLEN, devtab, disable(), dentry::dvname, NDEVS, restore(), strncmp(), and SYSERR.

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 }
int32 strncmp(const char *, const char *, int32)
void restore(intmask)
#define NDEVS
Definition: conf.h:74
#define SYSERR
処理が失敗した場合
Definition: kernel.h:79
struct dentry devtab[]
Definition: conf.c:11
uint32 intmask
保存された割り込みマスク
Definition: kernel.h:38
int32 did32
デバイスID
Definition: kernel.h:28
char * dvname
Definition: conf.h:9
#define DEVNAMLEN
デバイス名の最大サイズ
Definition: device.h:7
intmask disable(void)
割り込み禁止(intr.Sに定義がある)
Here is the call graph for this function: