Match-id-b08926bead0de9d389a4ccbc630730c47db50300

This commit is contained in:
BianTanggui
2020-07-05 12:06:17 +08:00
parent d29403afa5
commit cd41979504
11 changed files with 80 additions and 38 deletions

View File

@@ -1,26 +1,29 @@
/*
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
* Description: ascend-docker-cli工具实用函数模块头文件
*/
#ifndef _UTILS_H
#define _UTILS_H
#include <stdbool.h>
#include <limits.h>
#include <sys/types.h>
#include "basic.h"
// For cgroup setup
int StrHasPrefix(const char *str, const char *prefix);
typedef char *(*ParseFileLine)(char *, const char *);
int CatFileContent(char* buffer, int bufferSize, ParseFileLine fn, const char* filepath);
bool CheckRootDir(char **pLine);
bool CheckFsType(char **pLine);
bool CheckSubStr(char **pLine, const char *subsys);
bool CheckRootDir(char **pLine);
typedef char *(*ParseFileLine)(char *, const char *);
int CatFileContent(char* buffer, int bufferSize, ParseFileLine fn, const char* filepath);
// For mount setup
int MkDir(const char *dir, int mode);
int MakeParentDir(const char *path, mode_t mode);
int VerifyPathInfo(const struct PathInfo* pathInfo);
int CheckDirExists(const char *dir);
int GetParentPathStr(const char *path, char *parent, size_t bufSize);
int MakeParentDir(const char *path, mode_t mode);
int CreateFile(const char *path, mode_t mode);
int VerfifyPathInfo(const struct PathInfo* pathInfo);
int Mount(const char *src, const char *dst);
#endif