Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sysfs/class_nvme.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

const nvmeClassPath = "class/nvme"

var nvmeNamespacePattern = regexp.MustCompile(`nvme\d+c\d+n(\d+)`)
var nvmeNamespacePattern = regexp.MustCompile(`nvme\d+n(\d+)`)

// NVMeNamespace contains info from files in /sys/class/nvme/<device>/<namespace>.
type NVMeNamespace struct {
Expand Down
8 changes: 4 additions & 4 deletions sysfs/class_nvme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestNVMeNamespaceParsingWithMockData(t *testing.T) {
}

// Create mock namespace directory and files
namespaceDir := filepath.Join(deviceDir, "nvme0c0n1")
namespaceDir := filepath.Join(deviceDir, "nvme0n1")
err = os.MkdirAll(filepath.Join(namespaceDir, "queue"), 0o755)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -205,8 +205,8 @@ func TestNVMeMultipleNamespaces(t *testing.T) {
anaState string
blockSize string
}{
{"nvme1c0n1", "1", "100000", "2000000000", "optimized", "4096"},
{"nvme1c0n2", "2", "50000", "1000000000", "active", "512"},
{"nvme1n1", "1", "100000", "2000000000", "optimized", "4096"},
{"nvme1n2", "2", "50000", "1000000000", "active", "512"},
}

for _, ns := range namespaces {
Expand Down Expand Up @@ -344,7 +344,7 @@ func TestNVMeNamespaceMissingFiles(t *testing.T) {
}

// Create namespace directory but with missing files
namespaceDir := filepath.Join(deviceDir, "nvme2c0n1")
namespaceDir := filepath.Join(deviceDir, "nvme2n1")
err = os.MkdirAll(filepath.Join(namespaceDir, "queue"), 0o755)
if err != nil {
t.Fatal(err)
Expand Down
12 changes: 6 additions & 6 deletions testdata/fixtures.ttar
Original file line number Diff line number Diff line change
Expand Up @@ -6959,28 +6959,28 @@ Lines: 1
Samsung SSD 970 PRO 512GB
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: fixtures/sys/class/nvme/nvme0/nvme0c0n0
Directory: fixtures/sys/class/nvme/nvme0/nvme0n0
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: fixtures/sys/class/nvme/nvme0/nvme0c0n0/ana_state
Path: fixtures/sys/class/nvme/nvme0/nvme0n0/ana_state
Lines: 1
optimized
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: fixtures/sys/class/nvme/nvme0/nvme0c0n0/nuse
Path: fixtures/sys/class/nvme/nvme0/nvme0n0/nuse
Lines: 1
488281250
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: fixtures/sys/class/nvme/nvme0/nvme0c0n0/queue
Directory: fixtures/sys/class/nvme/nvme0/nvme0n0/queue
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: fixtures/sys/class/nvme/nvme0/nvme0c0n0/queue/logical_block_size
Path: fixtures/sys/class/nvme/nvme0/nvme0n0/queue/logical_block_size
Lines: 1
4096
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: fixtures/sys/class/nvme/nvme0/nvme0c0n0/size
Path: fixtures/sys/class/nvme/nvme0/nvme0n0/size
Lines: 1
3906250000
Mode: 644
Expand Down