Beispiel #1
0
        // ReSharper disable once UnusedParameter.Local
        private static Result MountBisImpl(FileSystemClient fs, U8Span mountName, BisPartitionId partitionId, U8Span rootPath)
        {
            Result rc = MountHelpers.CheckMountNameAcceptingReservedMountName(mountName);

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

            FsPath sfPath;

            unsafe { _ = &sfPath; } // workaround for CS0165

            IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();

            // Nintendo doesn't use the provided rootPath
            sfPath.Str[0] = 0;

            rc = fsProxy.OpenBisFileSystem(out IFileSystem fileSystem, ref sfPath, partitionId);
            if (rc.IsFailure())
            {
                return(rc);
            }

            var nameGenerator = new BisCommonMountNameGenerator(partitionId);

            return(fs.Register(mountName, fileSystem, nameGenerator));
        }
Beispiel #2
0
            static Result Mount(FileSystemClientImpl fs, U8Span mountName, BisPartitionId partitionId)
            {
                Result rc = fs.CheckMountNameAcceptingReservedMountName(mountName);

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

                using ReferenceCountedDisposable <IFileSystemProxy> fsProxy = fs.GetFileSystemProxyServiceObject();

                // Nintendo doesn't use the provided rootPath
                FspPath.CreateEmpty(out FspPath sfPath);

                ReferenceCountedDisposable <IFileSystemSf> fileSystem = null;

                try
                {
                    rc = fsProxy.Target.OpenBisFileSystem(out fileSystem, in sfPath, partitionId);
                    if (rc.IsFailure())
                    {
                        return(rc);
                    }

                    var nameGenerator     = new BisCommonMountNameGenerator(partitionId);
                    var fileSystemAdapter = new FileSystemServiceObjectAdapter(fileSystem);

                    return(fs.Fs.Register(mountName, fileSystemAdapter, nameGenerator));
                }
                finally
                {
                    fileSystem?.Dispose();
                }
            }