1 /*
2 # Copyright (C) 2024 HiHope Open Source Organization .
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 */
15
16 #include "hal_file.h"
17 #include "littlefs_adapt.h"
18
HalFileOpen(const char * path,int oflag,int mode)19 int HalFileOpen(const char* path, int oflag, int mode)
20 {
21 (void)mode;
22 return fs_adapt_open(path, oflag);
23 }
24
HalFileClose(int fd)25 int HalFileClose(int fd)
26 {
27 return fs_adapt_close(fd);
28 }
29
HalFileRead(int fd,char * buf,unsigned int len)30 int HalFileRead(int fd, char *buf, unsigned int len)
31 {
32 return fs_adapt_read(fd, buf, len);
33 }
34
HalFileWrite(int fd,const char * buf,unsigned int len)35 int HalFileWrite(int fd, const char *buf, unsigned int len)
36 {
37 return fs_adapt_write(fd, buf, len);
38 }
39
HalFileDelete(const char * path)40 int HalFileDelete(const char *path)
41 {
42 return fs_adapt_delete(path);
43 }
44
HalFileStat(const char * path,unsigned int * fileSize)45 int HalFileStat(const char *path, unsigned int *fileSize)
46 {
47 return fs_adapt_stat(path, fileSize);
48 }
49
HalFileSeek(int fd,int offset,unsigned int whence)50 int HalFileSeek(int fd, int offset, unsigned int whence)
51 {
52 return fs_adapt_seek(fd, offset, whence);
53 }
54