Skip to content

Commit

Permalink
Expose UID in the OpContext (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaishalikumanan committed Jun 24, 2023
1 parent 7263f3a commit b8484ee
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
34 changes: 32 additions & 2 deletions conversions.go
Expand Up @@ -56,6 +56,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -65,6 +66,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -80,6 +82,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}
o = to
Expand Down Expand Up @@ -130,6 +133,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand Down Expand Up @@ -159,6 +163,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand Down Expand Up @@ -189,6 +194,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -213,6 +219,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -236,6 +243,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -258,6 +266,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand Down Expand Up @@ -303,6 +312,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -319,6 +329,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -335,6 +346,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -351,6 +363,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -360,6 +373,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -377,6 +391,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}
if !config.UseVectoredRead {
Expand All @@ -399,6 +414,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}
o = to
Expand Down Expand Up @@ -426,6 +442,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -441,6 +458,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -463,6 +481,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -479,6 +498,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -495,6 +515,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -504,6 +525,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand Down Expand Up @@ -558,6 +580,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -574,6 +597,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

Expand All @@ -597,6 +621,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}
o = to
Expand Down Expand Up @@ -628,6 +653,7 @@ func convertInMessage(
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}
o = to
Expand Down Expand Up @@ -669,7 +695,9 @@ func convertInMessage(
Flags: in.Flags,
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid},
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}
case fusekernel.OpFallocate:
type input fusekernel.FallocateIn
Expand All @@ -686,7 +714,9 @@ func convertInMessage(
Mode: in.Mode,
OpContext: fuseops.OpContext{
FuseID: inMsg.Header().Unique,
Pid: inMsg.Header().Pid},
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
}

default:
Expand Down
4 changes: 4 additions & 0 deletions fuseops/ops.go
Expand Up @@ -34,6 +34,10 @@ type OpContext struct {
// PID of the process that is invoking the operation.
// Not filled in case of a writepage operation.
Pid uint32

// UID of the process that is invoking the operation.
// Not filled in case of a writepage operation.
Uid uint32
}

// Return statistics about the file system's capacity and available resources.
Expand Down

0 comments on commit b8484ee

Please sign in to comment.