Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for parseMountFrom (0.09 sec)

  1. internal/mountinfo/mountinfo_linux.go

    func readProcMounts(mountFilePath string) (mountInfos, error) {
    	file, err := os.Open(mountFilePath)
    	if err != nil {
    		return nil, err
    	}
    	defer file.Close()
    	return parseMountFrom(file)
    }
    
    func parseMountFrom(file io.Reader) (mountInfos, error) {
    	mounts := mountInfos{}
    	scanner := bufio.NewReader(file)
    	for {
    		line, err := scanner.ReadString('\n')
    		if err == io.EOF {
    			break
    		}
    
    Registered: Sun Dec 28 19:28:13 UTC 2025
    - Last Modified: Tue Feb 18 16:25:55 UTC 2025
    - 4.7K bytes
    - Viewed (0)
  2. internal/mountinfo/mountinfo_linux_test.go

    	successCase := `/dev/0 /path/to/0 type0 flags 0 0
    		/dev/1    /path/to/1   type1	flags 1 1
    		/dev/2 /path/to/2 type2 flags,1,2=3 2 2
    		`
    	// Success case, verifies if parsing works properly.
    	{
    		mounts, err := parseMountFrom(strings.NewReader(successCase))
    		if err != nil {
    			t.Errorf("expected success")
    		}
    		if len(mounts) != 3 {
    			t.Fatalf("expected 3 mounts, got %d", len(mounts))
    		}
    Registered: Sun Dec 28 19:28:13 UTC 2025
    - Last Modified: Thu Jan 18 07:03:17 UTC 2024
    - 7.3K bytes
    - Viewed (0)
Back to top