![Texas Instruments CC3220 Скачать руководство пользователя страница 120](http://html.mh-extra.com/html/texas-instruments/cc3220/cc3220_programmers-manual_1094609120.webp)
Rename a File
120
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
File System
On successful delete, the file allocation storage on the SFLASH is removed, and can be used by other
files. For secure files, the delete requires the file master token.
TI recommends reducing the delete file operations to the minimum, because it involves updating the
allocation table.
The following is a partial list of errors that might be returned by the delete function:
•
SL_ERROR_FS_FILE_IS_ALREADY_OPENED: File that is opened cannot be deleted. The file is
expected to be closed or aborted to be deleted; trying to delete a file opened for write/read results in
this error.
•
SL_ERROR_FS_FILE_NOT_EXISTS: Trying to delete a file which does not exist results in this error.
Example:
_i16
Status;
_u8
DeviceFileName[180];
_u32
MasterToken;
Status = sl_FsDel( DeviceFileName, MasterToken );
if
( Status < 0 )
{
/*error */
}
8.7
Rename a File
This function renames an existing file; for secure files, the rename requires the master token.
The following is a partial list of errors that might be returned by the rename function:
•
SL_ERROR_FS_FILE_IS_ALREADY_OPENED: File that is opened cannot be renamed. The file is
expected to be closed or aborted to be renamed.
•
SL_ERROR_FS_FILE_NAME_RESERVED: System file cannot be renamed, and file cannot be
renamed to a system filename.
•
SL_ERROR_FS_FILE_NAME_EXIST: Renaming a file to a filename that already exists results in an
error.
Example:
_i32
Status;
_u8
DeviceFileName[180], NewDeviceFileName[180];
_u32
Token;
Status = sl_FsCtl(SL_FS_CTL_RENAME, Token, DeviceFileName, NewDeviceFileName, 0, NULL, 0, NULL );
if
( Status < 0 )
{
/*error */
}
8.8
File System Helper Functions
Some functions are used for observing the file system state. This section describes those functions.
8.8.1 Get File Information
The function retrieves information regarding a specific file. For secure files, the file requires a token. For
secure files where the input token is zero, only a part of the information of the file is retrieved, because the
tokens and the creation token flags are hidden.
Trying to request information for a file that does not exist results in an error (FILE_NOT_EXISTS). Trying
to request information for a file which has no valid copy results in retrieving the file information, but the
return value will be an error (SL_FS_INFO_NOT_VALID_EXISTS).
Example:
_i16
Status;
_u8
DeviceFileName[180];