// AttachFileDevice takes a path to a regular file and makes it available as an // attached block device. func (v VolumePathHandler) AttachFileDevice(path string) (string, error) { … } // DetachFileDevice takes a path to the attached block device and // detach it from block device. func (v VolumePathHandler) DetachFileDevice(path string) error { … } // GetLoopDevice returns the full path to the loop device associated with the given path. func (v VolumePathHandler) GetLoopDevice(path string) (string, error) { … } func makeLoopDevice(path string) (string, error) { … } // removeLoopDevice removes specified loopback device func removeLoopDevice(device string) error { … } // getLoopDeviceFromSysfs finds the backing file for a loop // device from sysfs via "/sys/block/loop*/loop/backing_file". func getLoopDeviceFromSysfs(path string) (string, error) { … } // cleanPath remove any trailing substrings that are not part of the backing file path. func cleanBackingFilePath(path string) string { … } // FindGlobalMapPathUUIDFromPod finds {pod uuid} bind mount under globalMapPath // corresponding to map path symlink, and then return global map path with pod uuid. // (See pkg/volume/volume.go for details on a global map path and a pod device map path.) // ex. mapPath symlink: pods/{podUid}}/{DefaultKubeletVolumeDevicesDirName}/{escapeQualifiedPluginName}/{volumeName} -> /dev/sdX // // globalMapPath/{pod uuid} bind mount: plugins/kubernetes.io/{PluginName}/{DefaultKubeletVolumeDevicesDirName}/{volumePluginDependentPath}/{pod uuid} -> /dev/sdX func (v VolumePathHandler) FindGlobalMapPathUUIDFromPod(pluginDir, mapPath string, podUID types.UID) (string, error) { … } // compareBindMountAndSymlinks returns if global path (bind mount) and // pod path (symlink) are pointing to the same device. // If there is an error in checking it returns error. func compareBindMountAndSymlinks(global, pod string) (bool, error) { … } // getDeviceMajorMinor returns major/minor number for the path with below format: // major:minor (in hex) // ex) // // fc:10 func getDeviceMajorMinor(path string) (string, error) { … }