[Bug 294326] glabel.8: Document conditions where (automatic) labeled devices aren't created
Date: Wed, 08 Apr 2026 18:58:51 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294326
--- Comment #3 from Michael Osipov <michaelo@FreeBSD.org> ---
Yet something else: Looking at disk(4) there is:
/usr/include/sys/disk.h:#define DISK_IDENT_SIZE 256
but g_label_create() uses "char name[64]". While I am not an expect on the
subsystems, but isn't that a contradiction?
Sample:
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/disk.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int
main(int argc, char *argv[])
{
int fd;
char ident[DISK_IDENT_SIZE];
if (argc != 2) {
fprintf(stderr, "Usage: %s <device>\n", argv[0]);
return 1;
}
fd = open(argv[1], O_RDONLY);
if (fd < 0)
err(1, "open(%s)", argv[1]);
memset(ident, 0, sizeof(ident));
if (ioctl(fd, DIOCGIDENT, ident) < 0)
err(1, "ioctl(DIOCGIDENT)");
printf("Device: %s\nIdent : %s\n", argv[1], ident);
close(fd);
return 0;
}
root@deblndw013x:~
# ./a.out /dev/da0
Device: /dev/da0
Ident : 50014380147AB8F0
root@deblndw013x:~
# ./a.out /dev/da1
Device: /dev/da1
Ident : 50014380147AB8F0
root@deblndw013x:~
# ./a.out /dev/da2
Device: /dev/da2
Ident : 50014380147AB8F0
root@deblndw013x:~
So if this value can be longer than 64 chars the sample code would print it and
likely "camcontrol identify"/"diskinfo -s", but glabel would refuse to create
it?
--
You are receiving this mail because:
You are the assignee for the bug.