m/n/b/mkimage/osimage: rename osimage.Create to osimage.Write

We aren't creating an osimage, we are writing it to a disk.

Change-Id: If3769e18dbe988556b0c607ad82b734f21637836
Reviewed-on: https://review.monogon.dev/c/monogon/+/3294
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
diff --git a/cloud/agent/install.go b/cloud/agent/install.go
index 6082337..66cd236 100644
--- a/cloud/agent/install.go
+++ b/cloud/agent/install.go
@@ -144,7 +144,7 @@
 		Output:         rootDev,
 	}
 
-	be, err := osimage.Create(&installParams)
+	be, err := osimage.Write(&installParams)
 	if err != nil {
 		return err
 	}
diff --git a/metropolis/installer/main.go b/metropolis/installer/main.go
index 0ae7dd6..bc428a0 100644
--- a/metropolis/installer/main.go
+++ b/metropolis/installer/main.go
@@ -89,7 +89,7 @@
 	// Use the partition's name to find and return the name of its parent
 	// device. It will be excluded from the list of suitable target devices.
 	srcDev, err := sysfs.ParentBlockDevice(espDev)
-	if err != nil{
+	if err != nil {
 		return nil, fmt.Errorf("failed to fetch parent device: %w", err)
 	}
 	// Build the exclusion list containing forbidden handle prefixes.
@@ -264,9 +264,9 @@
 	installParams.Output = tgtBlockDev
 
 	// Use osimage to partition the target block device and set up its ESP.
-	// Create will return an EFI boot entry on success.
+	// Write will return an EFI boot entry on success.
 	logf("Installing to %s...", tgtBlkdevPath)
-	be, err := osimage.Create(&installParams)
+	be, err := osimage.Write(&installParams)
 	if err != nil {
 		panicf("While installing: %v", err)
 	}
diff --git a/metropolis/node/build/mkimage/main.go b/metropolis/node/build/mkimage/main.go
index 3695054..3a68fc7 100644
--- a/metropolis/node/build/mkimage/main.go
+++ b/metropolis/node/build/mkimage/main.go
@@ -100,7 +100,7 @@
 	cfg.ABLoader = bytes.NewReader(abloader)
 
 	// Write the parametrized OS image.
-	if _, err := osimage.Create(&cfg); err != nil {
+	if _, err := osimage.Write(&cfg); err != nil {
 		log.Fatalf("while creating a Metropolis OS image: %v", err)
 	}
 }
diff --git a/metropolis/node/build/mkimage/osimage/osimage.go b/metropolis/node/build/mkimage/osimage/osimage.go
index 8f7ab6f..d139d6b 100644
--- a/metropolis/node/build/mkimage/osimage/osimage.go
+++ b/metropolis/node/build/mkimage/osimage/osimage.go
@@ -66,7 +66,7 @@
 	Data int64
 }
 
-// Params contains parameters used by Create to build a Metropolis OS
+// Params contains parameters used by Plan or Write to build a Metropolis OS
 // image.
 type Params struct {
 	// Output is the block device to which the OS image is written.
@@ -226,8 +226,8 @@
 
 const Mi = 1024 * 1024
 
-// Create writes a Metropolis OS image to a block device.
-func Create(params *Params) (*efivarfs.LoadOption, error) {
+// Write writes a Metropolis OS image to a block device.
+func Write(params *Params) (*efivarfs.LoadOption, error) {
 	p, err := Plan(params)
 	if err != nil {
 		return nil, err
diff --git a/metropolis/node/core/update/e2e/e2e_test.go b/metropolis/node/core/update/e2e/e2e_test.go
index 3df42e2..68e55e0 100644
--- a/metropolis/node/core/update/e2e/e2e_test.go
+++ b/metropolis/node/core/update/e2e/e2e_test.go
@@ -210,7 +210,7 @@
 		t.Fatal(err)
 	}
 
-	if _, err := osimage.Create(&osimage.Params{
+	if _, err := osimage.Write(&osimage.Params{
 		Output:      rootDisk,
 		ABLoader:    loader,
 		EFIPayload:  boot,