storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/pkg/disk/type_linux.go (about)

     1  //go:build linux && !s390x && !arm && !386
     2  // +build linux,!s390x,!arm,!386
     3  
     4  /*
     5   * MinIO Cloud Storage, (C) 2017 MinIO, Inc.
     6   *
     7   * Licensed under the Apache License, Version 2.0 (the "License");
     8   * you may not use this file except in compliance with the License.
     9   * You may obtain a copy of the License at
    10   *
    11   *     http://www.apache.org/licenses/LICENSE-2.0
    12   *
    13   * Unless required by applicable law or agreed to in writing, software
    14   * distributed under the License is distributed on an "AS IS" BASIS,
    15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    16   * See the License for the specific language governing permissions and
    17   * limitations under the License.
    18   */
    19  
    20  package disk
    21  
    22  import "strconv"
    23  
    24  // fsType2StringMap - list of filesystems supported on linux
    25  var fsType2StringMap = map[string]string{
    26  	"1021994":  "TMPFS",
    27  	"137d":     "EXT",
    28  	"4244":     "HFS",
    29  	"4d44":     "MSDOS",
    30  	"52654973": "REISERFS",
    31  	"5346544e": "NTFS",
    32  	"58465342": "XFS",
    33  	"61756673": "AUFS",
    34  	"6969":     "NFS",
    35  	"ef51":     "EXT2OLD",
    36  	"ef53":     "EXT4",
    37  	"f15f":     "ecryptfs",
    38  	"794c7630": "overlayfs",
    39  	"2fc12fc1": "zfs",
    40  	"ff534d42": "cifs",
    41  	"53464846": "wslfs",
    42  }
    43  
    44  // getFSType returns the filesystem type of the underlying mounted filesystem
    45  func getFSType(ftype int64) string {
    46  	fsTypeHex := strconv.FormatInt(ftype, 16)
    47  	fsTypeString, ok := fsType2StringMap[fsTypeHex]
    48  	if !ok {
    49  		return "UNKNOWN"
    50  	}
    51  	return fsTypeString
    52  }