diff --git a/pkg/volume/emptydir/empty_dir_linux.go b/pkg/volume/emptydir/empty_dir_linux.go index 381ad4bf666..cd05277dfca 100644 --- a/pkg/volume/emptydir/empty_dir_linux.go +++ b/pkg/volume/emptydir/empty_dir_linux.go @@ -31,12 +31,6 @@ import ( "k8s.io/api/core/v1" ) -// Defined by Linux - the type number for tmpfs mounts. -const ( - linuxTmpfsMagic = 0x01021994 - linuxHugetlbfsMagic = 0x958458f6 -) - // realMountDetector implements mountDetector in terms of syscalls. type realMountDetector struct { mounter mount.Interface @@ -98,9 +92,9 @@ func (m *realMountDetector) GetMountMedium(path string, requestedMedium v1.Stora klog.V(3).Infof("Statfs_t of %v: %+v", path, buf) - if buf.Type == linuxTmpfsMagic { + if buf.Type == unix.TMPFS_MAGIC { return v1.StorageMediumMemory, !notMnt, nil, nil - } else if int64(buf.Type) == linuxHugetlbfsMagic { + } else if int64(buf.Type) == unix.HUGETLBFS_MAGIC { // Skip page size detection if requested medium doesn't have size specified if requestedMedium == v1.StorageMediumHugePages { return v1.StorageMediumHugePages, !notMnt, nil, nil diff --git a/test/images/agnhost/mounttest/mt_utils.go b/test/images/agnhost/mounttest/mt_utils.go index e78c1811fed..aff5585d996 100644 --- a/test/images/agnhost/mounttest/mt_utils.go +++ b/test/images/agnhost/mounttest/mt_utils.go @@ -29,9 +29,6 @@ func umask(mask int) int { return syscall.Umask(mask) } -// Defined by Linux (sys/statfs.h) - the type number for tmpfs mounts. -const linuxTmpfsMagic = 0x01021994 - func fsType(path string) error { if path == "" { return nil @@ -43,11 +40,7 @@ func fsType(path string) error { return err } - if buf.Type == linuxTmpfsMagic { - fmt.Printf("mount type of %q: tmpfs\n", path) - } else { - fmt.Printf("mount type of %q: %v\n", path, buf.Type) - } + fmt.Printf("mount type of %q: %v\n", path, buf.Type) return nil }