- Add code for Ext2FS and ReiserFS labels recognition.
- Avoid creating directories in devfs by changing all '/' in labels to '_'.

Submitted by:	Stanislav Sedov <stas@310.ru>
PR:		kern/84638
Approved by:	re (kensmith)
This commit is contained in:
pjd 2005-08-16 08:20:48 +00:00
parent 79a6d8d816
commit ea84465e92
5 changed files with 29 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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_<your file system>;'.
* 3. Add an element to the table below '&g_label_<your_file_system>,'.
* 1. Add a file g_label_<file system>.c which implements labels recognition.
* 2. Add an 'extern const struct g_label_desc g_label_<file system>;' into
* g_label.h file.
* 3. Add an element to the table below '&g_label_<file system>,'.
* 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);
}

View File

@ -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 {

View File

@ -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 <bsd.kmod.mk>