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

Go to the source code of this file.

Functions

ibid32 lfiballoc (void)
 

Function Documentation

◆ lfiballoc()

ibid32 lfiballoc ( void  )

Definition at line 10 of file lfiballoc.c.

References FALSE, lfiblk::ib_next, LF_AREA_DIR, Lf_data, lfdata::lf_dir, lfdata::lf_dirdirty, lfdata::lf_dskdev, LF_INULL, lfdir::lfd_ifree, lfibget(), panic(), and write().

Referenced by lfsetup().

11 {
12  ibid32 ibnum; /* ID of next block on the free list */
13  struct lfiblk iblock; /* Buffer to hold an index block */
14 
15  /* Get ID of first index block on free list */
16 
17  ibnum = Lf_data.lf_dir.lfd_ifree;
18  if (ibnum == LF_INULL) { /* Ran out of free index blocks */
19  panic("out of index blocks");
20  }
21  lfibget(Lf_data.lf_dskdev, ibnum, &iblock);
22 
23  /* Unlink index block from the directory free list */
24 
25  Lf_data.lf_dir.lfd_ifree = iblock.ib_next;
26 
27  /* Write a copy of the directory to disk after the change */
28 
31 
32  return ibnum;
33 }
int32 ibid32
ブロックIDのインデックス(ファイルシステムで使用する)
Definition: kernel.h:40
struct lfdata Lf_data
Definition: lfsinit.c:5
ibid32 lfd_ifree
Definition: lfilesys.h:121
did32 lf_dskdev
Definition: lfilesys.h:131
void lfibget(did32, ibid32, struct lfiblk *)
Definition: lfibget.c:10
#define LF_INULL
Definition: lfilesys.h:55
#define LF_AREA_DIR
Definition: lfilesys.h:67
syscall write(did32, char *, uint32)
Definition: write.c:9
struct lfdir lf_dir
Definition: lfilesys.h:134
#define FALSE
Boolean False(0)
Definition: kernel.h:63
bool8 lf_dirdirty
Definition: lfilesys.h:137
void panic(char *)
Panic状態に陥った旨のメッセージを表示し、全てのプロセスを停止させる。
Definition: panic.c:12
Here is the call graph for this function:
Here is the caller graph for this function: