github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/internal/disk/type_linux.go (about)

     1  //go:build linux && !s390x && !arm && !386
     2  // +build linux,!s390x,!arm,!386
     3  
     4  // Copyright (c) 2015-2021 MinIO, Inc.
     5  //
     6  // This file is part of MinIO Object Storage stack
     7  //
     8  // This program is free software: you can redistribute it and/or modify
     9  // it under the terms of the GNU Affero General Public License as published by
    10  // the Free Software Foundation, either version 3 of the License, or
    11  // (at your option) any later version.
    12  //
    13  // This program is distributed in the hope that it will be useful
    14  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  // GNU Affero General Public License for more details.
    17  //
    18  // You should have received a copy of the GNU Affero General Public License
    19  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    20  
    21  package disk
    22  
    23  import "strconv"
    24  
    25  // fsType2StringMap - list of filesystems supported on linux
    26  var fsType2StringMap = map[string]string{
    27  	"1021994":  "TMPFS",
    28  	"137d":     "EXT",
    29  	"4244":     "HFS",
    30  	"4d44":     "MSDOS",
    31  	"52654973": "REISERFS",
    32  	"5346544e": "NTFS",
    33  	"58465342": "XFS",
    34  	"61756673": "AUFS",
    35  	"6969":     "NFS",
    36  	"ef51":     "EXT2OLD",
    37  	"ef53":     "EXT4",
    38  	"f15f":     "ecryptfs",
    39  	"794c7630": "overlayfs",
    40  	"2fc12fc1": "zfs",
    41  	"ff534d42": "cifs",
    42  	"53464846": "wslfs",
    43  }
    44  
    45  // getFSType returns the filesystem type of the underlying mounted filesystem
    46  func getFSType(ftype int64) string {
    47  	fsTypeHex := strconv.FormatInt(ftype, 16)
    48  	fsTypeString, ok := fsType2StringMap[fsTypeHex]
    49  	if !ok {
    50  		return "UNKNOWN"
    51  	}
    52  	return fsTypeString
    53  }