19762338dSopenharmony_ci/* 29762338dSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 39762338dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 49762338dSopenharmony_ci * you may not use this file except in compliance with the License. 59762338dSopenharmony_ci * You may obtain a copy of the License at 69762338dSopenharmony_ci * 79762338dSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 89762338dSopenharmony_ci * 99762338dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 109762338dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 119762338dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 129762338dSopenharmony_ci * See the License for the specific language governing permissions and 139762338dSopenharmony_ci * limitations under the License. 149762338dSopenharmony_ci */ 159762338dSopenharmony_ci 169762338dSopenharmony_ci#ifndef KERNEL_LIBFS_H 179762338dSopenharmony_ci#define KERNEL_LIBFS_H 189762338dSopenharmony_ci 199762338dSopenharmony_ci/** 209762338dSopenharmony_ci * desc: make a new directory 219762338dSopenharmony_ci * input: dirname 229762338dSopenharmony_ci * output: -1 -- mkdir failed, detail info printed 239762338dSopenharmony_ci * 0 -- mkdir ok, or dirname already exists 249762338dSopenharmony_ci * 1 -- dirname already exists 259762338dSopenharmony_ci */ 269762338dSopenharmony_ciint MakeDir(const char *dirname); 279762338dSopenharmony_ci 289762338dSopenharmony_ci/** 299762338dSopenharmony_ci * desc: remove a dir, even it's not empty 309762338dSopenharmony_ci * input: dirname 319762338dSopenharmony_ci * output: -1 -- rmdir failed, detail info printed 329762338dSopenharmony_ci * 0 -- remove ok 339762338dSopenharmony_ci */ 349762338dSopenharmony_ciint RemoveDir(const char *dirname); 359762338dSopenharmony_ci 369762338dSopenharmony_ci/** 379762338dSopenharmony_ci * desc: remove a file 389762338dSopenharmony_ci * input: dirname 399762338dSopenharmony_ci * output: -1 -- rmdir failed, detail info printed 409762338dSopenharmony_ci * 0 -- remove ok 419762338dSopenharmony_ci */ 429762338dSopenharmony_ciint RemoveFile(const char *fpath); 439762338dSopenharmony_ci 449762338dSopenharmony_ci/** 459762338dSopenharmony_ci * desc: copy srcFile to dstFile. if dstFile exist, it will be reflashed 469762338dSopenharmony_ci * output: -1 -- copy failed, detail info printed 479762338dSopenharmony_ci * 0 -- copy ok 489762338dSopenharmony_ci */ 499762338dSopenharmony_ciint CopyFile(const char *srcFile, const char *dstFile); 509762338dSopenharmony_ci 519762338dSopenharmony_ci/** 529762338dSopenharmony_ci * desc: get current working directory 539762338dSopenharmony_ci * output: NULL -- getcwd failed, detail info printed 549762338dSopenharmony_ci * string -- the current working directory 559762338dSopenharmony_ci */ 569762338dSopenharmony_cistring GetCurrentPath(); 579762338dSopenharmony_ci 589762338dSopenharmony_ci#endif // header 59