fileutils2

package
v0.3.11-8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2024 License: Apache-2.0 Imports: 23 Imported by: 55

Documentation

Index

Constants

View Source
const (
	BLOCK_SIZE  = 32 * 1024 // 2**15
	BLOCK_WIDTH = 15
)

Variables

This section is empty.

Functions

func ChangeAllBlkdevsParams

func ChangeAllBlkdevsParams(params map[string]string)

func ChangeBlkdevParameter

func ChangeBlkdevParameter(dev, key, value string)

func CleanFailedMountpoints

func CleanFailedMountpoints()

func Cleandir

func Cleandir(sPath string, keepdir bool) error

func Exists

func Exists(filepath string) bool

func FastCheckSum

func FastCheckSum(filePath string) (string, error)

func FileAppendContents

func FileAppendContents(filename string, content string) error

func FileFastHash

func FileFastHash(filename string, hashAlgo []hash.Hash, rate int) ([][]byte, error)

func FileGetContents

func FileGetContents(file string) (string, error)

func FileGetIntContent

func FileGetIntContent(file string) (int, error)

func FileHash

func FileHash(filename string, hash []hash.Hash) ([][]byte, error)

func FilePutContents

func FilePutContents(filename string, content string, modAppend bool) error

func FileSetContents

func FileSetContents(filename string, content string) error

func FileSize

func FileSize(name string) int64

func FsFormatToDiskType

func FsFormatToDiskType(fsFormat string) string

func GetAllBlkdevsIoSchedulers

func GetAllBlkdevsIoSchedulers() ([]string, error)

func GetBlkdevConfig

func GetBlkdevConfig(dev, key string) (string, error)

func GetBlkidType

func GetBlkidType(filepath string) string

func GetDevId

func GetDevId(spath string) string

func GetDevOfPath

func GetDevOfPath(spath string) string

func GetDevUuid

func GetDevUuid(dev string) (map[string]string, error)

func GetFsFormat

func GetFsFormat(diskPath string) string

func IsBlockDevMounted

func IsBlockDevMounted(dev string) bool

func IsBlockDeviceUsed

func IsBlockDeviceUsed(dev string) bool

func IsDir

func IsDir(filepath string) bool

func IsFile

func IsFile(filepath string) bool

func IsIsoFile

func IsIsoFile(sPath string) bool

func MD5

func MD5(filename string) (string, error)

func SHA1

func SHA1(filename string) (string, error)

func SHA256

func SHA256(filename string) (string, error)

func SHA512

func SHA512(filename string) (string, error)

func SumHashes

func SumHashes(sums [][]byte) []byte

func Writable

func Writable(path string) bool

func Zerofiles

func Zerofiles(sPath string) error

TODO: test

Types

type HostsFile

type HostsFile map[string][]string

func (HostsFile) Add

func (hf HostsFile) Add(name string, value ...string)

func (HostsFile) Parse

func (hf HostsFile) Parse(content string)

func (HostsFile) String

func (hf HostsFile) String() string

type Partition

type Partition struct {
	Index    int
	Bootable bool
	Start    int64
	End      int64
	Count    int64
	DiskType string
	Fs       string
	DevName  string
}

func NewPartition

func NewPartition(idx int, bootable bool, start int64, end int64, count int64, diskType string, fs string, devName string) Partition

func ParseDiskPartitions

func ParseDiskPartitions(dev string, lines []string) ([]Partition, string)

ParseDiskPartitions parse command `parted -s /dev/sda -- unit s print` result

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL