Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of gr-peach-opencv-project by
FileSystemHandle.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef MBED_FILESYSTEMHANDLE_H 00017 #define MBED_FILESYSTEMHANDLE_H 00018 00019 #include "platform/platform.h" 00020 00021 #include "platform/FileBase.h" 00022 #include "platform/FileHandle.h" 00023 #include "platform/DirHandle.h" 00024 00025 namespace mbed { 00026 /** \addtogroup drivers */ 00027 /** @{*/ 00028 00029 00030 /** A filesystem-like object is one that can be used to open file-like 00031 * objects though it by fopen("/name/filename", mode) 00032 * 00033 * Implementations must define at least open (the default definitions 00034 * of the rest of the functions just return error values). 00035 * 00036 * @note Synchronization level: Set by subclass 00037 */ 00038 class FileSystemHandle { 00039 public: 00040 /** FileSystemHandle lifetime 00041 */ 00042 virtual ~FileSystemHandle() {} 00043 00044 /** Open a file on the filesystem 00045 * 00046 * @param file Destination for the handle to a newly created file 00047 * @param filename The name of the file to open 00048 * @param flags The flags to open the file in, one of O_RDONLY, O_WRONLY, O_RDWR, 00049 * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND 00050 * @return 0 on success, negative error code on failure 00051 */ 00052 virtual int open(FileHandle **file, const char *filename, int flags) = 0; 00053 00054 /** Open a directory on the filesystem 00055 * 00056 * @param dir Destination for the handle to the directory 00057 * @param path Name of the directory to open 00058 * @return 0 on success, negative error code on failure 00059 */ 00060 virtual int open(DirHandle **dir, const char *path); 00061 00062 /** Remove a file from the filesystem. 00063 * 00064 * @param path The name of the file to remove. 00065 * @return 0 on success, negative error code on failure 00066 */ 00067 virtual int remove(const char *path); 00068 00069 /** Rename a file in the filesystem. 00070 * 00071 * @param path The name of the file to rename. 00072 * @param newpath The name to rename it to 00073 * @return 0 on success, negative error code on failure 00074 */ 00075 virtual int rename(const char *path, const char *newpath); 00076 00077 /** Store information about the file in a stat structure 00078 * 00079 * @param path The name of the file to find information about 00080 * @param st The stat buffer to write to 00081 * @return 0 on success, negative error code on failure 00082 */ 00083 virtual int stat(const char *path, struct stat *st); 00084 00085 /** Create a directory in the filesystem. 00086 * 00087 * @param path The name of the directory to create. 00088 * @param mode The permissions with which to create the directory 00089 * @return 0 on success, negative error code on failure 00090 */ 00091 virtual int mkdir(const char *path, mode_t mode); 00092 }; 00093 00094 00095 } // namespace mbed 00096 00097 #endif 00098 00099 /** @}*/ 00100
Generated on Tue Jul 12 2022 15:17:23 by
1.7.2
