Skip to content

Commit

Permalink
Mount: Remove tracing on TryAttach
Browse files Browse the repository at this point in the history
Allow the caller to determine how to handle the error.  This is because a command line error may fail due to permissions and be retried successfully by the service.
  • Loading branch information
jeschu1 committed Oct 23, 2018
1 parent 9b2d5a8 commit a992ca0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions GVFS/GVFS.Platform.Windows/ProjFSFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private enum ProjFSInboxStatus

public string DriverLogFolderName { get; } = ProjFSFilter.ServiceName;

public static bool TryAttach(ITracer tracer, string enlistmentRoot, out string errorMessage)
public static bool TryAttach(string enlistmentRoot, out string errorMessage)
{
errorMessage = null;
try
Expand All @@ -56,22 +56,19 @@ public static bool TryAttach(ITracer tracer, string enlistmentRoot, out string e
if (!NativeMethods.GetVolumePathName(enlistmentRoot, volumePathName, GVFSConstants.MaxPath))
{
errorMessage = "Could not get volume path name";
tracer.RelatedError($"{nameof(TryAttach)}:{errorMessage}");
return false;
}

uint result = NativeMethods.FilterAttach(DriverName, volumePathName.ToString(), null);
if (result != OkResult && result != NameCollisionErrorResult)
{
errorMessage = string.Format("Attaching the filter driver resulted in: {0}", result);
tracer.RelatedError(errorMessage);
return false;
}
}
catch (Exception e)
{
errorMessage = string.Format("Attaching the filter driver resulted in: {0}", e.Message);
tracer.RelatedError(errorMessage);
return false;
}

Expand Down Expand Up @@ -373,7 +370,7 @@ public bool IsReady(JsonTracer tracer, string enlistmentRoot, out string error)
return
IsServiceRunning(tracer) &&
IsNativeLibInstalled(tracer, new PhysicalFileSystem()) &&
TryAttach(tracer, enlistmentRoot, out error);
TryAttach(enlistmentRoot, out error);
}

private static bool IsInboxAndEnabled()
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.Service/Handlers/EnableAndAttachProjFSHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void Run()

if (!string.IsNullOrEmpty(this.request.EnlistmentRoot))
{
if (!ProjFSFilter.TryAttach(this.tracer, this.request.EnlistmentRoot, out errorMessage))
if (!ProjFSFilter.TryAttach(this.request.EnlistmentRoot, out errorMessage))
{
state = NamedPipeMessages.CompletionState.Failure;
this.tracer.RelatedError("Unable to attach filter to volume. Enlistment root: {0} \nError: {1} ", this.request.EnlistmentRoot, errorMessage);
Expand Down

0 comments on commit a992ca0

Please sign in to comment.