示例#1
0
        void Mount()
        {
            // mount
            m = new Mounter();

            /*
             * // connect
             * ISshSession session=account.CreateSession();
             * session.Message.VerboseLevel=5;
             * SftpFsOperation sshfs=new SftpFsOperation(session,account);
             * m.operation=sshfs;
             * //m.operation=new DebugFsOperation(sshfs);
             * //*/
            m.operation           = new mwg.Mounter.RootFsOperation(this.setting);
            m.option.DebugMode    = false;           //mwg.Sshfs.Program.DokanDebug;
            m.option.UseAltStream = true;
#if DOKAN060
            m.option.MountPoint = Program.arguments.DriveLetter + @":\";
#else
            m.option.DriveLetter = Program.arguments.DriveLetter;
#endif
            m.option.ThreadCount  = 0;
            m.option.UseKeepAlive = true;
            m.option.VolumeLabel  = "mnt";
            m.Mount();

#if DOKAN060
            this.notifyIcon1.BalloonTipText = "Mounting on " + m.option.MountPoint + ".";
#else
            this.notifyIcon1.BalloonTipText = "Mounting on " + m.option.DriveLetter + ":\\.";
#endif
        }
示例#2
0
        public void Mount(bool force)
        {
            Terminal.Write("preparing ... ");
            Prepare(force);
            Terminal.ClearLine();

            var mounter = new Mounter(this);

            Terminal.Write("mounting ... ");
            mounter.MountOverlay();
            mounter.BindMount("/root/McMorph", Merged / "root/McMorph");
            mounter.RecursiveBindMount("/dev", Merged / "dev");
            mounter.SysfsMount(Merged / "sys");
            mounter.ProcfsMount(Merged / "proc");
            mounter.BindMount("/etc/hostname", Merged / "etc/hostname");
            mounter.BindMount("/etc/hosts", Merged / "etc/hosts");
            mounter.BindMount("/etc/resolv.conf", Merged / "etc/resolv.conf");
            mounter.MountDone();

            Self.Exec();

            Terminal.Write("un-mounting ... ");
            mounter.UnMount(this);
        }
示例#3
0
        public Result Commit()
        {
            lock (Locker)
            {
                Result rc = Initialize();
                if (rc.IsFailure())
                {
                    return(rc);
                }

                rc = EnsureKvDatabaseLoaded(false);
                if (rc.IsFailure())
                {
                    return(rc);
                }

                var mount = new Mounter();

                try
                {
                    rc = mount.Initialize(FsClient, MountName, SpaceId, SaveDataId);
                    if (rc.IsFailure())
                    {
                        return(rc);
                    }

                    rc = KvDatabase.WriteDatabaseToFile();
                    if (rc.IsFailure())
                    {
                        return(rc);
                    }

                    string idFilePath = $"{MountName}:/{LastIdFileName}";

                    rc = FsClient.OpenFile(out FileHandle handle, idFilePath, OpenMode.Write);
                    if (rc.IsFailure())
                    {
                        return(rc);
                    }

                    bool fileAlreadyClosed = false;

                    try
                    {
                        ulong lastId = LastPublishedId;

                        rc = FsClient.WriteFile(handle, 0, SpanHelpers.AsByteSpan(ref lastId), WriteOption.None);
                        if (rc.IsFailure())
                        {
                            return(rc);
                        }

                        rc = FsClient.FlushFile(handle);
                        if (rc.IsFailure())
                        {
                            return(rc);
                        }

                        FsClient.CloseFile(handle);
                        fileAlreadyClosed = true;

                        return(FsClient.Commit(MountName));
                    }
                    finally
                    {
                        if (!fileAlreadyClosed)
                        {
                            FsClient.CloseFile(handle);
                        }
                    }
                }
                finally
                {
                    mount.Dispose();
                }
            }
        }
示例#4
0
 public ProjectionEntry()
 {
     Mounter.ComputedAs(Column, GetMounter, true);
 }
示例#5
0
 static MounterNaming()
 {
     _Column2 = RegisterColumn((MounterNaming _) => _.Column1);
 }
示例#6
0
 static Extension()
 {
     _Property3 = TargetType.RegisterAttachedProperty <TargetTypeAttached, PropertyType>(x => GetProperty3(x));
     _Property4 = TargetType.RegisterAttachedProperty <TargetTypeAttached, PropertyType>(x => GetProperty4(x));
 }