File nut/fs/pnutfs.c

References Functions: PnutFileClose() nut/fs/pnutfs.c
  PnutFileOpen() nut/fs/pnutfs.c
  PnutFileRead() nut/fs/pnutfs.c
  PnutFileSize() nut/fs/pnutfs.c
  PnutFileWrite() nut/fs/pnutfs.c
  PnutFileWrite_P() nut/fs/pnutfs.c
  PnutIOCtl() nut/fs/pnutfs.c
  PnutInit() nut/fs/pnutfs.c

Included Files


Preprocessor definitions

#define PNUT_BLOCK_SIZE 512

#define PNUT_DIRENT_SIZE 32

#define PNUT_BLOCKS_PER_NODE 250

#define PNUTBANK_COUNT 30

#define SEEK_SET 0

#define SEEK_CUR 1

#define SEEK_END 2

#define NODETYPE_REG 0

#define NODETYPE_DIR 1

#define PNUT_MAX_NAMELEN

#define PNUT_MAX_FILESIZE

#define PNUT_TOTAL_BLOCKS

#define BLOCKS_PER_BANK

#define NUTBANK_PTR


Typedef PNUT_BLKNUM

typedef short PNUT_BLKNUM

Typedef PNUT_NODE

typedef struct {...} PNUT_NODE
struct  
   {  
      u_char node_type;  
      u_char node_refs;  
      u_short node_links;  
      u_long node_size;  
      time_t node_mtime;  
      PNUT_BLKNUM node_blocks[250];  
   }  

Typedef PNUT_DIRENTRY

typedef struct {...} PNUT_DIRENTRY
struct  
   {  
      PNUT_BLKNUM dir_node;  
      u_char dir_inuse;  
      char dir_name[(32-sizeof(PNUT_BLKNUM)-sizeof(u_char)-1)+1];  
   }  

Typedef PNUT_FINDRESULT

typedef struct {...} PNUT_FINDRESULT
struct  
   {  
      PNUT_BLKNUM fr_node;  
      PNUT_BLKNUM fr_pnode;  
      const char* fr_name;  
   }  

Typedef PNUTFILE

typedef struct _PNUTFILE PNUTFILE
See: Type struct _PNUTFILE

Type struct _PNUTFILE

struct _PNUTFILE
struct _PNUTFILE  
   {  
      PNUT_BLKNUM f_node;  
      u_long f_pos;  
      u_int f_flag;  
   }  

Global Variable devPnut

NUTDEVICE devPnut
Visible in:   nut/fs/pnutfs.c

Local Variables

root
static PNUT_BLKNUM root
Used in: PnutDelete()  
  PnutDirCreate()  
  PnutDirOpen()  
  PnutFileOpen()  
  PnutInit()  
  PnutStatus()  

blockFreeList
static PNUT_BLKNUM blockFreeList

Used in: PnutBlockAlloc()  
  PnutBlockRelease()  

Global Function BankNodePointer()

PNUT_NODE* BankNodePointer ( PNUT_BLKNUM blk )
Calls: BankSelect() nut/fs/pnutfs.c
Called by: PnutBlockAlloc() nut/fs/pnutfs.c
  PnutBlockRelease() nut/fs/pnutfs.c
  PnutDirAddEntry() nut/fs/pnutfs.c
  PnutDirClose() nut/fs/pnutfs.c
  PnutDirDelEntry() nut/fs/pnutfs.c
  PnutDirFindEntry() nut/fs/pnutfs.c
  PnutDirFindPath() nut/fs/pnutfs.c
  PnutDirIsEmpty() nut/fs/pnutfs.c
  PnutDirOpen() nut/fs/pnutfs.c
  PnutDirRead() nut/fs/pnutfs.c
  PnutFileClose() nut/fs/pnutfs.c
  PnutFileOpen() nut/fs/pnutfs.c
  PnutFileRead() nut/fs/pnutfs.c
  PnutFileSeek() nut/fs/pnutfs.c
  PnutFileSize() nut/fs/pnutfs.c
  PnutFileStatus() nut/fs/pnutfs.c
  PnutFileWrite() nut/fs/pnutfs.c
  PnutNodeAlloc() nut/fs/pnutfs.c
  PnutNodeDataRelease() nut/fs/pnutfs.c
  PnutNodeGetDataPtr() nut/fs/pnutfs.c
  PnutStatus() nut/fs/pnutfs.c

Global Function BankSelect()

void BankSelect ( PNUT_BLKNUM blk )
Called by: BankNodePointer() nut/fs/pnutfs.c

Global Function PnutIOCtl()

