Home >

FM SDK Programming Guide > SMFS Reference

  
SMFS Reference

SMFS is a Secure Memory File System (as exported to FMs).

It allows FMs to store keys into tamper-protected battery-backed Static RAM (SRAM)

It has the following general specifications:

Arbitrary depth directory structure supported.

File names are any character other than '\' or '/'.

Path separator is '/' (the Windows '\' is not allowed)

Files are of 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

Max file name length is 16

Max path length is 100

Max number of open files is 32

Max number of file search handles is 16

Error Codes

SMFS_ERR_ERROR

1 A general error has occurred

SMFS_ERR_NOT_INITED

2

The SMFS has not been initialized

SMFS_ERR_MEMORY

3

The SMFS has run out of memory

SMFS_ERR_NAME_TOO_LONG

4

The name given for a file is too long

SMFS_ERR_RESOURCES

5

The SMFS has run out of resources

SMFS_ERR_PARAMETER

6

An invalid parameter was passed to SMFS

SMFS_ERR_ACCESS

7

User does not have request access to file

SMFS_ERR_NOT_FOUND

8

Requested file was not found

SMFS_ERR_BUSY

9

Operation is being attempted on an open file

SMFS_ERR_EXIST

10

A file being created already exists

SMFS_ERR_FILE_TYPE

11

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

This section contains descriptions of the following functions:

SmFsCreateDir

SmFsCloseFile

SmFsCalcFree

SmFsCreateFile

SmFsDeleteFile

SmFsFindFile

SmFsFindFileClose

SmFsFindFileInit

SmFsGetFileAttr

SmFsGetOpenFileAttr

SmFsOpenFile

SmFsReadFile

SmFsRenameFile

SmFsWriteFile