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

Go to the source code of this file.

Functions

status lfibput (did32 diskdev, ibid32 inum, struct lfiblk *ibuff)
 

Function Documentation

◆ lfibput()

status lfibput ( did32  diskdev,
ibid32  inum,
struct lfiblk ibuff 
)

Definition at line 10 of file lfibput.c.

References ib2disp, ib2sect, LF_BLKSIZ, OK, read(), SYSERR, and write().

Referenced by lfflush(), lfscreate(), lfsetup(), and lftruncate().

15 {
16  dbid32 diskblock; /* ID of disk sector (block) */
17  char *from, *to; /* Pointers used in copying */
18  int32 i; /* Loop index used during copy */
19  char dbuff[LF_BLKSIZ]; /* Temp. buffer to hold d-block */
20 
21  /* Compute disk block number and offset of index block */
22 
23  diskblock = ib2sect(inum);
24  to = dbuff + ib2disp(inum);
25  from = (char *)ibuff;
26 
27  /* Read disk block */
28 
29  if (read(diskdev, dbuff, diskblock) == SYSERR) {
30  return SYSERR;
31  }
32 
33  /* Copy index block into place */
34 
35  for (i=0 ; i<sizeof(struct lfiblk) ; i++) {
36  *to++ = *from++;
37  }
38 
39  /* Write the block back to disk */
40 
41  write(diskdev, dbuff, diskblock);
42  return OK;
43 }
#define ib2sect(ib)
Definition: lfilesys.h:86
int32 dbid32
データブロックID(ファイルシステムで使用する)
Definition: kernel.h:42
#define SYSERR
処理が失敗した場合
Definition: kernel.h:79
syscall read(did32, char *, uint32)
Definition: read.c:9
#define OK
処理が成功した場合
Definition: kernel.h:77
syscall write(did32, char *, uint32)
Definition: write.c:9
#define LF_BLKSIZ
Definition: lfilesys.h:48
int int32
符号あり32ビット整数(int)
Definition: kernel.h:11
#define ib2disp(ib)
Definition: lfilesys.h:91
Here is the call graph for this function:
Here is the caller graph for this function: