Nut/OS  4.10.3
API Reference
pnutfs.c File Reference

Peanut File System. More...

#include <compiler.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <dirent.h>
#include <errno.h>
#include <memdebug.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/bankmem.h>
#include <fs/fs.h>
#include <dev/pnut.h>
Include dependency graph for pnutfs.c:

Go to the source code of this file.

Data Structures

struct  PNUT_NODE
 Node structure. More...
struct  PNUT_DIRENTRY
 Directory entry structure. More...
struct  PNUT_FINDRESULT
 Directory search result information structure. More...
struct  _PNUTFILE
 PNUT file descriptor structure. More...

Defines

#define SEEK_SET   0
#define SEEK_CUR   1
#define SEEK_END   2
#define NODETYPE_REG   0
#define NODETYPE_DIR   1
#define PNUT_MAX_NAMELEN   (PNUT_DIRENT_SIZE - sizeof(PNUT_BLKNUM) - sizeof(uint8_t) - 1)
 Maximum length of a base name.
#define PNUT_MAX_FILESIZE   (PNUT_BLOCKS_PER_NODE * PNUT_BLOCK_SIZE)
 Maximum size of a file or directory.
#define PNUT_TOTAL_BLOCKS   (PNUTBANK_COUNT * (NUTBANK_SIZE / PNUT_BLOCK_SIZE))
 Size of each memory bank.
#define BLOCKS_PER_BANK   (NUTBANK_SIZE / PNUT_BLOCK_SIZE)
#define NUTBANK_PTR   ((char *)NUTBANK_START)

Typedefs

typedef short PNUT_BLKNUM
typedef struct _PNUTFILE PNUTFILE
 PNUT file descriptor type.

Functions

void BankSelect (PNUT_BLKNUM blk)
 Make the bank visible, which contains the specified block.
PNUT_NODEBankNodePointer (PNUT_BLKNUM blk)
 Select specified bank and return pointer to block.
int PnutIOCtl (NUTDEVICE *dev, int req, void *conf)
 Device specific functions.

Variables

NUTDEVICE devPnut
 Peanut device information structure.

Peanut File System Configuration

The Nut/OS Configurator may be used to override the default values.

#define PNUT_BLOCK_SIZE   512
 Size of a filesystem block.
#define PNUT_DIRENT_SIZE   32
 Size of a directory entry.
#define PNUT_BLOCKS_PER_NODE   250
 Maximum number of blocks per node.
#define PNUTBANK_COUNT   30

Detailed Description

Peanut File System.

 *
 * $Log$
 * Revision 1.16  2009/02/13 14:52:05  haraldkipp
 * Include memdebug.h for heap management debugging support.
 *
 * Revision 1.15  2009/01/17 11:26:46  haraldkipp
 * Getting rid of two remaining BSD types in favor of stdint.
 * Replaced 'u_int' by 'unsinged int' and 'uptr_t' by 'uintptr_t'.
 *
 * Revision 1.14  2008/08/27 06:45:23  thornen
 * Added bank support for MMnet03..04 MMnet102..104
 *
 * Revision 1.13  2008/08/26 17:36:45  haraldkipp
 * Revoked changes 2008/08/26 by thornen.
 *
 * Revision 1.11  2008/08/11 06:59:42  haraldkipp
 * BSD types replaced by stdint types (feature request #1282721).
 *
 * Revision 1.10  2006/08/01 07:43:48  haraldkipp
 * PNUT file system failed after some modifications done previously for the
 * PHAT file system. During directory open, the NUTFILE structure must be
 * allocated in the file system driver. PnutDirRead() must return -1 if the
 * end of a directory is reached. Reading unused directory entries must update
 * the file position pointer.
 *
 * Revision 1.9  2006/03/02 20:01:17  haraldkipp
 * Added implementation of dev_size makes _filelength() work, which in turn
 * enables the use of this file system in pro/httpd.c.
 *
 * Revision 1.8  2006/01/05 16:45:20  haraldkipp
 * Dynamic NUTFILE allocation for detached block device.
 *
 * Revision 1.7  2005/09/08 10:12:44  olereinhardt
 * Added #ifdef statement in NutSegBufEnable to avoid compiler warning
 * if no banked mem is used.
 *
 * Revision 1.6  2005/09/07 16:23:41  christianwelzel
 * Added support for MMnet02. Bankswitching is now handled in bankmem.h
 *
 * Revision 1.5  2005/08/02 17:46:47  haraldkipp
 * Major API documentation update.
 *
 * Revision 1.4  2005/05/16 08:33:59  haraldkipp
 * Added banking support for Arthernet.
 *
 * Revision 1.3  2005/02/21 11:10:21  olereinhardt
 * Changed deckaration of the "root" variable to compile with unix emulation
 *
 * Revision 1.2  2005/02/07 18:57:47  haraldkipp
 * ICCAVR compile errors fixed
 *
 * Revision 1.1  2005/02/05 20:35:21  haraldkipp
 * Peanut added
 *
 * 

Definition in file pnutfs.c.