mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-22 17:51:28 +00:00
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>
35 lines
931 B
Go
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)
|
|
}
|