Libgeom glabel usage

From: Braulio Rivas <brauliorivas_at_protonmail.com>
Date: Thu, 31 Jul 2025 14:49:43 UTC
Hello!

I'm working on geomman [1], a tool based on sade that adds some features. Two of these new functions are:

- Labeling a new partition using glabel.
- Encrypt a partition through geli.

However, there are no examples about how to use glabel through libgeom, nor for geli.

To create a label, I tried something similar to the following:

struct gctl_req *glabelreq = gctl_get_handle();
gctl_ro_param(glabelreq, "class", -1, "LABEL");
gctl_ro_param(glabelreq, "arg0", -1, "/dev/da2");
gctl_ro_param(glabelreq, "arg1", -1, "testlabel");
gctl_ro_param(glabelreq, "verb", -1, "label");
char *gpart_error = gctl_issue(glabelreq);
if (gpart_error != NULL && gpart_error[0] != '\0') {
	printf("%s", gpart_error);
	gctl_free(glabelreq);
	return;
}
gctl_free(glabelreq);

But I get an error from gctl_issue():

Wrong length version argument

I suppose that the way I'm currently building the request is wrong, but I don't know what. Is there an example about using glabel? One for geli would be very helpful too.

Thanks!

Braulio Rivas

[1] https://wiki.freebsd.org/SummerOfCode2025Projects/FullDiskAdministrationToolForFreeBSD