int PnutIOCtl ( NUTDEVICE* dev, int req, void* conf )
Calls: PnutDelete() nut/fs/pnutfs.c
  PnutDirClose() nut/fs/pnutfs.c
  PnutDirCreate() nut/fs/pnutfs.c
  PnutDirOpen() nut/fs/pnutfs.c
  PnutDirRead() nut/fs/pnutfs.c
  PnutFileSeek() nut/fs/pnutfs.c
  PnutFileStatus() nut/fs/pnutfs.c
  PnutStatus() nut/fs/pnutfs.c
Used in:   nut/fs/pnutfs.c

Local Function PnutBlockAlloc()

static PNUT_BLKNUM PnutBlockAlloc ( void )
Calls: BankNodePointer() nut/fs/pnutfs.c
  memset()
Called by: PnutNodeAlloc() nut/fs/pnutfs.c
  PnutNodeGetDataPtr() nut/fs/pnutfs.c
References Variables: blockFreeList nut/fs/pnutfs.c

Local Function PnutBlockRelease()

static void PnutBlockRelease ( PNUT_BLKNUM blk )
Calls: BankNodePointer() nut/fs/pnutfs.c
Called by: PnutFileOpen() nut/fs/pnutfs.c
  PnutInit() nut/fs/pnutfs.c
  PnutNodeDataRelease() nut/fs/pnutfs.c
  PnutNodeRelease() nut/fs/pnutfs.c
References Variables: blockFreeList nut/fs/pnutfs.c

Local Function PnutDelete()

static int PnutDelete ( char* path )
Calls: PnutDirDelEntry() nut/fs/pnutfs.c
  PnutDirFindPath() nut/fs/pnutfs.c
Called by: PnutIOCtl() nut/fs/pnutfs.c
References Variables: root nut/fs/pnutfs.c

Local Function PnutDirAddEntry()

static int PnutDirAddEntry ( PNUT_BLKNUM dnode, const char* name, PNUT_BLKNUM enode )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutNodeGetDataPtr() nut/fs/pnutfs.c
  strcpy(), time()
Called by: PnutDirCreate() nut/fs/pnutfs.c
  PnutFileOpen() nut/fs/pnutfs.c
  PnutInit() nut/fs/pnutfs.c

Local Function PnutDirClose()

static int PnutDirClose ( DIR* dir )
Calls: BankNodePointer() nut/fs/pnutfs.c
  free()
Called by: PnutIOCtl() nut/fs/pnutfs.c

Local Function PnutDirCreate()

static int PnutDirCreate ( const char* path )
Calls: PnutDirAddEntry() nut/fs/pnutfs.c
  PnutDirFindPath() nut/fs/pnutfs.c
  PnutNodeAlloc() nut/fs/pnutfs.c
  PnutNodeRelease() nut/fs/pnutfs.c
Called by: PnutIOCtl() nut/fs/pnutfs.c
References Variables: root nut/fs/pnutfs.c

Local Function PnutDirDelEntry()

static int PnutDirDelEntry ( PNUT_BLKNUM node, const char* name )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutDirFindEntry() nut/fs/pnutfs.c
  PnutDirIsEmpty() nut/fs/pnutfs.c
  PnutNodeRelease() nut/fs/pnutfs.c
  strlen()
Called by: PnutDelete() nut/fs/pnutfs.c

Local Function PnutDirFindEntry()

static int PnutDirFindEntry ( PNUT_BLKNUM node, const char* path, size_t len, PNUT_DIRENTRY** entry )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutNodeGetDataPtr() nut/fs/pnutfs.c
  strlen(), strncmp()
Called by: PnutDirDelEntry() nut/fs/pnutfs.c
  PnutDirFindPath() nut/fs/pnutfs.c

Local Function PnutDirFindPath()

static int PnutDirFindPath ( PNUT_BLKNUM node, const char* path, PNUT_FINDRESULT* result )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutDirFindEntry() nut/fs/pnutfs.c
Called by: PnutDelete() nut/fs/pnutfs.c
  PnutDirCreate() nut/fs/pnutfs.c
  PnutDirOpen() nut/fs/pnutfs.c
  PnutFileOpen() nut/fs/pnutfs.c
  PnutStatus() nut/fs/pnutfs.c

Local Function PnutDirIsEmpty()

static int PnutDirIsEmpty ( PNUT_BLKNUM node )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutNodeGetDataPtr() nut/fs/pnutfs.c
  strcmp()
Called by: PnutDirDelEntry() nut/fs/pnutfs.c

Local Function PnutDirOpen()

static int PnutDirOpen ( NUTDEVICE* dev, DIR* dir )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutDirFindPath() nut/fs/pnutfs.c
  free(), malloc(), memset()
Called by: PnutIOCtl() nut/fs/pnutfs.c
References Variables: root nut/fs/pnutfs.c

Local Function PnutDirRead()

