Treespan File System API Reference Manual

Treespan File System API Reference Manual

!"#$ % '#((#()*!+,-.#)/$01234 TREEspan File System API Reference Manual RM0002 February 12, 2020 Copyright © 2017-2020 JBLopen Inc. All rights reserved. No part of this document and any associated software may be reproduced, distributed or transmitted in any form or by any means without the prior written consent of JBLopen Inc. Disclaimer While JBLopen Inc. has made every attempt to ensure the accuracy of the information contained in this publication, JBLopen Inc. cannot warrant the accuracy of completeness of such information. JBLopen Inc. may change, add or remove any content in this publication at any time without notice. All the information contained in this publication as well as any associated material, including software, scripts, and examples are provided “as is”. JBLopen Inc. makes no express or implied warranty of any kind, including warranty of merchantability, noninfringement of intellectual property, or fitness for a particular purpose. In no event shall JBLopen Inc. be held liable for any damage resulting from the use or inability to use the information contained therein or any other associated material. Trademark JBLopen, the JBLopen logo, TREEspanTM and BASEplatformTM are trademarks of JBLopen Inc. All other trademarks are trademarks or registered trademarks of their respective owners. Contents 1 Overview 1 1.1 About TREEspan File System .................................... 1 1.2 Elements of the API reference ................................... 1 1.2.1 Functions ........................................... 1 1.2.2 Data Types .......................................... 3 1.2.3 Macros ............................................. 4 1.3 Function Attributes .......................................... 5 1.3.1 Blocking ............................................ 5 1.3.2 ISR-Safe ............................................ 5 1.3.3 Critical Safe .......................................... 5 1.3.4 Thread-Safe .......................................... 6 1.3.5 Function Attributes in Header Files ............................ 6 1.4 API Conventions ........................................... 6 1.4.1 Naming ............................................ 6 1.4.2 Error Handling ........................................ 6 1.4.3 Numerical Values of Macros and Enumeration Constants ............... 7 2 API Reference 8 2.1 tsfs_commit .............................................. 8 2.2 tsfs_create ............................................... 8 2.3 tsfs_destroy .............................................. 9 2.4 tsfs_dir_close ............................................. 9 2.5 tsfs_dir_create ............................................. 10 2.6 tsfs_dir_delete ............................................. 10 2.7 tsfs_dir_exists ............................................. 11 2.8 tsfs_dir_open ............................................. 11 2.9 tsfs_dir_read .............................................. 12 2.10 tsfs_drop ................................................ 12 2.11 tsfs_file_append ............................................ 13 2.12 tsfs_file_close ............................................. 13 2.13 tsfs_file_create ............................................ 14 2.14 tsfs_file_delete ............................................ 14 2.15 tsfs_file_exists ............................................. 15 TREEspan File System API Reference Manual www.jblopen.com Contents ii !"#$2.16 tsfs_file_extent_min_sz_set ..................................... 16 % '#((#()*!+,-.#)/$012342.17 tsfs_file_mode_reset ......................................... 16 2.18 tsfs_file_mode_set .......................................... 16 2.19 tsfs_file_open ............................................. 17 2.20 tsfs_file_read ............................................. 17 2.21 tsfs_file_seek ............................................. 18 2.22 tsfs_file_size_get ........................................... 18 2.23 tsfs_file_truncate ........................................... 19 2.24 tsfs_file_write ............................................. 19 2.25 tsfs_format ............................................... 20 2.26 tsfs_media_get ............................................ 20 2.27 tsfs_mount ............................................... 21 2.28 tsfs_revert ............................................... 21 2.29 tsfs_sshot_create ........................................... 22 2.30 tsfs_sshot_delete ........................................... 22 2.31 tsfs_sshot_exists ........................................... 23 2.32 tsfs_trace_data_get .......................................... 23 2.33 tsfs_unmount ............................................. 24 2.34 tsfs_file_pos_offset_t ......................................... 24 2.35 tsfs_file_size_t ............................................. 24 2.36 tsfs_cfg_t ................................................ 24 2.37 tsfs_dir_hndl_t ............................................. 25 2.38 tsfs_file_hndl_t ............................................ 25 2.39 TSFS_FILE_MODE_RD_ONLY .................................... 25 2.40 TSFS_MAX_INSTANCE_NAME_LEN ................................ 25 2.41 TSFS_MAX_PATH_LEN ....................................... 25 2.42 RTNC_* ................................................. 26 2.43 TSFS_FILE_SEEK_* .......................................... 26 3 Document Revision History 27 TREEspan File System API Reference Manual www.jblopen.com Chapter 1 Overview Welcome to the TREEspanTM File System API reference manual. This reference manual covers the core, file and directory API functions, data types and preprocessor definitions along with a description and usage information for each API element. The API is written in ISO/IEC 9899:1999 (C99) compliant C and designed to be portable between platforms and toolchains. For convenience during development, all the information related to each individual API elements is also reproduced within the relevant header source files in human readable format. 1.1 About TREEspan File System TSFS is an embedded transactional file system, supporting a wide range of storage technologies, including native flash support with both dynamic and static wear-leveling. Through its support for snapshots and write transactions, TSFS provides the application with flexible, robust and fail-safe data storage. Being RTOS and platform agnostic, with a minimum RAM requirement of less than 4KiB, TSFS can be deployed on almost any platform. 1.2 Elements of the API reference Each documented API element, be it a function, data type or preprocessor definition is presented using a similar layout which is described below. This section briefly describes the various elements of the API reference. 1.2.1 Functions The most numerous and important API elements documented are functions. Below is an example of API reference for a hypothetical function named example_func(): Function example_func() <example/example.h> TREEspan File System API Reference Manual www.jblopen.com Chapter 1 Overview 2 !"#$Example function description. % '#((#()*!+,-.#)/$01234 Prototype int example_func ( uint32_t arg1, uint32_t arg2 ); Attributes Blocking ISR-safe Critical safe Thread-safe 7 3 3 3 Parameters arg1 First argument’s description. arg2 Second argument’s description. Returned RTNC_SUCCESS Errors RTNC_FATAL Example uint32_t a = 0u; uint32_t b = 1u; int result; result = example_func(a, b); if(result != RTNC_SUCCESS) { // Handle error. } Function Name At the top of each API is the name of the function or object as it appears in the source code. TSFS functions are always prefixed with tsfs_ followed by the function’s specific name. Header Following the name is the header file where the declaration of the documented API can be found. It is recommended to use the displayed path relative to the root of the TSFS source directory when including the TSFS headers. For example, to include the file module header file tsfs_file.h the following include directive is recommended. #include <tsfs_file.h> The root of the TSFS source directory should be added to the include path of the compiler. Description A description of the API element including basic usage information. TREEspan File System API Reference Manual www.jblopen.com Chapter 1 Overview 3 !"#$Prototype % '#((#()*!+,-.#)/$01234For functions, the full signature of the API along with parameter names, types, and function return type. Attributes For functions only, this section lists the relevant function attributes. See Section 1.3 for a detailed description of each attribute. Parameters Function parameters list along with a short description of each parameter. Returned Errors or Return Value For functions returning an error code, this section is named ”Returned Errors” and lists the relevant errors that can be returned. See Section 1.4.2 for more information on TSFS error handling. For other functions that do not return an error code, this section lists the possible output values of the function. In this case, the section is named ”Returned Value”. Example Some API functions may include a small code example to illustrate usage. Note that these examples are for documentation purposes and may not include error handling and checking to keep the examples concise. 1.2.2 Data Types Data types include structure definitions, enumerated types as well as scalar type definitions. They all follow a similar documentation layout, below is an example of API reference for a hypothetical structure definition named example_struct_t: Data Type example_struct_t

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    31 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us