Implement the base type of the new entity system, i.e. `Entity`, for all relevant components: - PartitionTable - Partition - Filesystem Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
package disk
|
|
|
|
import osbuild "github.com/osbuild/osbuild-composer/internal/osbuild1"
|
|
|
|
// Filesystem related functions
|
|
type Filesystem struct {
|
|
Type string
|
|
// ID of the filesystem, vfat doesn't use traditional UUIDs, therefore this
|
|
// is just a string.
|
|
UUID string
|
|
Label string
|
|
Mountpoint string
|
|
// The fourth field of fstab(5); fs_mntops
|
|
FSTabOptions string
|
|
// The fifth field of fstab(5); fs_freq
|
|
FSTabFreq uint64
|
|
// The sixth field of fstab(5); fs_passno
|
|
FSTabPassNo uint64
|
|
}
|
|
|
|
func (fs *Filesystem) IsContainer() bool {
|
|
return false
|
|
}
|
|
|
|
// Clone the filesystem structure
|
|
func (fs *Filesystem) Clone() *Filesystem {
|
|
if fs == nil {
|
|
return nil
|
|
}
|
|
|
|
return &Filesystem{
|
|
Type: fs.Type,
|
|
UUID: fs.UUID,
|
|
Label: fs.Label,
|
|
Mountpoint: fs.Mountpoint,
|
|
FSTabOptions: fs.FSTabOptions,
|
|
FSTabFreq: fs.FSTabFreq,
|
|
FSTabPassNo: fs.FSTabPassNo,
|
|
}
|
|
}
|
|
|
|
// Converts Filesystem to osbuild.QEMUFilesystem that encodes the same fs.
|
|
func (fs *Filesystem) QEMUFilesystem() osbuild.QEMUFilesystem {
|
|
return osbuild.QEMUFilesystem{
|
|
Type: fs.Type,
|
|
UUID: fs.UUID,
|
|
Label: fs.Label,
|
|
Mountpoint: fs.Mountpoint,
|
|
}
|
|
}
|