Lines Matching defs:path

119  * @brief Get canonical form of a given path based on cwd(Current working directory).
122 * @param path Indicates the path to be canonicalization.
125 * @return Returns the length of the canonical path.
127 * @attention if path is an absolute path, cwd is ignored. if cwd if not specified, it is assumed to be root('/').
129 * length of the canonical path.
131 static size_t GetCanonicalPath(const char *cwd, const char *path, char *buf, size_t bufSize)
134 if (!path) {
135 path = "";
138 if ((!cwd) || (path[0] == '/')) {
143 size_t tmpLen = strlen(cwd) + strlen(path) + offset;
149 if (-1 == sprintf_s(tmpBuf, tmpLen, "/%s/%s/", cwd, path)) {
207 static int VfsPathCheck(const char *path, bool isFile)
210 if ((path == NULL) || (path[0] == '\0')) {
215 len = strlen(path);
221 if (isFile && path[len - 1] == '/') {
229 static int VfsOpen(const char *path, int flags)
237 if (VfsPathCheck(path, TRUE) != LOS_OK) {
246 mp = VfsMpFind(path, &pathInMp);
249 /* path is not in any mountpoint */
270 len = strlen(path) + 1;
278 (void)strcpy_s((char *)file->fullPath, len, path);
494 int open(const char *path, int flags, ...)
496 if (path == NULL) {
508 size_t pathLen = strlen(path) + 1;
519 if (GetCanonicalPath(NULL, path, canonicalPath, pathLen) == 0) {
550 if (!strncmp(path, PIPE_DEV_PATH, strlen(PIPE_DEV_PATH))) {
551 return PipeOpen(path, flags, PIPE_DEV_FD);
555 int ret = VfsOpen(path, flags);
559 FUNC_ALIAS(open, _open, (const char *path, int flags, ...), int);
690 int stat(const char *path, struct stat *stat)
696 if (VfsPathCheck(path, FALSE) != LOS_OK) {
710 mp = VfsMpFind(path, &pathInMp);
727 FUNC_ALIAS(stat, _stat, (const char *path, struct stat *stat), int);
730 int statfs(const char *path, struct statfs *buf)
736 if (VfsPathCheck(path, FALSE) != LOS_OK) {
750 mp = VfsMpFind(path, &pathInMp);
767 int unlink(const char *path)
773 if (VfsPathCheck(path, FALSE) != LOS_OK) {
782 mp = VfsMpFind(path, &pathInMp);
796 FUNC_ALIAS(unlink, _unlink, (const char *path), int);
883 DIR *opendir(const char *path)
890 if (VfsPathCheck(path, FALSE) != LOS_OK) {
913 mp = VfsMpFind(path, &pathInMp);
1011 int mkdir(const char *path, mode_t mode)
1018 if (VfsPathCheck(path, FALSE) != LOS_OK) {
1027 mp = VfsMpFind(path, &pathInMp);
1044 int rmdir(const char *path)
1050 if (path == NULL) {
1060 mp = VfsMpFind(path, &pathInMp);
1074 int lstat(const char *path, struct stat *buffer)
1076 return stat(path, buffer);
1267 int access(const char *path, int amode)
1273 result = stat(path, &buf);