diff --git a/sbin/geom/class/label/glabel.8 b/sbin/geom/class/label/glabel.8 index 707919fabb5d..f607c7b251fc 100644 --- a/sbin/geom/class/label/glabel.8 +++ b/sbin/geom/class/label/glabel.8 @@ -102,6 +102,12 @@ MSDOSFS (FAT12, FAT16, FAT32) (directory .It CD ISO9660 (directory .Pa /dev/iso9660/ ) . +.It +EXT2FS (directory +.Pa /dev/ext2fs/ ) . +.It +REISERFS (directory +.Pa /dev/reiserfs/ ) . .El .Pp Non file-system labels are created in the directory diff --git a/sys/conf/files b/sys/conf/files index 07940bd05607..eb1ecb30c810 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1055,8 +1055,10 @@ geom/geom_sunlabel_enc.c optional geom_sunlabel geom/geom_vfs.c standard geom/geom_vol_ffs.c optional geom_vol geom/label/g_label.c optional geom_label +geom/label/g_label_ext2fs.c optional geom_label geom/label/g_label_iso9660.c optional geom_label geom/label/g_label_msdosfs.c optional geom_label +geom/label/g_label_reiserfs.c optional geom_label geom/label/g_label_ufs.c optional geom_label geom/mirror/g_mirror.c optional geom_mirror geom/mirror/g_mirror_ctl.c optional geom_mirror diff --git a/sys/geom/label/g_label.c b/sys/geom/label/g_label.c index c8908c02c65e..1f49d0b65eb3 100644 --- a/sys/geom/label/g_label.c +++ b/sys/geom/label/g_label.c @@ -67,14 +67,20 @@ struct g_class g_label_class = { /* * To add a new file system where you want to look for volume labels, * you have to: - * 1. Add a file which implements looking for volume labels. - * 2. Add an 'extern const struct g_label_desc g_label_;'. - * 3. Add an element to the table below '&g_label_,'. + * 1. Add a file g_label_.c which implements labels recognition. + * 2. Add an 'extern const struct g_label_desc g_label_;' into + * g_label.h file. + * 3. Add an element to the table below '&g_label_,'. + * 4. Add your file to sys/conf/files. + * 5. Add your file to sys/modules/geom/geom_label/Makefile. + * 6. Add your file system to manual page sbin/geom/class/label/glabel.8. */ const struct g_label_desc *g_labels[] = { &g_label_ufs, &g_label_iso9660, &g_label_msdosfs, + &g_label_ext2fs, + &g_label_reiserfs, NULL }; @@ -257,12 +263,20 @@ g_label_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) } while (0); for (i = 0; g_labels[i] != NULL; i++) { char label[64]; + char *p; g_topology_unlock(); g_labels[i]->ld_taste(cp, label, sizeof(label)); g_topology_lock(); if (label[0] == '\0') continue; + /* + * Don't allow / in labels. + */ + for (p = label; *p != '\0'; p++) { + if (*p == '/') + *p = '_'; + } g_label_create(NULL, mp, pp, label, g_labels[i]->ld_dir, pp->mediasize); } diff --git a/sys/geom/label/g_label.h b/sys/geom/label/g_label.h index 2d17bbcdaa01..814483819b9f 100644 --- a/sys/geom/label/g_label.h +++ b/sys/geom/label/g_label.h @@ -67,6 +67,8 @@ struct g_label_desc { extern const struct g_label_desc g_label_ufs; extern const struct g_label_desc g_label_iso9660; extern const struct g_label_desc g_label_msdosfs; +extern const struct g_label_desc g_label_ext2fs; +extern const struct g_label_desc g_label_reiserfs; #endif /* _KERNEL */ struct g_label_metadata { diff --git a/sys/modules/geom/geom_label/Makefile b/sys/modules/geom/geom_label/Makefile index 839a48ef17fb..435dc1170c02 100644 --- a/sys/modules/geom/geom_label/Makefile +++ b/sys/modules/geom/geom_label/Makefile @@ -4,8 +4,10 @@ KMOD= geom_label SRCS= g_label.c +SRCS+= g_label_ext2fs.c SRCS+= g_label_iso9660.c SRCS+= g_label_msdosfs.c +SRCS+= g_label_reiserfs.c SRCS+= g_label_ufs.c .include