示例#1
0
func (v *VirStorageVol) WipePattern(algorithm uint32, flags uint32) error {
	result := C.virStorageVolWipePattern(v.ptr, C.uint(algorithm), C.uint(flags))
	if result == -1 {
		return GetLastError()
	}
	return nil
}
// Wipe ensure data previously on a volume is not accessible to future reads.
func (vol StorageVolume) Wipe(alg StorageVolumeWipeAlgorithm) error {
	vol.log.Printf("wiping storage volume with algorithm %v...\n", alg)
	cRet := C.virStorageVolWipePattern(vol.virStorageVol, C.uint(alg), 0)
	ret := int32(cRet)

	if ret == -1 {
		err := LastError()
		vol.log.Printf("an error occurred: %v\n", err)
		return err
	}

	vol.log.Println("volume wiped")

	return nil
}