From 9c75a5aa2944724f3d914540fe674ba36b596568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 15 May 2026 08:08:18 +0800 Subject: [PATCH] usbip: prune stale and low-quality ledger comments Drop the ConfirmImport reference left over from a prior design (the function never existed) and remove three doc-comments that restated the function name or narrated visible lock dances. --- service/usbip/export_ledger.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/service/usbip/export_ledger.go b/service/usbip/export_ledger.go index 5a71ae39e..eeba796c3 100644 --- a/service/usbip/export_ledger.go +++ b/service/usbip/export_ledger.go @@ -69,8 +69,6 @@ func (l *exportLedger) IsBusy(busid string) bool { return l.busy[busid] } -// AvailableExports returns exports not currently busy; Snapshot may be -// called on each entry outside the ledger's lock. func (l *exportLedger) AvailableExports() []Export { l.slow.Lock() out := make([]Export, 0, len(l.exports)) @@ -98,7 +96,6 @@ func (l *exportLedger) ApplyHostSnapshot(snapshot map[string]Export, released [] l.slow.Unlock() } -// SeedBroadcastState stores the recomputed state without emitting a frame. func (l *exportLedger) SeedBroadcastState(ctx context.Context) { nextState := deviceInfoV2Map(l.snapshotDeviceState(ctx)) l.fast.Lock() @@ -147,8 +144,8 @@ func (l *exportLedger) BroadcastIfChanged(ctx context.Context) bool { // TryReserveForImport runs Export.LeaseCheck outside the slow lock; the // busy mark is inserted only after a second availability re-check -// confirms no goroutine raced in. On success, the caller must follow up -// with ConfirmImport or ReleaseImport on the failure path. +// confirms no goroutine raced in. The caller must pair every success +// with a later ReleaseImport. func (l *exportLedger) TryReserveForImport(ctx context.Context, busid string) (Export, bool, string) { l.slow.Lock() export, found := l.exports[busid] @@ -421,8 +418,6 @@ func (l *exportLedger) HandleControlLeaseRequest(ctx context.Context, sub *expor }, response, controlFrame{Type: controlFrameChanged, Version: controlProtocolVersion, Sequence: sequence}) } -// snapshotDeviceState gathers refs under slow, releases, then calls -// Export.Snapshot for each entry outside the lock. func (l *exportLedger) snapshotDeviceState(ctx context.Context) []DeviceInfoV2 { type entry struct { export Export