Skip to content
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

Merged
merged 1 commit into from
Jan 27, 2021
Merged

Conversation

pearsonk
Copy link

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]

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 ""
}
Copy link
Collaborator

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.

Copy link
Author

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

Copy link
Collaborator

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.

Copy link
Owner

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,
Copy link
Collaborator

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)

@ffromani
Copy link
Collaborator

/lgtm
just for the record to reach closure on my side :)

Copy link
Owner

@jaypipes jaypipes left a 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 ""
}
Copy link
Owner

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.

@jaypipes jaypipes added this to the v0.7 milestone Jan 27, 2021
@jaypipes jaypipes merged commit a4ed6b9 into jaypipes:master Jan 27, 2021
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.

3 participants