.TP
.B table-length
Specify the maximal number of GPT partitions.
+.TP
+.B grain
+Specify minimal size in bytes used to calculate partitions alignment. The
+default is 1MiB and it's strongly recommended to use the default. Do not
+modify this variable if you're not sure.
.RE
.sp
Note that it is only possible to use header lines before the first partition
return fi ? fi->data : NULL;
}
-
/**
* fdisk_script_set_header:
* @dp: script instance
}
}
+ if (!rc && fdisk_get_grain_size(cxt) != 2048 * 512) {
+ char buf[64];
+
+ snprintf(buf, sizeof(buf), "%zu", fdisk_get_grain_size(cxt));
+ rc = fdisk_script_set_header(dp, "grain", buf);
+ }
+
+
DBG(SCRIPT, ul_debugobj(dp, "read context done [rc=%d]", rc));
return rc;
}
goto done; /* only "sectors" supported */
} else if (strcmp(name, "label-id") == 0
|| strcmp(name, "device") == 0
+ || strcmp(name, "grain") == 0
|| strcmp(name, "first-lba") == 0
|| strcmp(name, "last-lba") == 0
|| strcmp(name, "table-length") == 0) {
DBG(SCRIPT, ul_debugobj(dp, "applying script headers"));
fdisk_set_script(cxt, dp);
+ str = fdisk_script_get_header(dp, "grain");
+ if (str) {
+ uintmax_t sz;
+
+ rc = parse_size(str, &sz, NULL);
+ if (rc == 0)
+ rc = fdisk_save_user_grain(cxt, sz);
+ if (rc)
+ return rc;
+ }
+
+ if (fdisk_has_user_device_properties(cxt))
+ fdisk_apply_user_device_properties(cxt);
+
/* create empty label */
name = fdisk_script_get_header(dp, "label");
if (!name)