github.com/anonymouse64/snapd@v0.0.0-20210824153203-04c4c42d842d/gadget/export_test.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2019-2020 Canonical Ltd 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 3 as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package gadget 21 22 type ( 23 MountedFilesystemUpdater = mountedFilesystemUpdater 24 RawStructureUpdater = rawStructureUpdater 25 ) 26 27 var ( 28 ValidateStructureType = validateStructureType 29 ValidateVolumeStructure = validateVolumeStructure 30 ValidateRole = validateRole 31 ValidateVolume = validateVolume 32 33 SetImplicitForVolumeStructure = setImplicitForVolumeStructure 34 35 ResolveVolume = resolveVolume 36 CanUpdateStructure = canUpdateStructure 37 CanUpdateVolume = canUpdateVolume 38 39 WriteFile = writeFileOrSymlink 40 41 RawContentBackupPath = rawContentBackupPath 42 43 UpdaterForStructure = updaterForStructure 44 45 Flatten = flatten 46 47 FilesystemInfo = filesystemInfo 48 49 NewRawStructureUpdater = newRawStructureUpdater 50 NewMountedFilesystemUpdater = newMountedFilesystemUpdater 51 52 FindDeviceForStructureWithFallback = findDeviceForStructureWithFallback 53 FindMountPointForStructure = findMountPointForStructure 54 55 ParseRelativeOffset = parseRelativeOffset 56 57 SplitKernelRef = splitKernelRef 58 59 ResolveVolumeContent = resolveVolumeContent 60 61 GadgetVolumeConsumesOneKernelUpdateAsset = gadgetVolumeConsumesOneKernelUpdateAsset 62 ) 63 64 func MockEvalSymlinks(mock func(path string) (string, error)) (restore func()) { 65 oldEvalSymlinks := evalSymlinks 66 evalSymlinks = mock 67 return func() { 68 evalSymlinks = oldEvalSymlinks 69 } 70 } 71 72 func (m *MountedFilesystemWriter) WriteDirectory(volumeRoot, src, dst string, preserveInDst []string) error { 73 return m.writeDirectory(volumeRoot, src, dst, preserveInDst) 74 }