MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / NewDevMapper

Function NewDevMapper

pkg/fs/dev.go:45–66  ·  view source on GitHub ↗

NewDevMapper creates a new instance of the DOS device replacer.

()

Source from the content-addressed store, hash-verified

43
44// NewDevMapper creates a new instance of the DOS device replacer.
45func NewDevMapper() DevMapper {
46 m := &mapper{
47 cache: make(map[string]string),
48 }
49
50 // loop through logical drives and query the DOS device name
51 for _, drive := range sys.GetLogicalDrives() {
52 device, err := sys.QueryDosDevice(drive)
53 if err != nil {
54 continue
55 }
56 m.cache[device] = drive
57 }
58
59 // resolve the SystemRoot environment variable
60 m.sysroot = os.Getenv("SystemRoot")
61 if m.sysroot == "" {
62 m.sysroot = os.Getenv("SYSTEMROOT")
63 }
64
65 return m
66}
67
68func (m *mapper) Convert(filename string) string {
69 if filename == "" || len(filename) < deviceOffset {

Callers 6

object.goFile · 0.92
param_windows.goFile · 0.92
NewChainFunction · 0.92
TestFsProcessorFunction · 0.92
TestHandleProcessorFunction · 0.92
TestConvertDosDeviceFunction · 0.85

Calls 2

GetLogicalDrivesFunction · 0.92
QueryDosDeviceFunction · 0.92

Tested by 3

TestFsProcessorFunction · 0.74
TestHandleProcessorFunction · 0.74
TestConvertDosDeviceFunction · 0.68