📄 fsinfo.h
字号:
/* *---------------------------------------------------------------------- * T-Kernel / Standard Extension * * Copyright (C) 2006 by Ken Sakamura. All rights reserved. * T-Kernel / Standard Extension is distributed * under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * * Version: 1.00.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* * fsinfo.h (file) * * File management * Common definition of the file system task (Individual section task) */#ifndef _FM_FSINFO_H_#define _FM_FSINFO_H_#include "filemgr.h"#include "ofcb.h"#include "rcb.h"/* * Connection of the open file information (OFCB) * In order to perform the retrieval in higher speed, divide OFCB based on ID * instead of making it a single link. The division is made based on the lower * 3 bit of the file ID, by which a link is selected. When the lower 3 bit * of the file ID is i, the queue to connect is QUEUE of ofcb[i]. */#define OFCB_QMSK 0x0007#define OFCB_QSZ (OFCB_QMSK + 1)/* * File system management information. */typedef struct FsInfo { QUEUE q; /* For connection of the file system management information. */ FastLock lock; /* For exclusive access */ ID tskid; /* File system task ID */ ID port; /* Rendezvous port ID */ /* File system connection information */ DevName devName; /* Device name */ ConName conName; /* Connection name */ UW conMode; /* Connection mode (mode of att_fls) */ /* Disk information */ ID dskid; /* Disk ID */ DiskInfo dskInfo; /* Disk information */ W pbadj; /* Correction value when computing the physical block number */ ER dskErr; /* For recording of asynchronous error */ /* File system information */ DskAdrS shead; /* Location of the system header */ DskAdrS usebm; /* Location of the use block bit map */ DskAdrS fidt; /* Location of the file ID table */ DskAdrS fsnt; /* Location of the file abbreviated name table */ signed int diskform:16; /* File system format */ unsigned int bigEndian:1; /* TRUE when it is big endian format. */ H acclv; /* Access management level */ UH nfmax; /* The maximum number of files */ W nbmp; /* Byte count of bit map */ W nlb; /* The total number of logical blocks */ UH sblk; /* Byte count of the logical block */ UH blkRatio; /* Divide the logical block size by physical block size */ FsName fsName; /* File system name */ /* Open file information */ QUEUE ofcb[OFCB_QSZ]; /* For connection of the open file information */ QUEUE wrkFilLst; /* List of the processes (FINFO) specified as the work file. */ /* Others */ QUEUE resumeReq; /* Queue for the request waiting for resumption of processing */ UB syncAtExit; /* Synchronization specification (SAE_xxx) when system call has finished. */} FsInfo;/* * Base pointer to access the file system management information. * The file system task must be reentrant to execute a same code as multiple tasks. * Therefore, the data shared in one file system task are all placed in FsInfo, * and the base pointer is used to access the information. * This base pointer is stored as extended information (exinf) of task. * * Although the base pointer is normally passed as an argument of each function, * it can be obtained directly by GetFsInfo(). */Inline FsInfo* GetFsInfo( ID tskid ){ T_RTSK rtsk; tk_ref_tsk(tskid, &rtsk); return (FsInfo*)rtsk.exinf;}/* * TRUE when the name is the same as the file system of fsinfo. */Inline BOOL isSameFS( TC *fsName, FsInfo *fsinfo ){ W cmp = tc_strncmp(fsName, fsinfo->fsName, FsNameLen); return ( cmp == 0 )? TRUE: FALSE;}/* * TRUE when the file system is not writable. */#define isNoWriteFS(fsinfo) ( ((fsinfo)->conMode & FS_RONLY) != 0 \ || (fsinfo)->dskInfo.protect )/* * Reserve/Cancel the synchronization of the file system when system call has finished. */#define SAE_FSTSK 1 /* Targets are ones that were mapped with MAP_FSTSK */#define SAE_OPENF 2 /* Targets are files being opened. */#define setSyncAtExit(flg, fsinfo) ( (fsinfo)->syncAtExit |= (flg) )#define cancelSyncAtExit(flg, fsinfo) ( (fsinfo)->syncAtExit &= ~(flg) )#define checkSyncAtExit(flg, fsinfo) ( ((fsinfo)->syncAtExit & (flg)) != 0 )#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -