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.
FileSystemLike.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_FILESYSTEMLIKE_H 00017 #define MBED_FILESYSTEMLIKE_H 00018 00019 #include "platform/platform.h" 00020 00021 #include "platform/FileSystemHandle.h" 00022 #include "platform/FileHandle.h" 00023 #include "platform/DirHandle.h" 00024 #include "platform/NonCopyable.h" 00025 00026 namespace mbed { 00027 /** \addtogroup platform */ 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 * @ingroup platform 00038 */ 00039 class FileSystemLike : public FileSystemHandle, public FileBase, private NonCopyable<FileSystemLike> { 00040 public: 00041 /** FileSystemLike lifetime 00042 */ 00043 FileSystemLike(const char *name = NULL) : FileBase(name, FileSystemPathType) {} 00044 virtual ~FileSystemLike() {} 00045 00046 // Inherited functions with name conflicts 00047 using FileSystemHandle::open; 00048 00049 /** Open a file on the filesystem 00050 * 00051 * @param path The name of the file to open 00052 * @param flags The flags to open the file in, one of O_RDONLY, O_WRONLY, O_RDWR, 00053 * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND 00054 * @return A file handle on success, NULL on failure 00055 * @deprecated Replaced by `int open(FileHandle **, ...)` for propagating error codes 00056 */ 00057 MBED_DEPRECATED_SINCE("mbed-os-5.5", 00058 "Replaced by `int open(FileHandle **, ...)` for propagating error codes") 00059 FileHandle *open(const char *path, int flags) 00060 { 00061 FileHandle *file; 00062 int err = open(&file, path, flags); 00063 return err ? NULL : file; 00064 } 00065 00066 /** Open a directory on the filesystem 00067 * 00068 * @param path Name of the directory to open 00069 * @return A directory handle on success, NULL on failure 00070 * @deprecated Replaced by `int open(DirHandle **, ...)` for propagating error codes 00071 */ 00072 MBED_DEPRECATED_SINCE("mbed-os-5.5", 00073 "Replaced by `int open(DirHandle **, ...)` for propagating error codes") 00074 DirHandle *opendir(const char *path) 00075 { 00076 DirHandle *dir; 00077 int err = open(&dir, path); 00078 return err ? NULL : dir; 00079 } 00080 }; 00081 00082 00083 } // namespace mbed 00084 00085 #endif
Generated on Tue Jul 12 2022 20:03:18 by
