Included Files
- #include <nut/include/compiler.h>
- #include </usr/avr/include/string.h>
- #include <nut/include/time.h>
- #include <nut/include/fcntl.h>
- #include <nut/include/dirent.h>
- #include <nut/include/errno.h>
- #include <nut/include/sys/stat.h>
- #include <nut/include/sys/bankmem.h>
- #include <nut/include/fs/fs.h>
- #include <nut/include/dev/pnut.h>
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 short PNUT_BLKNUM
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 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 struct {...} PNUT_FINDRESULT
struct
|
|
{
|
|
PNUT_BLKNUM fr_node;
|
|
PNUT_BLKNUM fr_pnode;
|
|
const char* fr_name;
|
|
}
|
|
typedef struct _PNUTFILE PNUTFILE
struct _PNUTFILE
struct _PNUTFILE
|
|
{
|
|
PNUT_BLKNUM f_node;
|
|
u_long f_pos;
|
|
u_int f_flag;
|
|
}
|
|
NUTDEVICE devPnut
Local Variables
root
static PNUT_BLKNUM root
blockFreeList
static PNUT_BLKNUM blockFreeList
PNUT_NODE* BankNodePointer ( PNUT_BLKNUM blk )
void BankSelect ( PNUT_BLKNUM blk )
int PnutIOCtl ( NUTDEVICE* dev, int req, void* conf )
static PNUT_BLKNUM PnutBlockAlloc ( void )
static void PnutBlockRelease ( PNUT_BLKNUM blk )
static int PnutDelete ( char* path )
static int PnutDirAddEntry ( PNUT_BLKNUM dnode, const char* name, PNUT_BLKNUM enode )
static int PnutDirClose ( DIR* dir )
static int PnutDirCreate ( const char* path )
static int PnutDirDelEntry ( PNUT_BLKNUM node, const char* name )
static int PnutDirFindEntry ( PNUT_BLKNUM node, const char* path, size_t len, PNUT_DIRENTRY** entry )
static int PnutDirFindPath ( PNUT_BLKNUM node, const char* path, PNUT_FINDRESULT* result )
static int PnutDirIsEmpty ( PNUT_BLKNUM node )
static int PnutDirOpen ( NUTDEVICE* dev, DIR* dir )
static int PnutDirRead ( DIR* dir )
static int PnutFileClose ( NUTFILE* nfp )
static NUTFILE* PnutFileOpen ( NUTDEVICE* dev, const char* path, int mode, int acc )
static int PnutFileRead ( NUTFILE* nfp, void* buffer, int len )
static int PnutFileSeek ( PNUTFILE* fp, long* pos, int whence )
static long PnutFileSize ( NUTFILE* nfp )
static int PnutFileStatus ( PNUTFILE* fp, struct stat* status )
static int PnutFileWrite ( NUTFILE* nfp, const void* buffer, int len )
static int PnutFileWrite_P ( NUTFILE* nfp, const prog_char* buffer, int len )
static int PnutInit ( NUTDEVICE* dev )
static PNUT_BLKNUM PnutNodeAlloc ( u_char type )
static void PnutNodeDataRelease ( PNUT_BLKNUM node )
static int PnutNodeGetDataPtr ( PNUT_BLKNUM node, u_long pos, void** buffer, size_t* size, int create )
static void PnutNodeRelease ( PNUT_BLKNUM node )
static int PnutStatus ( const char* path, struct stat* status )