Lines Matching refs:rootPath
127 uint32_t rootLen = strlen(sandbox->rootPath);
128 char *rootPath = strstr(sandbox->rootPath, PARAMETER_USER_ID);
129 if (rootPath == NULL) {
130 len = sprintf_s(buffer, bufferLen, "%s/%d", sandbox->rootPath, uid);
132 ret = memcpy_s(buffer, bufferLen, sandbox->rootPath, rootPath - sandbox->rootPath);
133 APPSPAWN_CHECK(ret == 0, return ret, "Failed to copy root path %{public}s", sandbox->rootPath);
134 currLen = rootPath - sandbox->rootPath;
138 uid, sandbox->rootPath + currLen + userIdLen);
143 "Failed to format root path %{public}s", sandbox->rootPath);
170 context->rootPath = NULL;
179 if (context->rootPath) {
180 free(context->rootPath);
181 context->rootPath = NULL;
227 const char *rootPath = GetSandboxRealVar(context, BUFFER_FOR_SOURCE, sandbox->rootPath, NULL, NULL);
228 if (rootPath) {
229 context->rootPath = strdup(rootPath);
231 if (context->rootPath == NULL) {
455 BUFFER_FOR_TARGET, sandboxNode->target, context->rootPath, extraData);
494 sandboxNode->linkName, context->rootPath, NULL);
550 const char rootPath[] = "/data/app/el2/";
552 size_t allPathSize = strlen(rootPath) + strlen(basePath) + 1 + USER_ID_SIZE + bundleNameLen;
555 int len = sprintf_s(path, allPathSize, "%s%u%s%s", rootPath, uid, basePath, bundleName);
568 static void MountDir(AppSpawnMsgDacInfo *info, const char *bundleName, const char *rootPath, const char *targetPath)
570 if (info == NULL || bundleName == NULL || rootPath == NULL || targetPath == NULL) {
575 size_t allPathSize = strlen(rootPath) + strlen(targetPath) + strlen(bundleName) + 2;
579 int len = sprintf_s(path, allPathSize, "%s%u/%s%s", rootPath, info->uid / userIdBase, bundleName, targetPath);
614 const char rootPath[] = "/mnt/sandbox/";
622 MountDir(info, appRootName, rootPath, nwebPath);
623 MountDir(info, appRootName, rootPath, nwebTmpPath);
632 MountDir(info, context->bundleName, rootPath, MOUNT_SHARED_MAP[i].sandboxPath);
637 MountDir(info, context->bundleName, rootPath, MOUNT_SHARED_MAP[i].sandboxPath);
645 rootPath, info->uid / UID_BASE, context->bundleName);
648 rootPath, info->uid / UID_BASE, context->bundleName);
761 BUFFER_FOR_TARGET, "/data/bundles/", context->rootPath, NULL);
835 BUFFER_FOR_TARGET, "/data/storage/bundle_resources/", context->rootPath, NULL);
847 ret = chdir(context->rootPath);
850 context->bundleName, context->rootPath, errno);
853 ret = chroot(context->rootPath);
855 "chroot failed, path: %{public}s errno: %{public}d", context->rootPath, errno);
858 ret = syscall(SYS_pivot_root, context->rootPath, context->rootPath);
860 "pivot root failed, path: %{public}s errno: %{public}d", context->rootPath, errno);
863 "MNT_DETACH failed, path: %{public}s errno: %{public}d", context->rootPath, errno);
864 APPSPAWN_LOGV("ChangeCurrentDir %{public}s ", context->rootPath);
871 APPSPAWN_LOGV("SandboxRootFolderCreateNoShare %{public}s ", context->rootPath);
874 "set propagation slave failed, app: %{public}s errno: %{public}d", context->rootPath, errno);
876 MountArg arg = {context->rootPath, context->rootPath, NULL, BASIC_MOUNT_FLAGS, NULL, MS_SLAVE};
879 "mount path failed, app: %{public}s errno: %{public}d", context->rootPath, ret);
892 "set propagation slave failed, app: %{public}s errno: %{public}d", context->rootPath, errno);
895 ret = mount("/", context->rootPath, NULL, BASIC_MOUNT_FLAGS, NULL);
897 "mount bind / failed, app: %{public}s errno: %{public}d", context->rootPath, errno);
905 static bool IsSandboxMounted(const AppSpawnSandboxCfg *sandbox, const char *name, const char *rootPath)
908 int len = sprintf_s(path, sizeof(path), "%s%s", rootPath, SANDBOX_STAMP_FILE_SUFFIX);
921 static int SetSandboxMounted(const AppSpawnSandboxCfg *sandbox, const char *name, char *rootPath)
923 APPSPAWN_LOGW("SetSystemConstMounted %{public}s ", rootPath);
925 int len = sprintf_s(path, sizeof(path), "%s%s", rootPath, SANDBOX_STAMP_FILE_SUFFIX);
935 static void UnmountPath(char *rootPath, uint32_t len, const SandboxMountNode *sandboxNode)
939 int ret = strcat_s(rootPath, len, pathNode->target);
941 APPSPAWN_LOGV("Unmount sandbox config sandbox path %{public}s ", rootPath);
942 ret = umount2(rootPath, MNT_DETACH);
943 APPSPAWN_CHECK_ONLY_LOG(ret == 0, "Failed to umount2 %{public}s errno: %{public}d", rootPath, errno);
1040 if (IsSandboxMounted(sandbox, "system-const", context->rootPath) && IsADFPermission(sandbox, property) != true) {
1041 APPSPAWN_LOGV("Sandbox system-const %{public}s has been mount", context->rootPath);
1046 APPSPAWN_LOGV("Set sandbox system-const %{public}s", context->rootPath);
1053 SetSandboxMounted(sandbox, "system-const", context->rootPath);
1299 int ret = strcpy_s(sandboxDevShmPath, sizeof(sandboxDevShmPath), context->rootPath);
1300 APPSPAWN_CHECK(ret == 0, return, "Failed to strcpy rootPath");
1321 context->rootPath, context->sandboxNsFlags);
1326 CreateSandboxDir(context->rootPath, FILE_MODE);
1355 APPSPAWN_LOGV("Change root dir success %{public}s ", context->rootPath);