github.com/jandre/docker@v1.7.0/daemon/graphdriver/driver_linux.go (about)

     1  // +build linux
     2  
     3  package graphdriver
     4  
     5  import (
     6  	"path/filepath"
     7  	"syscall"
     8  )
     9  
    10  const (
    11  	FsMagicAufs     = FsMagic(0x61756673)
    12  	FsMagicBtrfs    = FsMagic(0x9123683E)
    13  	FsMagicCramfs   = FsMagic(0x28cd3d45)
    14  	FsMagicExtfs    = FsMagic(0x0000EF53)
    15  	FsMagicF2fs     = FsMagic(0xF2F52010)
    16  	FsMagicJffs2Fs  = FsMagic(0x000072b6)
    17  	FsMagicJfs      = FsMagic(0x3153464a)
    18  	FsMagicNfsFs    = FsMagic(0x00006969)
    19  	FsMagicRamFs    = FsMagic(0x858458f6)
    20  	FsMagicReiserFs = FsMagic(0x52654973)
    21  	FsMagicSmbFs    = FsMagic(0x0000517B)
    22  	FsMagicSquashFs = FsMagic(0x73717368)
    23  	FsMagicTmpFs    = FsMagic(0x01021994)
    24  	FsMagicXfs      = FsMagic(0x58465342)
    25  	FsMagicZfs      = FsMagic(0x2fc12fc1)
    26  )
    27  
    28  var (
    29  	// Slice of drivers that should be used in an order
    30  	priority = []string{
    31  		"aufs",
    32  		"btrfs",
    33  		"zfs",
    34  		"devicemapper",
    35  		"overlay",
    36  		"vfs",
    37  	}
    38  
    39  	FsNames = map[FsMagic]string{
    40  		FsMagicAufs:        "aufs",
    41  		FsMagicBtrfs:       "btrfs",
    42  		FsMagicCramfs:      "cramfs",
    43  		FsMagicExtfs:       "extfs",
    44  		FsMagicF2fs:        "f2fs",
    45  		FsMagicJffs2Fs:     "jffs2",
    46  		FsMagicJfs:         "jfs",
    47  		FsMagicNfsFs:       "nfs",
    48  		FsMagicRamFs:       "ramfs",
    49  		FsMagicReiserFs:    "reiserfs",
    50  		FsMagicSmbFs:       "smb",
    51  		FsMagicSquashFs:    "squashfs",
    52  		FsMagicTmpFs:       "tmpfs",
    53  		FsMagicUnsupported: "unsupported",
    54  		FsMagicXfs:         "xfs",
    55  		FsMagicZfs:         "zfs",
    56  	}
    57  )
    58  
    59  func GetFSMagic(rootpath string) (FsMagic, error) {
    60  	var buf syscall.Statfs_t
    61  	if err := syscall.Statfs(filepath.Dir(rootpath), &buf); err != nil {
    62  		return 0, err
    63  	}
    64  	return FsMagic(buf.Type), nil
    65  }