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

Go to the source code of this file.

Functions

status lfflush (struct lflcblk *lfptr)
 

Function Documentation

◆ lfflush()

status lfflush ( struct lflcblk lfptr)

Definition at line 10 of file lfflush.c.

References FALSE, LF_AREA_DIR, Lf_data, lfdata::lf_dir, lfdata::lf_dirdirty, lfdata::lf_dskdev, LF_FREE, lflcblk::lfdbdirty, lflcblk::lfdblock, lflcblk::lfdnum, lflcblk::lfibdirty, lflcblk::lfiblock, lfibput(), lflcblk::lfinum, lflcblk::lfstate, OK, SYSERR, and write().

Referenced by lflclose(), lfsetup(), and lftruncate().

13 {
14 
15  if (lfptr->lfstate == LF_FREE) {
16  return SYSERR;
17  }
18 
19  /* Write the directory if it has changed */
20 
21  if (Lf_data.lf_dirdirty) {
23  LF_AREA_DIR);
25  }
26 
27  /* Write data block if it has changed */
28 
29  if (lfptr->lfdbdirty) {
30  write(Lf_data.lf_dskdev, lfptr->lfdblock, lfptr->lfdnum);
31  lfptr->lfdbdirty = FALSE;
32  }
33 
34  /* Write i-block if it has changed */
35 
36  if (lfptr->lfibdirty) {
37  lfibput(Lf_data.lf_dskdev, lfptr->lfinum, &lfptr->lfiblock);
38  lfptr->lfibdirty = FALSE;
39  }
40 
41  return OK;
42 }
#define SYSERR
処理が失敗した場合
Definition: kernel.h:79
struct lfdata Lf_data
Definition: lfsinit.c:5
did32 lf_dskdev
Definition: lfilesys.h:131
#define OK
処理が成功した場合
Definition: kernel.h:77
struct lfiblk lfiblock
Definition: lfilesys.h:155
#define LF_AREA_DIR
Definition: lfilesys.h:67
ibid32 lfinum
Definition: lfilesys.h:153
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
byte lfstate
Definition: lfilesys.h:144
dbid32 lfdnum
Definition: lfilesys.h:157
bool8 lfdbdirty
Definition: lfilesys.h:166
bool8 lf_dirdirty
Definition: lfilesys.h:137
#define LF_FREE
Definition: lfilesys.h:52
bool8 lfibdirty
Definition: lfilesys.h:165
char lfdblock[LF_BLKSIZ]
Definition: lfilesys.h:159
status lfibput(did32, ibid32, struct lfiblk *)
Definition: lfibput.c:10
Here is the call graph for this function:
Here is the caller graph for this function: