diff --git a/gnu/usr.bin/groff/tmac/mdoc.local b/gnu/usr.bin/groff/tmac/mdoc.local
index fad0a50..e718436 100644
--- a/gnu/usr.bin/groff/tmac/mdoc.local
+++ b/gnu/usr.bin/groff/tmac/mdoc.local
@@ -44,6 +44,7 @@
 .ds doc-str-Lb-libdevinfo       Device and Resource Information Utility Library (libdevinfo, \-ldevinfo)
 .ds doc-str-Lb-libdevstat       Device Statistics Library (libdevstat, \-ldevstat)
 .ds doc-str-Lb-libfetch         File Transfer Library (libfetch, \-lfetch)
+.ds doc-str-Lb-libfsid          Filesystem Identification Library (libfsid, \-lfsid)
 .ds doc-str-Lb-libftpio         FTP Connection Management Library (libftpio, \-lftpio)
 .ds doc-str-Lb-libipx           IPX Address Conversion Support Library (libipx, \-lipx)
 .ds doc-str-Lb-libkcore         Kernel Memory Core Access Library (libkcore, \-lkcore)
diff --git a/lib/libfsid/cd9660.c b/lib/libfsid/cd9660.c
index 9f6acaf..11b403d 100644
--- a/lib/libfsid/cd9660.c
+++ b/lib/libfsid/cd9660.c
@@ -31,25 +31,27 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #include "libfsid.h"
+
 #include <vfs/isofs/cd9660/iso.h>
 
 static char buffer[ISO_DEFAULT_BLOCK_SIZE];
 
-int
+fsid_t
 cd9660_probe(const char *dev)
 {
 	struct iso_primary_descriptor *pdsc;
 
 	if (fsid_dev_read(dev, 32768L, sizeof(buffer), buffer) != 0)
-		return 0;
+		return FSID_UNKNOWN;
 
 	pdsc = (struct iso_primary_descriptor *)&buffer;
 
 	if ((strncmp(pdsc->id, ISO_STANDARD_ID, 4)) == 0)
-		return 1;
+		return FSID_CD9660;
 
-	return 0;
+	return FSID_UNKNOWN;
 }
 
 char *
@@ -62,12 +64,11 @@ cd9660_volname(const char *dev)
 
 	pdsc = (struct iso_primary_descriptor *)&buffer;
 
-	if ((strncmp(pdsc->id, ISO_STANDARD_ID, 4)) != 0)
+	if (strncmp(pdsc->id, ISO_STANDARD_ID, 4) != 0 ||
+	    pdsc->volume_id[0] == '\0')
 		return NULL;
 
-	if (pdsc->volume_id[0] == '\0')
-		return NULL;
+	pdsc->volume_id[sizeof(pdsc->volume_id) - 1] = '\0';
 
-	pdsc->volume_id[30] = '\0';
 	return pdsc->volume_id;
 }
diff --git a/lib/libfsid/ext2.c b/lib/libfsid/ext2.c
index 6d485b5..26ce9fa 100644
--- a/lib/libfsid/ext2.c
+++ b/lib/libfsid/ext2.c
@@ -31,26 +31,28 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include "libfsid.h"
+
 #include <vfs/gnu/ext2fs/ext2_fs.h>
 #include <vfs/gnu/ext2fs/fs.h>
 
+#include "libfsid.h"
+
 static char buffer[sizeof(struct ext2_super_block)*2];
 
-int
+fsid_t
 ext2_probe(const char *dev)
 {
 	static struct ext2_super_block *fs;
 
 	if (fsid_dev_read(dev, SBOFF, sizeof(buffer), buffer) != 0)
-		return 0;
+		return FSID_UNKNOWN;
 
 	fs = (struct ext2_super_block *)&buffer;
 
 	if (fs->s_magic == EXT2_SUPER_MAGIC)
-		return 1;
+		return FSID_EXT2;
 
-	return 0;
+	return FSID_UNKNOWN;
 }
 
 char *
@@ -63,12 +65,10 @@ ext2_volname(const char *dev)
 
 	fs = (struct ext2_super_block *)&buffer;
 
-	if (fs->s_magic != EXT2_SUPER_MAGIC)
+	if (fs->s_magic != EXT2_SUPER_MAGIC || fs->s_volume_name[0] == '\0')
 		return NULL;
 
-	if (fs->s_volume_name[0] == '\0')
-		return NULL;
+	fs->s_volume_name[sizeof(fs->s_volume_name) - 1] = '\0';
 
-	fs->s_volume_name[15] = '\0';
-		return fs->s_volume_name;
+	return fs->s_volume_name;
 }
diff --git a/lib/libfsid/hammer.c b/lib/libfsid/hammer.c
index e35e3a8..672f176 100644
--- a/lib/libfsid/hammer.c
+++ b/lib/libfsid/hammer.c
@@ -31,26 +31,27 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #include "libfsid.h"
+
 #include <vfs/hammer/hammer_disk.h>
 
-static char buffer[16384];
+static char buffer[HAMMER_BUFSIZE];
 
-int
+fsid_t
 hammer_probe(const char *dev)
 {
 	static struct hammer_volume_ondisk *fs;
 
 	if (fsid_dev_read(dev, 0L, sizeof(buffer), buffer) != 0)
-		return 0;
+		return FSID_UNKNOWN;
 
 	fs = (struct hammer_volume_ondisk *)&buffer;
 
-	if (fs->vol_signature != HAMMER_FSBUF_VOLUME) {
-		return 0;
-	}
+	if (fs->vol_signature != HAMMER_FSBUF_VOLUME)
+		return FSID_UNKNOWN;
 
-	return 1;
+	return FSID_HAMMER;
 }
 
 char *
@@ -63,14 +64,12 @@ hammer_volname(const char *dev)
 
 	fs = (struct hammer_volume_ondisk *)&buffer;
 
-	if (fs->vol_signature != HAMMER_FSBUF_VOLUME) {
+	if (fs->vol_signature != HAMMER_FSBUF_VOLUME ||
+	    fs->vol_name[0] == '\0')
 		return NULL;
-	}
 
-	if (fs->vol_name[0] == '\0')
-		return NULL;
+	fs->vol_name[sizeof(fs->vol_name) - 1] = '\0';
 
-	fs->vol_name[63] = '\0';
 	return fs->vol_name;
 }
 
diff --git a/lib/libfsid/libfsid.3 b/lib/libfsid/libfsid.3
index 0afe95f..d631500 100644
--- a/lib/libfsid/libfsid.3
+++ b/lib/libfsid/libfsid.3
@@ -1,7 +1,7 @@
 .\" Copyright (c) 2010 The DragonFly Project.  All rights reserved.
 .\" 
 .\" This code is derived from software contributed to The DragonFly Project
-.\" by Ákos Kovács <akoskovacs@gmx.com>
+.\" by Akos Kovacs <akoskovacs@gmx.com>
 .\" 
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -38,91 +38,132 @@
 .Nm fsid_probe_all ,
 .Nm fsid_volname ,
 .Nm fsid_volname_all ,
-.Nm fsid_fsname
+.Nm fsid_fsname ,
 .Nm fsid_fs_count
 .Nd general libfsid functions
 .Sh LIBRARY
-A simple interface for filesystem recognising.
-Programs should be linked with
-.Fl lfsid .
+.Lb libfsid
 .Sh SYNOPSIS
 .In libfsid.h
-.Ft int
-.Fn fsid_probe "const char *dev" "const char *fs_type"
-.Ft int
+.Ft fsid_t
+.Fn fsid_probe "const char *dev" "const char *fs_name"
+.Ft fsid_t
 .Fn fsid_probe_all "const char *dev"
 .Ft char *
-.Fn fsid_volname "const char *dev" "const char *fs_type"
+.Fn fsid_volname "const char *dev" "const char *fs_name"
 .Ft char *
 .Fn fsid_volname_all "const char *dev"
 .Ft char *
-.Fn fsid_fsname "int id"
+.Fn fsid_fsname "fsid_t id"
 .Ft int
 .Fn fsid_fs_count "void"
 .Sh DESCRIPTION
-.Pp
 .\" General description
-The 
+The
 .Lb libfsid
 provides an interface to determine several filesystems
 and to get their volume labels.
 .Pp
-Big part of the functions use the first parameter
+Most functions use the parameter
 .Fa dev
-as the full path of the device, some of them has additionally an
-.Fa fs_type
-parameter wich is the name of the choosen filesystem. It can be:
-.Pp
-.Bd -literal -offset indent -compact
-HAMMER		HAMMER
-UFS		UFS
-CD9660		ISO 9660
-EXT2		Extended 2
-MSDOSFS		FAT32, FAT16
-.Ed
-.Pp
+for specifying the full path of the device and some of them have an additional
+.Fa fs_name
+parameter wich is the name of the chosen filesystem.
+It can be:
+.Bl -tag -width ".Li MSDOSFS" -offset indent
+.It Li HAMMER
+A
+.Xr HAMMER 5
+filesystem
+.It Li UFS
+A
+.Xr UFS 5
+filesystem
+.It Li CD9660
+An ISO 9660 filesystem
+.It Li EXT2
+Linux' second extended filesystem
+.It Li MSDOSFS
+An
+.Xr msdos 5
+filesystem
+.El
 .Pp
 .\" fsid_probe function
 The
 .Fn fsid_probe
-returns 1 if the device has the filesystem type as expected by the
-.Fa fs_type
-parameter, otherwise 0.
+function returns one of
+.Dv FSID_CD9660 ,
+.Dv FSID_EXT2 ,
+.Dv FSID_HAMMER
+or
+.Dv FSID_UFS
+if the device has the filesystem type as expected by the
+.Fa fs_name
+parameter, otherwise
+.Dv FSID_UNKNOWN .
 .Pp
 .\" fsid_probe_all function
+The
 .Fn fsid_probe_all
-function try to identify the filesystem type, it returns 0 if the filesystem unknown, or the check fails. Otherwise the returned value is one of this macros:
-.Pp
-.Bd -literal -offset indent -compact
-FSID_HAMMER	HAMMER
-FSID_UFS	UFS
-FSID_CD9660	ISO 9660
-FSID_EXT2	Extended 2
-FSID_MSDOSFS	FAT32, FAT16
-.Ed
+function tries to identify the filesystem type.
+It returns
+.Dv FSID_UNKNOWN
+if the filesystem is unknown, or the check fails.
+Otherwise the returned value is one of:
+.Bl -tag -width ".Dv FSID_MSDOSFS" -offset indent
+.It Dv FSID_HAMMER
+A
+.Xr HAMMER 5
+filesystem
+.It Dv FSID_UFS
+A
+.Xr UFS 5
+filesystem
+.It Dv FSID_CD9660
+An ISO 9660 filesystem
+.It Dv FSID_EXT2
+Linux' second extended filesystem
+.It Dv FSID_MSDOSFS
+An
+.Xr msdos 5
+filesystem
+.El
 .Pp
-The name of the filesystem can easily queried with the
-.Fn fsid_fsname .
+The name of the filesystem can be easily queried with the
+.Fn fsid_fsname
+function.
 .Pp
+The
 .Fn fsid_volname
-function returns with the volume label, if the filesystem is the same as the
-.Fa fs_type ,
-if not just returns with 
+function returns the volume label, if the filesystem name is the same
+as specified by
+.Fa fs_name .
+If not, it returns
 .Dv NULL .
 .Pp
+The
 .Fn fsid_volname_all
-give back the volume label, if the filesystem known otherwise returns with
+function returns the volume label, if the filesystem is known.
+Otherwise it returns
 .Dv NULL .
 .Pp
+The
 .Fn fsid_fsname
-give back the name of the filesystem as a pointer to string. The
+function returns the name of the filesystem as a pointer to string.
+The
 .Fa id
-is mostly the return value of the
-.Fn fsid_probe_all .
+is usually the return value of a
+.Fn fsid_probe_all
+call.
 .Pp
+The
 .Fn fsid_fs_count
-return with a number of supported filesystems.
-.Sh AUTHOR
-The library and the manual page wrote by Ákos Kovács <akoskovacs@gmx.com>.
+function returns the number of supported filesystems.
 .Sh SEE ALSO
-.Xr devattr 3 
+.Xr devattr 3
+.Sh AUTHOR
+.An -nosplit
+The library and the manual page were written by
+.An Akos Kovacs
+.Aq akoskovacs@gmx.com .
diff --git a/lib/libfsid/libfsid.c b/lib/libfsid/libfsid.c
index 868246a..9858565 100644
--- a/lib/libfsid/libfsid.c
+++ b/lib/libfsid/libfsid.c
@@ -31,11 +31,14 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include "libfsid.h"
+
 #include <sys/stat.h>
+
 #include <errno.h>
 
-struct fs_type fs_types[] = {
+#include "libfsid.h"
+
+static struct fs_type fs_types[] = {
     { "HAMMER", hammer_probe,	hammer_volname	},
     { "UFS",	ufs_probe,	ufs_volname	},
     { "CD9660",	cd9660_probe,	cd9660_volname	},
@@ -45,7 +48,7 @@ struct fs_type fs_types[] = {
 };
 
 const char *
-fsid_fsname(int id)
+fsid_fsname(fsid_t id)
 {
 	if (id < 1)
 		return 0;
@@ -57,44 +60,49 @@ int
 fsid_fs_count(void)
 {
 	int count;
+
 	for (count = 0; fs_types[count].fs_name != NULL; count++)
-		;
+		;	/* nothing */
 
 	return count;
 }
 
-int
+fsid_t
 fsid_probe(const char *dev, const char *fs_type)
 {
 	int i;
+
 	if (dev == NULL || fs_type == NULL)
-		return 0;
+		return FSID_UNKNOWN;
 
 	for (i = 0; fs_types[i].fs_name != NULL; i++)  {
 		if ((strcmp(fs_type, fs_types[i].fs_name)) == 0)
 			return fs_types[i].fs_probe(dev);
 	}
-	return 0;
+	return FSID_UNKNOWN;
 }
 
-int
+fsid_t
 fsid_probe_all(const char *dev)
 {
 	int i;
+	fsid_t ret;
+
 	if (dev == NULL)
-		return 0;
+		return FSID_UNKNOWN;
 
 	for (i = 0; fs_types[i].fs_name != NULL; i++) {
-		if ((fs_types[i].fs_probe(dev)) == 1)
-			return i + 1;
+		if ((ret = fs_types[i].fs_probe(dev)) != FSID_UNKNOWN)
+			return ret;
 	}
-	return 0;
+	return FSID_UNKNOWN;
 }
 
 char *
 fsid_volname(const char *dev, const char *fs_type)
 {
 	int i;
+
 	if (dev == NULL || fs_type == NULL)
 		return NULL;
 
@@ -110,6 +118,7 @@ char *
 fsid_volname_all(const char *dev)
 {
 	int fs_id;
+
 	if (dev == NULL)
 		return NULL;
 
diff --git a/lib/libfsid/libfsid.h b/lib/libfsid/libfsid.h
index 14b8ec0..369d05f 100644
--- a/lib/libfsid/libfsid.h
+++ b/lib/libfsid/libfsid.h
@@ -31,29 +31,34 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #ifndef LIBFSID_H
 #define LIBFSID_H
 
 #include <sys/types.h>
 #include <sys/uio.h>
-#include <stdlib.h>
-#include <stdio.h>
+
 #include <err.h>
 #include <fcntl.h>
-#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
-#define FSID_HAMMER     0x01
-#define FSID_UFS        0x02
-#define FSID_CD9660     0x03
-#define FSID_EXT2       0x04
-#define FSID_MSDOSFS    0x05
+typedef enum {
+	FSID_UNKNOWN,
+	FSID_HAMMER,
+	FSID_UFS,
+	FSID_CD9660,
+	FSID_EXT2,
+	FSID_MSDOSFS
+} fsid_t;
 
-typedef int (probe_func_t)(const char *);
+typedef fsid_t (probe_func_t)(const char *);
 typedef char *(volname_func_t)(const char *);
 
 struct fs_type {
-	const char *fs_name;
+	const char	*fs_name;
 	probe_func_t	*fs_probe;
 	volname_func_t	*fs_volname;
 };
@@ -70,18 +75,18 @@ volname_func_t cd9660_volname;
 volname_func_t ext2_volname;
 volname_func_t msdosfs_volname;
 
-int fsid_probe(const char *dev, const char *fs_type);
-int fsid_probe_all(const char *dev);
+fsid_t fsid_probe(const char *dev, const char *fs_name);
+fsid_t fsid_probe_all(const char *dev);
 
-char *fsid_volname(const char *dev, const char *fs_type);
+char *fsid_volname(const char *dev, const char *fs_name);
 char *fsid_volname_all(const char *dev);
 
 /* Extra functions */
-const char *fsid_fsname(int);
+const char *fsid_fsname(fsid_t);
 int fsid_fs_count(void);
 
-
 #ifdef _FSID_INTERNAL
 int fsid_dev_read(const char *dev, off_t off, size_t len, char *buf);
 #endif
+
 #endif /* LIBFSID_H */
diff --git a/lib/libfsid/msdosfs.c b/lib/libfsid/msdosfs.c
index fbcd89d..65d8107 100644
--- a/lib/libfsid/msdosfs.c
+++ b/lib/libfsid/msdosfs.c
@@ -32,24 +32,26 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #include "libfsid.h"
+
 #include <vfs/msdosfs/bootsect.h>
 
 #define MSDOS_BOOT_BLOCK_SIZE 512
 
-static char buffer[MSDOS_BOOT_BLOCK_SIZE * 4];
 static char *get_volname(char *buf);
+static char buffer[MSDOS_BOOT_BLOCK_SIZE * 4];
 
-int
+fsid_t
 msdosfs_probe(const char *dev)
 {
 	if (fsid_dev_read(dev, 0L, sizeof(buffer), buffer) != 0)
-		return 0;
+		return FSID_UNKNOWN;
 
 	if (get_volname(buffer) != NULL)
-		return 1;
-	else
-		return 0;
+		return FSID_MSDOSFS;
+
+	return FSID_MSDOSFS;
 }
 char *
 msdosfs_volname(const char *dev)
@@ -60,13 +62,12 @@ msdosfs_volname(const char *dev)
 		return NULL;
 
 	volname = get_volname(buffer);
-	if (volname == NULL)
-		return NULL;
 
-	if (volname[0] == '\0')
+	if (volname == NULL || volname[0] == '\0')
 		return NULL;
 
-	volname[10] = '\0';
+	volname[sizeof(volname) - 1] = '\0';
+
 	return volname;
 }
 
@@ -97,7 +98,8 @@ get_volname(char *buff)
 	 * If this is not a BPB v7, try it as a bpb v4.
 	 */
 	extb = (struct extboot *)bpb4->bsExt;
-	if ((extb->exBootSignature == 0x28 || extb->exBootSignature == 0x29) &&
+	if ((extb->exBootSignature == EXBOOTSIG ||
+	     extb->exBootSignature == EXBOOTSIG2) &&
 	    strncmp(extb->exFileSysType, "FAT", 3) == 0)
 		return extb->exVolumeLabel;
 
diff --git a/lib/libfsid/ufs.c b/lib/libfsid/ufs.c
index e052775..f83f8fc 100644
--- a/lib/libfsid/ufs.c
+++ b/lib/libfsid/ufs.c
@@ -31,28 +31,30 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #include "libfsid.h"
+
 #include <vfs/ufs/ufs_types.h>
 #include <vfs/ufs/fs.h>
 
 static char buffer[MAXBSIZE];
 
-int
+fsid_t
 ufs_probe(const char *dev)
 {
 	static struct fs *fs;
 
 	if(fsid_dev_read(dev, SBOFF, sizeof(buffer), buffer) != 0)
-		return 0;
+		return FSID_UNKNOWN;
 
 	fs = (struct fs *)&buffer;
 
 	if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE ||
 		(unsigned)fs->fs_bsize < sizeof(struct fs)) {
-		return 0;
+		return FSID_UNKNOWN;
 	}
 
-	return 1;
+	return FSID_UFS;
 }
 
 char *
@@ -66,14 +68,13 @@ ufs_volname(const char *dev)
 	fs = (struct fs *)&buffer;
 
 	if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE ||
-		(unsigned)fs->fs_bsize < sizeof(struct fs)) {
+	    (unsigned)fs->fs_bsize < sizeof(struct fs) ||
+	    fs->fs_volname[0] == '\0') {
 		return NULL;
 	}
 
-	if (fs->fs_volname[0] == '\0')
-		return NULL;
-
 	fs->fs_volname[MAXVOLLEN - 1] = '\0';
+
 	return fs->fs_volname;
 }
 
diff --git a/sys/vfs/msdosfs/bootsect.h b/sys/vfs/msdosfs/bootsect.h
index acc51f6..70dcea5 100644
--- a/sys/vfs/msdosfs/bootsect.h
+++ b/sys/vfs/msdosfs/bootsect.h
@@ -40,6 +40,7 @@ struct extboot {
 	int8_t		exReserved1;		/* reserved */
 	int8_t		exBootSignature;	/* ext. boot signature (0x29) */
 #define	EXBOOTSIG	0x29
+#define	EXBOOTSIG2	0x28
 	int8_t		exVolumeID[4];		/* volume ID number */
 	int8_t		exVolumeLabel[11];	/* volume label */
 	int8_t		exFileSysType[8];	/* fs type (FAT12 or FAT16) */
