Skip to content

Commit

Permalink
remove unused notification logic on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisd8088 committed Jul 29, 2020
1 parent aef9cd7 commit 683dbbf
Showing 1 changed file with 11 additions and 35 deletions.
46 changes: 11 additions & 35 deletions ProjFS.Linux/PrjFSLib.Linux.Managed/VirtualizationInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,42 +399,23 @@ private int HandleNonProjEvent(ref ProjFS.Event ev, bool perm)
}

bool isDirectory = (ev.Mask & ProjFS.Constants.PROJFS_ONDIR) != 0;
string triggeringProcessName = GetProcCmdline(ev.Pid);
byte[] providerId = new byte[PlaceholderIdLength];
byte[] contentId = new byte[PlaceholderIdLength];
string relativePath = PtrToStringUTF8(ev.Path);
Result result = Result.Success;
string relativePath;

if (!isDirectory)
if (nt == NotificationType.FileRenamed ||
nt == NotificationType.HardLinkCreated)
{
string currentRelativePath = relativePath;

// TODO(Linux): can other intermediate file ops race us here?
if (nt == NotificationType.FileRenamed || nt == NotificationType.HardLinkCreated)
{
currentRelativePath = PtrToStringUTF8(ev.TargetPath);
relativePath = currentRelativePath;
}

result = this.projfs.GetProjAttrs(
currentRelativePath,
providerId,
contentId);
relativePath = PtrToStringUTF8(ev.TargetPath);
}

if (result == Result.Success)
else
{
result = this.OnNotifyOperation(
commandId: 0,
relativePath: relativePath,
providerId: providerId,
contentId: contentId,
triggeringProcessId: ev.Pid,
triggeringProcessName: triggeringProcessName,
isDirectory: isDirectory,
notificationType: nt);
relativePath = PtrToStringUTF8(ev.Path);
}

Result result = this.OnNotifyOperation(
relativePath: relativePath,
isDirectory: isDirectory,
notificationType: nt);

int ret = -result.ToErrno();

if (perm)
Expand Down Expand Up @@ -463,12 +444,7 @@ private int HandlePermEvent(ref ProjFS.Event ev)
}

private Result OnNotifyOperation(
ulong commandId,
string relativePath,
byte[] providerId,
byte[] contentId,
int triggeringProcessId,
string triggeringProcessName,
bool isDirectory,
NotificationType notificationType)
{
Expand Down

0 comments on commit 683dbbf

Please sign in to comment.