mirror of
https://github.com/clearml/go-nvlib
synced 2025-02-07 05:17:43 +00:00
Update the Open API to OpenRO and OpenRW
This commit is contained in:
parent
2c175dcdbf
commit
1f718a1568
@ -52,7 +52,7 @@ func TestNvpci(t *testing.T) {
|
||||
require.Equal(t, 0, len(capabilities.Extended), "Wrong number of extended PCI capabilities")
|
||||
|
||||
resource0 := devices[0].Resources[0]
|
||||
bar0, err := resource0.Open()
|
||||
bar0, err := resource0.OpenRW()
|
||||
require.Nil(t, err, "Error opening bar0")
|
||||
defer func() {
|
||||
err := bar0.Close()
|
||||
|
@ -36,8 +36,8 @@ type MemoryResource struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
// Open read write mmio region
|
||||
func (mr *MemoryResource) Open() (mmio.Mmio, error) {
|
||||
// OpenRW read write mmio region
|
||||
func (mr *MemoryResource) OpenRW() (mmio.Mmio, error) {
|
||||
rw, err := mmio.OpenRW(mr.Path, 0, int(mr.End-mr.Start+1))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open file for mmio: %v", err)
|
||||
@ -51,8 +51,8 @@ func (mr *MemoryResource) Open() (mmio.Mmio, error) {
|
||||
return nil, fmt.Errorf("unknown endianness for mmio: %v", err)
|
||||
}
|
||||
|
||||
// OpenReadOnly read only mmio region
|
||||
func (mr *MemoryResource) OpenReadOnly() (mmio.Mmio, error) {
|
||||
// OpenRO read only mmio region
|
||||
func (mr *MemoryResource) OpenRO() (mmio.Mmio, error) {
|
||||
ro, err := mmio.OpenRO(mr.Path, 0, int(mr.End-mr.Start+1))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open file for mmio: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user