XINU
lfibget.c
Go to the documentation of this file.
1 /* lfibget.c - lfibget */
2 
3 #include <xinu.h>
4 
5 /*------------------------------------------------------------------------
6  * lfibget - Get an index block from disk given its number (assumes
7  * mutex is held)
8  *------------------------------------------------------------------------
9  */
10 void lfibget(
11  did32 diskdev, /* Device ID of disk to use */
12  ibid32 inum, /* ID of index block to fetch */
13  struct lfiblk *ibuff /* Buffer to hold index block */
14  )
15 {
16  char *from, *to; /* Pointers used in copying */
17  int32 i; /* Loop index used during copy */
18  char dbuff[LF_BLKSIZ]; /* Buffer to hold disk block */
19 
20  /* Read disk block that contains the specified index block */
21 
22  read(diskdev, dbuff, ib2sect(inum));
23 
24  /* Copy specified index block to caller's ibuff */
25 
26  from = dbuff + ib2disp(inum);
27  to = (char *)ibuff;
28  for (i=0 ; i<sizeof(struct lfiblk) ; i++)
29  *to++ = *from++;
30  return;
31 }
#define ib2sect(ib)
Definition: lfilesys.h:86
int32 ibid32
ブロックIDのインデックス(ファイルシステムで使用する)
Definition: kernel.h:40
void lfibget(did32 diskdev, ibid32 inum, struct lfiblk *ibuff)
Definition: lfibget.c:10
全てのシステムヘッダファイルをインクルードする。
syscall read(did32, char *, uint32)
Definition: read.c:9
#define LF_BLKSIZ
Definition: lfilesys.h:48
int int32
符号あり32ビット整数(int)
Definition: kernel.h:11
int32 did32
デバイスID
Definition: kernel.h:28
#define ib2disp(ib)
Definition: lfilesys.h:91