Ejemplo n.º 1
0
        internal static Result FindFileSystem(this FileSystemClientImpl fs, out FileSystemAccessor fileSystem,
                                              out U8Span subPath, U8Span path)
        {
            UnsafeHelpers.SkipParamInit(out fileSystem);
            subPath = default;

            if (path.IsNull())
            {
                return(ResultFs.NullptrArgument.Log());
            }

            int hostMountNameLen = StringUtils.GetLength(CommonPaths.HostRootFileSystemMountName);

            if (StringUtils.Compare(path, CommonPaths.HostRootFileSystemMountName, hostMountNameLen) == 0)
            {
                return(ResultFs.NotMounted.Log());
            }

            Result rc = GetMountNameAndSubPath(out MountName mountName, out subPath, path);

            if (rc.IsFailure())
            {
                return(rc);
            }

            return(fs.Find(out fileSystem, new U8Span(mountName.Name)));
        }
Ejemplo n.º 2
0
        public static Result IsMounted(this FileSystemClientImpl fs, out bool isMounted, U8Span mountName)
        {
            UnsafeHelpers.SkipParamInit(out isMounted);

            Result rc = fs.Find(out _, mountName);

            if (rc.IsFailure())
            {
                if (!ResultFs.NotMounted.Includes(rc))
                {
                    return(rc);
                }

                isMounted = false;
            }
            else
            {
                isMounted = true;
            }

            return(Result.Success);
        }