SMFS Reference

SMFS is a Secure Memory File System (as exported to FMs). It allows FMs to store keys in tamper protected battery backed non-volatile RAM (NVRAM).

It has the following general specifications:

>Arbitrary depth directory structure supported

>File names are any character other than '\0' or '/'

>Path separator is '/'. The Windows \ is not allowed

>Files are fixed size and initialized with zeros when created

>Directories will expand in size as needed to fit more files

This chapter contains the following sections:

>Important Constants

>Error Codes

>File Attributes Structure (SmFsAttr)

>Function Descriptions

Important Constants

>Maximum file name length is 16

>Maximum path length is 100

>Maximum number of open files is 32

>Maximum number of file search handles is 16

Error Codes

SMFS_ERR_ERROR A general error has occurred
SMFS_ERR_NOT_INITED The SMFS has not been initialized
SMFS_ERR_MEMORY The SMFS has run out of memory
SMFS_ERR_NAME_TOO_LONG The name given for a file is too long
SMFS_ERR_RESOURCES The SMFS has run out of resources
SMFS_ERR_PARAMETER An invalid parameter was passed to SMFS
SMFS_ERR_ACCESS User does not have request access to file
SMFS_ERR_NOT_FOUND Requested file was not found
SMFS_ERR_BUSY Operation is being attempted on an open file
SMFS_ERR_EXIST A file being created already exists
SMFS_ERR_FILE_TYPE Operation being performed on wrong file type

File Attributes Structure (SmFsAttr)

Synopsis
SmFsAttr {
unsigned int Size;  
unsigned int isDir;
   };
Description

This structure holds the file or directory attributes

Members
Size Current file size in bytes or directory size in entries.
isDir Flag specifying if file is a directory.

Function Descriptions

The SMFS reference section contains the following functions:

>SmFsCreateDir

>SmFsCloseFile

>SmFsCalcFree

>SmFsCreateFile

>SmFsCreateFileClr

>SmFsDeleteFile

>SmFsFindFile

>SmFsFindFileClose

>SmFsFindFileInit

>SmFsGetFileAttr

>SmFsOpenFile

>SmFsReadFile

>SmFsRenameFile

>SmFsWriteFile