Skip to content

internal/hcs cleanup; and callbackNumber type #2602

Open
helsaawy wants to merge 3 commits intomicrosoft:mainfrom
helsaawy:callback-counter
Open

internal/hcs cleanup; and callbackNumber type #2602
helsaawy wants to merge 3 commits intomicrosoft:mainfrom
helsaawy:callback-counter

Conversation

@helsaawy
Copy link
Contributor

Use dedicated callback number type and atomic counter

Add an explicit callbackNumber type and use an atomic.Uintptr to track callback numbers instead of the RWMutex callbackMapLock.

Add comment clarifying use of callbackNumber as callback context.

Add logs to notificationWatcher and (*Process|*System).[un]registryCallback.

Add "internal/winapi".IsInvalidHandle function to valid Handles are neither 0 nor Invalid.

Add (*Process).CloseCtx(context.Context) and use that, along with (*System).CloseCtx where appropriate.

Minor code cleanup and doc fixes:

  • Clarify docs.
  • Fix spelling.
  • Remove newline from log.
  • Update CI lint version.
  • Suppress lint issues (skipped error checks for Close() calls are ignored automatically, but not for CloseCtx(ctx)).
  • Standardize system and process ID log/span field names.
  • Use "system-id" for system ID rather than "cid", which can be interpreted as "container ID".
  • Don't serialize OptionsWCOW.OutputHandlerCreator to JSON.
  • Consolidate redundant internal/winapi/winapi.go with internal/winapi/doc.go.
  • Use "internal/log".(*Hook) to format logs and add span information in functional/gcs tests.
  • Add testing nil-checks and logs to uVM/container/process testing operations.

Required for #2526

Clarify docs.
Fix spelling.
Remove newline from comments.
Don't serialize `OptionsWCOW.OutputHandlerCreator` to JSON.
Consolidate redundant `internal/winapi/winapi.go` with `internal/winapi/doc.go`.

Use `"internal/log".(*Hook)` to format logs and add span information
in functional/gcs tests.
Add testing `nil`-checks and logs to uVM/container/process testing
operations.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Add `"internal/winapi".IsInvalidHandle` function to valid `Handle`s are
neither `0` nor Invalid.

Standardize system and process ID log/span field names.
Use `"system-id"` for system ID rather than `"cid"`, which can be
interpreted as "container ID".

Add `(*Process).CloseCtx(context.Context)` and use that, along with
`(*System).CloseCtx` where appropriate.

Suppress lint issues (skipped error checks for `Close()` calls
are ignored automatically, but not for `CloseCtx(ctx)`).

Update CI lint version.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Add an explicit `callbackNumber` type and use an `atomic.Uintptr` to
track callback numbers instead of the RWMutex `callbackMapLock`.

Add comment clarifying use of `callbackNumber` as callback context.

Add logs to `notificationWatcher` and `(*Process|*System)[un]registryCallback`.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments