Rahul Dahiya / Mbed OS STM32F7 Ethernet
Committer:
rahul_dahiya
Date:
Wed Jan 15 15:57:15 2020 +0530
Revision:
0:fb8047b156bb
STM32F7 LWIP

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rahul_dahiya 0:fb8047b156bb 1 /* mbed Microcontroller Library
rahul_dahiya 0:fb8047b156bb 2 * Copyright (c) 2006-2013 ARM Limited
rahul_dahiya 0:fb8047b156bb 3 *
rahul_dahiya 0:fb8047b156bb 4 * Licensed under the Apache License, Version 2.0 (the "License");
rahul_dahiya 0:fb8047b156bb 5 * you may not use this file except in compliance with the License.
rahul_dahiya 0:fb8047b156bb 6 * You may obtain a copy of the License at
rahul_dahiya 0:fb8047b156bb 7 *
rahul_dahiya 0:fb8047b156bb 8 * http://www.apache.org/licenses/LICENSE-2.0
rahul_dahiya 0:fb8047b156bb 9 *
rahul_dahiya 0:fb8047b156bb 10 * Unless required by applicable law or agreed to in writing, software
rahul_dahiya 0:fb8047b156bb 11 * distributed under the License is distributed on an "AS IS" BASIS,
rahul_dahiya 0:fb8047b156bb 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rahul_dahiya 0:fb8047b156bb 13 * See the License for the specific language governing permissions and
rahul_dahiya 0:fb8047b156bb 14 * limitations under the License.
rahul_dahiya 0:fb8047b156bb 15 */
rahul_dahiya 0:fb8047b156bb 16 #ifndef MBED_FILESYSTEMLIKE_H
rahul_dahiya 0:fb8047b156bb 17 #define MBED_FILESYSTEMLIKE_H
rahul_dahiya 0:fb8047b156bb 18
rahul_dahiya 0:fb8047b156bb 19 #include "platform/platform.h"
rahul_dahiya 0:fb8047b156bb 20
rahul_dahiya 0:fb8047b156bb 21 #include "platform/FileSystemHandle.h"
rahul_dahiya 0:fb8047b156bb 22 #include "platform/FileHandle.h"
rahul_dahiya 0:fb8047b156bb 23 #include "platform/DirHandle.h"
rahul_dahiya 0:fb8047b156bb 24 #include "platform/NonCopyable.h"
rahul_dahiya 0:fb8047b156bb 25
rahul_dahiya 0:fb8047b156bb 26 namespace mbed {
rahul_dahiya 0:fb8047b156bb 27 /** \addtogroup platform */
rahul_dahiya 0:fb8047b156bb 28 /** @{*/
rahul_dahiya 0:fb8047b156bb 29 /**
rahul_dahiya 0:fb8047b156bb 30 * \defgroup platform_FileSystemLike FileSystemLike functions
rahul_dahiya 0:fb8047b156bb 31 * @{
rahul_dahiya 0:fb8047b156bb 32 */
rahul_dahiya 0:fb8047b156bb 33
rahul_dahiya 0:fb8047b156bb 34
rahul_dahiya 0:fb8047b156bb 35 /** A filesystem-like object is one that can be used to open file-like
rahul_dahiya 0:fb8047b156bb 36 * objects though it by fopen("/name/filename", mode)
rahul_dahiya 0:fb8047b156bb 37 *
rahul_dahiya 0:fb8047b156bb 38 * Implementations must define at least open (the default definitions
rahul_dahiya 0:fb8047b156bb 39 * of the rest of the functions just return error values).
rahul_dahiya 0:fb8047b156bb 40 *
rahul_dahiya 0:fb8047b156bb 41 * @note Synchronization level: Set by subclass
rahul_dahiya 0:fb8047b156bb 42 */
rahul_dahiya 0:fb8047b156bb 43 class FileSystemLike : public FileSystemHandle, public FileBase, private NonCopyable<FileSystemLike> {
rahul_dahiya 0:fb8047b156bb 44 public:
rahul_dahiya 0:fb8047b156bb 45 /** FileSystemLike lifetime
rahul_dahiya 0:fb8047b156bb 46 */
rahul_dahiya 0:fb8047b156bb 47 FileSystemLike(const char *name = NULL) : FileBase(name, FileSystemPathType) {}
rahul_dahiya 0:fb8047b156bb 48 virtual ~FileSystemLike() {}
rahul_dahiya 0:fb8047b156bb 49
rahul_dahiya 0:fb8047b156bb 50 // Inherited functions with name conflicts
rahul_dahiya 0:fb8047b156bb 51 using FileSystemHandle::open;
rahul_dahiya 0:fb8047b156bb 52
rahul_dahiya 0:fb8047b156bb 53 /** Open a file on the filesystem
rahul_dahiya 0:fb8047b156bb 54 *
rahul_dahiya 0:fb8047b156bb 55 * @param path The name of the file to open
rahul_dahiya 0:fb8047b156bb 56 * @param flags The flags to open the file in, one of O_RDONLY, O_WRONLY, O_RDWR,
rahul_dahiya 0:fb8047b156bb 57 * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND
rahul_dahiya 0:fb8047b156bb 58 * @return A file handle on success, NULL on failure
rahul_dahiya 0:fb8047b156bb 59 * @deprecated Replaced by `int open(FileHandle **, ...)` for propagating error codes
rahul_dahiya 0:fb8047b156bb 60 */
rahul_dahiya 0:fb8047b156bb 61 MBED_DEPRECATED_SINCE("mbed-os-5.5",
rahul_dahiya 0:fb8047b156bb 62 "Replaced by `int open(FileHandle **, ...)` for propagating error codes")
rahul_dahiya 0:fb8047b156bb 63 FileHandle *open(const char *path, int flags)
rahul_dahiya 0:fb8047b156bb 64 {
rahul_dahiya 0:fb8047b156bb 65 FileHandle *file;
rahul_dahiya 0:fb8047b156bb 66 int err = open(&file, path, flags);
rahul_dahiya 0:fb8047b156bb 67 return err ? NULL : file;
rahul_dahiya 0:fb8047b156bb 68 }
rahul_dahiya 0:fb8047b156bb 69
rahul_dahiya 0:fb8047b156bb 70 /** Open a directory on the filesystem
rahul_dahiya 0:fb8047b156bb 71 *
rahul_dahiya 0:fb8047b156bb 72 * @param path Name of the directory to open
rahul_dahiya 0:fb8047b156bb 73 * @return A directory handle on success, NULL on failure
rahul_dahiya 0:fb8047b156bb 74 * @deprecated Replaced by `int open(DirHandle **, ...)` for propagating error codes
rahul_dahiya 0:fb8047b156bb 75 */
rahul_dahiya 0:fb8047b156bb 76 MBED_DEPRECATED_SINCE("mbed-os-5.5",
rahul_dahiya 0:fb8047b156bb 77 "Replaced by `int open(DirHandle **, ...)` for propagating error codes")
rahul_dahiya 0:fb8047b156bb 78 DirHandle *opendir(const char *path)
rahul_dahiya 0:fb8047b156bb 79 {
rahul_dahiya 0:fb8047b156bb 80 DirHandle *dir;
rahul_dahiya 0:fb8047b156bb 81 int err = open(&dir, path);
rahul_dahiya 0:fb8047b156bb 82 return err ? NULL : dir;
rahul_dahiya 0:fb8047b156bb 83 }
rahul_dahiya 0:fb8047b156bb 84 };
rahul_dahiya 0:fb8047b156bb 85
rahul_dahiya 0:fb8047b156bb 86 /**@}*/
rahul_dahiya 0:fb8047b156bb 87
rahul_dahiya 0:fb8047b156bb 88 /**@}*/
rahul_dahiya 0:fb8047b156bb 89
rahul_dahiya 0:fb8047b156bb 90 } // namespace mbed
rahul_dahiya 0:fb8047b156bb 91
rahul_dahiya 0:fb8047b156bb 92 #endif