Files
kubernetes/test/images/agnhost/mounttest/mt_utils_linux.go
Davanum Srinivas d3d78ce0dd Add tmpfs detection to mounttest and unit tests
Refactor fsType() to use a platform-specific formatFsType() helper that
translates filesystem magic numbers to human-readable names. On Linux,
tmpfs filesystems now display as "tmpfs" instead of the raw magic number.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2026-01-15 12:02:56 -05:00

35 lines
931 B
Go

//go:build linux
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package mounttest
import (
"strconv"
"golang.org/x/sys/unix"
)
// formatFsType returns a string representation of the filesystem type.
// It translates known filesystem magic numbers to human-readable names.
func formatFsType(fsType int64) string {
if fsType == unix.TMPFS_MAGIC {
return "tmpfs"
}
return strconv.FormatInt(fsType, 10)
}