Small Logger File System

Similar documents
Intel Stress Bitstreams and Encoder (Intel SBE) 2017 AVS2 Release Notes (Version 2.3)

Watch 4 Size v1.0 User Guide By LeeLu Soft 2013

Data Deduplication Metadata Extension

Hyperscaler Storage. September 12, 2016

Open Source Used In TSP

HALCoGen TMS570LS31x Help: example_sci_uart_9600.c

Pulse Check User Guide and Technical Guide. Quick Start Framework. Version Name: Winter 16 Version Number: 1.5 Date:

SNP Launchpad. Version: December SNP Schneider-Neureither & Partner AG

Performance Characterization of ONTAP Cloud in Azure with Application Workloads

Replacing drives for SolidFire storage nodes

Open Source Used In c1101 and c1109 Cisco IOS XE Fuji

FOR TCG ACPI Specification

US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

APPLICATION NOTE. Atmel AT03261: SAM D20 System Interrupt Driver (SYSTEM INTERRUPT) SAM D20 System Interrupt Driver (SYSTEM INTERRUPT)

V ( Copyright 2004 Yuri Tiomkin

Packet Trace Guide. Packet Trace Guide. Technical Note

Ecma International Policy on Submission, Inclusion and Licensing of Software

Package fst. December 18, 2017

Ecma International Policy on Submission, Inclusion and Licensing of Software

Performance Characterization of ONTAP Cloud in Amazon Web Services with Application Workloads

IETF TRUST. Legal Provisions Relating to IETF Documents. Approved November 6, Effective Date: November 10, 2008

FW Update Tool. Installation Guide. Software Version 2.2

calio / form-input-nginx-module

Installing AudioLinux (Alternative way with GUI)

Migrating Performance Data to NetApp OnCommand Unified Manager 7.2

Copyright PFU LIMITED

NetApp SolidFire Element OS. Setup Guide. Version March _A0

IETF TRUST. Legal Provisions Relating to IETF Documents. February 12, Effective Date: February 15, 2009

Open Source Used In Cisco Configuration Professional for Catalyst 1.0

Package fst. June 7, 2018

Table of Contents Overview...2 Selecting Post-Processing: ColorMap...3 Overview of Options Copyright, license, warranty/disclaimer...

Graphic Inspector 2 User Guide

KEMP Driver for Red Hat OpenStack. KEMP LBaaS Red Hat OpenStack Driver. Installation Guide

ANZ TRANSACTIVE MOBILE for ipad

PRODUCT SPECIFIC LICENSE TERMS Sybase Enterprise Portal Version 5 Application Edition ( Program )

User Manual. Date Aug 30, Enertrax DAS Download Client

NTLM NTLM. Feature Description

LGR Toolset (beta) User Guide. IDN Program 24 October 2017

StorageGRID Webscale NAS Bridge Management API Guide

VMware vcenter Log Insight Manager. Deployment Guide

iwrite technical manual iwrite authors and contributors Revision: 0.00 (Draft/WIP)

Control4/HomeKit Appliance User Manual. User Manual. June Version Varietas Software, LLC.

Using LPC11Axx EEPROM (with IAP)

cs50.c /**************************************************************************** * CS50 Library 6 *

AT10942: SAM Configurable Custom Logic (CCL) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

Migration Tool. Migration Tool (Beta) Technical Note

Open Source and Standards: A Proposal for Collaboration

PRODUCT SPECIFIC LICENSE TERMS Sybase Enterprise Portal Version 5 Enterprise Edition ( Program )

Hyper-V - Windows 2012 and 8. Virtual LoadMaster for Microsoft Hyper-V on Windows Server 2012, 2012 R2 and Windows 8. Installation Guide

AT03262: SAM D/R/L/C System Pin Multiplexer (SYSTEM PINMUX) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

ColdFusion Builder 3.2 Third Party Software Notices and/or Additional Terms and Conditions

SAM4 Reset Controller (RSTC)

An Easy Way to Split a SAS Data Set into Unique and Non-Unique Row Subsets Thomas E. Billings, MUFG Union Bank, N.A., San Francisco, California

AVR42789: Writing to Flash on the New tinyavr Platform Using Assembly

GoldSim License Portal A User s Guide for Managing Your GoldSim Licenses

2 Unifying receiver (DJ) Software Interface

AT11512: SAM L Brown Out Detector (BOD) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

ProgressBar Abstract

Copyright PFU LIMITED 2016

Management Software Web Browser User s Guide

Raspberry Pi shield board

This file includes important notes on this product and also the additional information not included in the manuals.

RSA Two Factor Authentication

Simba Cassandra ODBC Driver with SQL Connector

MUMPS IO Documentation

Splunk. Splunk. Deployment Guide

Fujitsu ScandAll PRO V2.1.5 README

Adobe Connect. Adobe Connect. Deployment Guide

D3.5 Mockups of the CROWD4ROADS mobile app

Avaya VPN Client Software Release 10.05_100

pyserial-asyncio Documentation

modpoll is a command line based Modbus master simulator and test utility. It is free software.

Anybus Wireless Bridge Ethernet Bluetooth Access Point Product Guide

MagicInfo Express Content Creator

Epic. Epic Systems. Deployment Guide

TWAIN driver User s Guide

Clean File Metadata Exchange Overview

Preface. Audience. Cisco IOS Software Documentation. Organization


This file includes important notes on this product and also the additional information not included in the manuals.

Static analysis for quality mobile applications

User Guide. Calibrated Software, Inc.

DHIS 2 Android User Manual 2.22

PageScope Box Operator Ver. 3.2 User s Guide

RF Scientific GPIB logger v1.0 User's manual v.1 (C) RF Scientific

User Manual for Video Codec

T-Invoicer User Guide

PyWin32ctypes Documentation

How to use the NTAG I²C plus for bidirectional communication. Rev June

Moodle. Moodle. Deployment Guide

LGR Toolset (beta) User Guide. IDN Program October 2016

Native route discovery algorithm

Tenable Hardware Appliance Upgrade Guide

LoadMaster VMware Horizon (with View) 6. Deployment Guide

Nokia Intellisync Mobile Suite Client Guide. S60 Platform, 3rd Edition

FlexArray Virtualization Implementation Guide for NetApp E-Series Storage

OnCommand Unified Manager 7.2: Best Practices Guide

Definiens. Image Miner bit and 64-bit Edition. Release Notes

HYDRODESKTOP VERSION 1.4 QUICK START GUIDE

FlexArray Virtualization

Transcription:

Small Logger File System (http://www.tnkernel.com/) Copyright 2011 Yuri Tiomkin

Document Disclaimer The information in this document is subject to change without notice. While the information herein is assumed to be accurate, Yuri Tiomkin (the author) assumes no responsibility for any errors or omissions. The author makes and you receive no warranties or conditions, express, implied, statutory or in any communications with you. The author specifically disclaims any implied warranty of merchantability or fitness for a particular purpose. Copyright notice Small Logger File System Copyright 2011 Yuri Tiomkin All rights reserved. Permission to use, copy, modify, and distribute this software in source and binary forms and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. THIS SOFTWARE IS PROVIDED BY THE YURI TIOMKIN AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL YURI TIOMKIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Trademarks Names mentioned in this manual may be trademarks of their respective companies. Brand and product names are trademarks or registered trademarks of their respective holders. Document Version: - 1.0 2

INTRODUCTION The SLFS (Small Logger File System) is a logger file system, implemented on the serial flash with unified sector size (4 KB). The logger file system uses the FIFO approach - for writing the file is added to the tail of the internal list while for reading the file is taken from the head of the list. In most cases, after reading, the file is erased from SLFS and disk space is released. If SLFS disk is full and new file is added, the oldest file(s) will be automatically erased. Files in SLFS may have an arbitrary length. SLFS uses the write-ahead journaling for file creating/deleting and wear leveling for the system metadata. SLFS RAM usage The SLFS uses global structure DF_FLI (52 bytes), structure DF_DISKINFO (328 bytes) per each disk and the one global buffer with the size of the flash sector (4096 bytes). SLFS multi-access The SLFS was designed for the small embedded systems with limited RAM capacity. In SLFS, the only one file at time may be open - if the file is open for reading or was created for writing, no more files can be open/created until file will be closed. SLFS Wear leveling The SLFS has a reserved area N * log (metadata) data size, where N is defined by user. The SLFS write capacity counter is set to the maximal erasing number value. After each file closing, the counter is decremented. When the capacity counter reaches the zero value, the log (metadata) is relocated to the next position in the reserved area and the capacity counter is set to the maximal erasing number value again. When there is no more free space available in the reserved area for the metadata relocation, the SLFS is set as read-only. SLFS API usage The flash formatting For the flash formatting, the function df_create_mbr() is used. Then, one or more SLFS disks may be created by the function slfs_create_disk(). 3

The SLFS initialization After the system restart, the file system(s) should be initiated by the function df_init_disks(). File writing File is created for the writing by function slfs_file_create(). The writing is performed by function slfs_file_write(). After finishing writing to the file, the file must be close by the function slfs_file_close(). File reading File is open for the reading by function slfs_file_open(). The reading is performed by function slfs_file_read(). After finishing reading from the file, the file must be close by the function slfs_file_close() or slfs_file_close_not_erase(). Files enumeration To get actual number of the files in the SLFS, the function slfs_get_files_number() should be used. To enumerate all files, the functions slfs_enum_files_first()/slfs_enum_files_next() are used. 4

SLFS API FUNCTIONS df_create_mbr Create MBR (Master Boot Record) int df_create_mbr (DF_FLI * fli, char * name ) fli name pointer to the global flash descriptor structure The flash IC name (for example "M25PX64", "MX25L12875" etc.) The name should be zero-terminated. Max name size 16 bytes, including terminator(0) Operation completed successfully This function clears overall flash IC content and prepares the flash for the creating disks with file systems (the two copies of Master Boot Record is created). Before the function call, the 'fli' structure fields should contain the information about the flash IC (see an example how to fill the structure fields) 5

df_create_mbr_disk_entry Create disk in MBR (Master Boot Record) int df_create_mbr_disk_entry(df_fli * fli, int32 size_in_sectors, unsigned int32 fs_type); fli size_in_sectors fs_type pointer to the global flash descriptor structure the desired space size in sectors (not bytes) - for SLFS file system it should be FS_TYPE_SLFS - to reserve space at the FLASH it should be 0 Operation completed successfully This function is used to allocate space in flash IC for the file system or to reserve space in the FLASH. The sequential call of this function will create the reserved areas (logical disks) at flash. Maximum number of disks is DF_MAX_DISKS (4). Each logical disk ('A', 'B', 'C', 'D') may be used for SLFS file system, any other file systems /raw data or just for the reserving. The desired disk space size in sectors will be automatically updated to fit to the flash size. 6

df_init_disks Initiate file systems at flash (after reset) int df_init_disks(df_fli * fli) fli pointer to the global flash descriptor structure Operation completed successfully After the system restart, the file system(s) should be initiated by the function call. Before the call, the structure 'fli' have to be filled (see the function init_fli() in an example). 7

slfs_create_disk Create SLFS disk at the flash int slfs_create_disk(df_fli * fli, int disk_letter) fli disk_letter pointer to the global flash descriptor structure SLFS disk name. May be 'A','B','C' or 'D' Operation completed successfully This function creates the SLFS file system at the 'disk_letter' logical disk 8

slfs_file_create Create file for the writing int slfs_file_create(df_fli * fli, SLFS_FILE * hfile, int disk_letter, unsigned char * file_name, int32 file_size, unsigned long file_attr) fli hfile disk_letter file_name file_size file_attr pointer to the global flash descriptor structure The pointer to the file handler structure. The structure should be allocated before the function call and it will be filled inside the function's operating progress. The SLFS disk name. May be 'A','B','C' or 'D' Filename (zero-terminated). Max size - 16 bytes, including terminator (0). It is used just for the user convenience and it is not used inside SLFS for the file storage. Filenames may be duplicated. Total expected file size. It should be defined at the file creation. Attribute of file (32-bit unsigned). It is used just for the user convenience and it is not used inside SLFS for the file storage. File attributes may be duplicated. Operation completed successfully This function creates the file for writing only. File will append to the end of internal SLFS files list (FIFO). To open file for the reading, the slfs_file_open() function should be used. The total expected file size ('file_size' parameter) is defined at the file creation. The writing data to the file is only sequential (see below). If overall writing data size will be greater than 'file_size', the overflow bytes will be cut. If overall writing data size will be less than 'file_size', it will be set as error. After writing all bytes to the file, it must be close with the function slfs_file_close(). 9

slfs_file_write Write a data to the file int slfs_file_write( SLFS_FILE * hfile, unsigned char * buf, int32 count) hfile The pointer to the file handler structure. The structure should be allocated before the function call and it and initialized by the calling slfs_file_create() function. buf Buffer with data to write. The typical buffer size is DF_PAGE_SIZE (256 bytes) count Number bytes to write. The 'count' should be equal DF_PAGE_SIZE (256 bytes); If 'count' value is less than DF_PAGE_SIZE, it will be set as last bytes in the file and the further writing will be restricted Greater than or equal to zero Less than zero Number of bytes actually has been write The function provides the data writing to the SLFS file. The writing is only sequential - the lseek operation is not supported. If overall data size will be greater than 'file_size' (see slfs_file_create()), the overflow bytes will be cut. If overall data size will be less than 'file_size' (see slfs_file_create()), it will be interpreted as error. 10

slfs_file_open Open file for the reading int slfs_file_open(df_fli * fli, SLFS_FILE * hfile, int disk_letter, fli hfile disk_letter pointer to the global flash descriptor structure The pointer to the file handler structure. The structure should be allocated before the function call and it will be initialized inside the function's operating progress. The SLFS disk name. May be 'A','B','C' or 'D' Operation completed successfully The function opens the first file in the internal SLFS files list (FIFO) for the reading purpose only. To open file for the writing, the slfs_file_create() function should be used. The reading is only sequential (see below). After the reading all bytes from the file, it should be close with function slfs_file_close() or slfs_file_close_not_erase(). If function slfs_file_close() is used to close file after reading, the file will be automatically removed from SLFS. The next file will be placed at the head of the internal files list (FIFO), and, accordingly, will be open at next call of the slfs_file_open() function. If function slfs_file_close_not_erase() is used to close file after the reading, the file will not be removed - at the next call of the slfs_file_open() the same file will be open. In any case, one of the functions (slfs_file_close() or slfs_file_close_not_erase()) must be invoked to finish the reading operation. 11

slfs_file_read Read a data from the file int slfs_file_read( SLFS_FILE * hfile, unsigned char * buf, int32 count) hfile The pointer to the file handler structure. The structure should be allocated before the function call and initiated by the calling slfs_file_open() function. buf Buffer for the data to read. The typical buffer size is DF_PAGE_SIZE (256 bytes) count Number bytes to read. The 'count' should be equal DF_PAGE_SIZE (256 bytes); If 'count' value is less than DF_PAGE_SIZE, it will be set as last bytes to read. Greater than or equal to zero Less than zero Number of bytes actually has been read This function provides the reading data from the SLFS file. The reading is only sequential - the lseek operation is not supported. The total file length is available in the field hfile->fheader.file_len after file opening (with slfs_file_open() function. 12

slfs_file_close Close file after reading or writing int slfs_file_close(slfs_file * hfile) hfile The pointer to the file handler structure Operation completed successfully This function may be invoked after reading all bytes from the file at the reading operation and must be invoked after writing all bytes to the file at the writing operation. For the reading operation only, the file will be automatically removed from SLFS and from the head of the internal SLFS files list (FIFO). The next file will be placed at the head of the internal files list (FIFO), and, accordingly, will be open at next call of the slfs_file_open() function. 13

slfs_file_close_not_erase Close file after reading without erasing int slfs_file_close_not_erase(slfs_file * hfile) hfile The pointer to the file handler structure Operation completed successfully This function may be invoked for the file closing after reading all bytes from the file (the reading operation only). The file 'hfile' will not be removed from the internal SLFS files list (FIFO) - at the next call of the slfs_file_open() function the same file will be open. 14

slfs_enum_files_first Start file enumeration int slfs_enum_files_first(df_fli * fli, SLFS_FILEFIND * hfilefind, int disk_letter) Fli hfilefind disk_letter Pointer to the global flash IC descriptor structure Pointer to the file search information handler structure. The structure should be allocated before the function call and it will be filled inside the function's operating progress. The SLFS disk name. May be 'A','B','C' or 'D' ERR_FILE_NOT_FOUND The file was found and 'hfilefind' structure contains the file information (if SLFS contains at least one file) There are no files in SLFS This function is used to start file enumeration procedure in the SLFS file system. If function returns, the 'hfilefind' structure contains the first found file information. 15

slfs_enum_files_next Continue file enumeration int slfs_enum_files_next(slfs_filefind * hfilefind) hfilefind Pointer to the file search information handler structure. ERR_LAST_PAGE The file was found and 'hfilefind' structure contains the file information File not found (there are no more files to enumerate) This function is used to continue file enumeration process. If the function returns, the 'hfilefind' structure contains the enumerated file information. To provide the SLFS files enumeration, the function slfs_enum_files_first() should be invoked first. Then, if slfs_enum_files_first() function returns, the function slfs_enum_files_next() should be called in the loop while it will return. For more details, see an example. 16

slfs_get_files_number Get the actual file number int slfs_get_files_number(df_fli * fli, int disk_letter) fli disk_letter pointer to the global flash descriptor structure The SLFS disk name. May be 'A','B','C' or 'D' Greater than or equal to zero Less than zero Actual number of files in the SLFS disk The function returns actual number of files in SLFS disk or error code. It uses slfs_enum_files_first() / slfs_enum_files_next() functions internally. 17