static int PnutDirRead ( DIR* dir )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutNodeGetDataPtr() nut/fs/pnutfs.c
  memset(), strcpy(), strlen()
Called by: PnutIOCtl() nut/fs/pnutfs.c

Local Function PnutFileClose()

static int PnutFileClose ( NUTFILE* nfp )
Calls: BankNodePointer() nut/fs/pnutfs.c
  free()
Used in:   nut/fs/pnutfs.c

Local Function PnutFileOpen()

static NUTFILE* PnutFileOpen ( NUTDEVICE* dev, const char* path, int mode, int acc )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutBlockRelease() nut/fs/pnutfs.c
  PnutDirAddEntry() nut/fs/pnutfs.c
  PnutDirFindPath() nut/fs/pnutfs.c
  PnutNodeAlloc() nut/fs/pnutfs.c
  PnutNodeDataRelease() nut/fs/pnutfs.c
  free(), malloc()
Used in:   nut/fs/pnutfs.c
References Variables: root nut/fs/pnutfs.c

Local Function PnutFileRead()

static int PnutFileRead ( NUTFILE* nfp, void* buffer, int len )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutNodeGetDataPtr() nut/fs/pnutfs.c
  memcpy()
Used in:   nut/fs/pnutfs.c

Local Function PnutFileSeek()

static int PnutFileSeek ( PNUTFILE* fp, long* pos, int whence )
Calls: BankNodePointer() nut/fs/pnutfs.c
Called by: PnutIOCtl() nut/fs/pnutfs.c

Local Function PnutFileSize()

static long PnutFileSize ( NUTFILE* nfp )
Calls: BankNodePointer() nut/fs/pnutfs.c
Used in:   nut/fs/pnutfs.c

Local Function PnutFileStatus()

static int PnutFileStatus ( PNUTFILE* fp, struct stat* status )
Calls: BankNodePointer() nut/fs/pnutfs.c
Called by: PnutIOCtl() nut/fs/pnutfs.c

Local Function PnutFileWrite()

static int PnutFileWrite ( NUTFILE* nfp, const void* buffer, int len )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutNodeGetDataPtr() nut/fs/pnutfs.c
  memcpy(), time()
Used in:   nut/fs/pnutfs.c

Local Function PnutFileWrite_P()

static int PnutFileWrite_P ( NUTFILE* nfp, const prog_char* buffer, int len )
Used in:   nut/fs/pnutfs.c

Local Function PnutInit()

static int PnutInit ( NUTDEVICE* dev )
Calls: PnutBlockRelease() nut/fs/pnutfs.c
  PnutDirAddEntry() nut/fs/pnutfs.c
  PnutNodeAlloc() nut/fs/pnutfs.c
Used in:   nut/fs/pnutfs.c
References Variables: root nut/fs/pnutfs.c

Local Function PnutNodeAlloc()

static PNUT_BLKNUM PnutNodeAlloc ( u_char type )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutBlockAlloc() nut/fs/pnutfs.c
  time()
Called by: PnutDirCreate() nut/fs/pnutfs.c
  PnutFileOpen() nut/fs/pnutfs.c
  PnutInit() nut/fs/pnutfs.c

Local Function PnutNodeDataRelease()

static void PnutNodeDataRelease ( PNUT_BLKNUM node )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutBlockRelease() nut/fs/pnutfs.c
  time()
Called by: PnutFileOpen() nut/fs/pnutfs.c
  PnutNodeRelease() nut/fs/pnutfs.c

Local Function PnutNodeGetDataPtr()

static int PnutNodeGetDataPtr ( PNUT_BLKNUM node, u_long pos, void** buffer, size_t* size, int create )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutBlockAlloc() nut/fs/pnutfs.c
Called by: PnutDirAddEntry() nut/fs/pnutfs.c
  PnutDirFindEntry() nut/fs/pnutfs.c
  PnutDirIsEmpty() nut/fs/pnutfs.c
  PnutDirRead() nut/fs/pnutfs.c
  PnutFileRead() nut/fs/pnutfs.c
  PnutFileWrite() nut/fs/pnutfs.c

Local Function PnutNodeRelease()

static void PnutNodeRelease ( PNUT_BLKNUM node )
Calls: PnutBlockRelease() nut/fs/pnutfs.c
  PnutNodeDataRelease() nut/fs/pnutfs.c
Called by: PnutDirCreate() nut/fs/pnutfs.c
  PnutDirDelEntry() nut/fs/pnutfs.c

Local Function PnutStatus()

static int PnutStatus ( const char* path, struct stat* status )
Calls: BankNodePointer() nut/fs/pnutfs.c
  PnutDirFindPath() nut/fs/pnutfs.c
Called by: PnutIOCtl() nut/fs/pnutfs.c
References Variables: root nut/fs/pnutfs.c