-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PCI: Add device revision number #219
Conversation
Providing access to the revision number of hardware can be useful in identifying or diagnosing problems introduced across versions of single product line. Signed-off-by: Kevin Pearson <[email protected]>
|
||
if _, err := os.Stat(revisionPath); err != nil { | ||
return "" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not wrong, but it seems we can just call ReadFile directly instead of checking with os.Stat
before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I concur. I implemented it in this fashion to mirror the existing approach for reading the modalias file, for the sake of consistency. I'm not against the simplified approach of attempting a read and reacting on the returned error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have strong opinions here. Both approaches have their merits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, totally fine to use existing pattern here.
} | ||
revisionPath := filepath.Join( | ||
paths.SysBusPciDevices, | ||
pciAddr.Domain+":"+pciAddr.Bus+":"+pciAddr.Slot+"."+pciAddr.Function, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this suggests we may want to add a String
method to pci.Address
(not in this PR)
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pearsonk! Great stuff :)
|
||
if _, err := os.Stat(revisionPath); err != nil { | ||
return "" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, totally fine to use existing pattern here.
Providing access to the revision number of hardware can be useful in
identifying or diagnosing problems introduced across versions of single
product line.
Signed-off-by: Kevin Pearson [email protected]