public virtual void StopVirtualizationInstance() { if (this.projfs == null) { return; } this.projfs.Stop(); this.projfs = null; }
public virtual void StopVirtualizationInstance() { if (!this.ObtainProjFS(out ProjFS fs)) { return; } fs.Stop(); this.projfs = null; }
public virtual Result StartVirtualizationInstance( string storageRootFullPath, string virtualizationRootFullPath, uint poolThreadCount) { if (this.projfs != null) { throw new InvalidOperationException(); } ProjFS.Handlers handlers = new ProjFS.Handlers { HandleProjEvent = this.preventGCOnProjEventDelegate = new ProjFS.EventHandler(this.HandleProjEvent), HandleNotifyEvent = this.preventGCOnNotifyEventDelegate = new ProjFS.EventHandler(this.HandleNotifyEvent), HandlePermEvent = this.preventGCOnPermEventDelegate = new ProjFS.EventHandler(this.HandlePermEvent) }; ProjFS fs = ProjFS.New( storageRootFullPath, virtualizationRootFullPath, handlers); if (fs == null) { return(Result.Invalid); } if (fs.Start() != 0) { fs.Stop(); return(Result.Invalid); } this.projfs = fs; this.virtualizationRoot = virtualizationRootFullPath; return(Result.Success); }
public virtual Result StartVirtualizationInstance( string storageRootFullPath, string virtualizationRootFullPath, uint poolThreadCount, bool initializeStorageRoot) { if (this.projfs != null) { throw new InvalidOperationException(); } int statResult = LinuxNative.Stat(virtualizationRootFullPath, out LinuxNative.StatBuffer stat); if (statResult != 0) { return(Result.Invalid); } ulong priorDev = stat.Dev; ProjFS.Handlers handlers = new ProjFS.Handlers { HandleProjEvent = this.preventGCOnProjEventDelegate = new ProjFS.EventHandler(this.HandleProjEvent), HandleNotifyEvent = this.preventGCOnNotifyEventDelegate = new ProjFS.EventHandler(this.HandleNotifyEvent), HandlePermEvent = this.preventGCOnPermEventDelegate = new ProjFS.EventHandler(this.HandlePermEvent) }; string[] args = initializeStorageRoot ? new string[] { "-o", "initial" } : new string[] { }; ProjFS fs = ProjFS.New( storageRootFullPath, virtualizationRootFullPath, handlers, args); if (fs == null) { return(Result.Invalid); } if (fs.Start() != 0) { fs.Stop(); return(Result.Invalid); } Stopwatch watch = Stopwatch.StartNew(); while (true) { statResult = LinuxNative.Stat(virtualizationRootFullPath, out stat); if (priorDev != stat.Dev) { break; } Thread.Sleep(MountWaitTick); if (watch.Elapsed > MountWaitTotal) { fs.Stop(); return(Result.Invalid); } } this.virtualizationRoot = virtualizationRootFullPath; this.projfs = fs; return(Result.Success); }
private bool ObtainProjFS(out ProjFS fs) { fs = this.projfs; return(fs != null); }