Hello, I wonder why in FreeBSD 8.0 does not show the "UUID" of the partition. (not tested in earlier versions)
A sample program (c++):
Linux (Arch Linux):
FreeBSD 8.0
A sample program (c++):
Code:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <fcntl.h>
#include <fstab.h>
#include <blkid/blkid.h>
int main(int argc, char *argv[])
{
fstab * fs_rec;
short i;
if (setfsent() != 0) /* set read pointer */
{
i = 1;
fprintf( stdout, "fstab init successful\n");
while (i == 1)
{
fs_rec = getfsent();
if (fs_rec != '\0')
{
if (strcmp(fs_rec->fs_spec,"none") != 0 )
{
fprintf( stdout,"%s,%s, %s\n",
fs_rec->fs_spec,
fs_rec->fs_vfstype,
blkid_get_tag_value(NULL,"UUID",fs_rec->fs_spec)
);
}
}
else
{
fprintf( stdout,"got null pointer\n");
i = 0; /* got null opinter, end or error */
}
}
fprintf( stdout,"cleaning up\n");
endfsent(); /* free up resources */
}
else
{
fprintf( stdout, "fstab init failed\n");
}
return 0;
}
Code:
fstab init successful
UUID=29e5bb47-632b-49b9-a110-a12dd6cc453b,ext4, (null)
/dev/sda2,ntfs, A8588FB2588F7E36
got null pointer
cleaning up
Code:
fstab init successful
/dev/ad0s1a,ufs, (null)
/dev/acd0,cd9660, (null)
got null pointer
cleaning up