1 /*
2  * Copyright (c) 2020 Huawei Device Co., Ltd.
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 #ifndef KERNEL_LIBFS_H
17 #define KERNEL_LIBFS_H
18 
19 /**
20  * desc:   make a new directory
21  * input:  dirname
22  * output: -1 -- mkdir failed, detail info printed
23  *          0 -- mkdir ok, or dirname already exists
24  *          1 -- dirname already exists
25  */
26 int MakeDir(const char *dirname);
27 
28 /**
29  * desc:   remove a dir, even it's not empty
30  * input:  dirname
31  * output: -1 -- rmdir failed, detail info printed
32  *          0 -- remove ok
33  */
34 int RemoveDir(const char *dirname);
35 
36 /**
37  * desc:   remove a file
38  * input:  dirname
39  * output: -1 -- rmdir failed, detail info printed
40  *          0 -- remove ok
41  */
42 int RemoveFile(const char *fpath);
43 
44 /**
45  * desc:   copy srcFile to dstFile. if dstFile exist, it will be reflashed
46  * output: -1 -- copy failed, detail info printed
47  *          0 -- copy ok
48  */
49 int CopyFile(const char *srcFile, const char *dstFile);
50 
51 /**
52  * desc:   get current working directory
53  * output: NULL   -- getcwd failed, detail info printed
54  *         string -- the current working directory
55  */
56 char* GetCurrentPath();
57 
58 #endif // header
59