1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

A better solution to avoiding variable sized structs in DEVFS.

This commit is contained in:
Poul-Henning Kamp 2002-10-16 07:51:18 +00:00
parent c122d758ca
commit 4cfe209335
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=105210
2 changed files with 5 additions and 3 deletions

View File

@ -39,8 +39,6 @@
#ifndef _FS_DEVFS_DEVFS_H_
#define _FS_DEVFS_DEVFS_H_
#include "opt_devfs.h"
#define DEVFS_MAGIC 0xdb0a087a
/*
@ -174,7 +172,7 @@ struct devfs_mount {
struct devfs_dirent *dm_rootdir;
struct devfs_dirent *dm_basedir;
unsigned dm_generation;
struct devfs_dirent *dm_dirent[NDEVFSINO];
struct devfs_dirent **dm_dirent;
struct devfs_dirent **dm_overflow;
int dm_inode;
struct lock dm_lock;

View File

@ -79,6 +79,9 @@ devfs_nmount(mp, ndp, td)
MALLOC(fmp, struct devfs_mount *, sizeof(struct devfs_mount),
M_DEVFS, M_WAITOK | M_ZERO);
MALLOC(fmp->dm_dirent, struct devfs_dirent **,
sizeof(struct devfs_dirent *) * NDEVFSINO,
M_DEVFS, M_WAITOK | M_ZERO);
lockinit(&fmp->dm_lock, PVFS, "devfs", 0, LK_NOPAUSE);
mp->mnt_flag |= MNT_LOCAL;
@ -133,6 +136,7 @@ devfs_unmount(mp, mntflags, td)
devfs_purge(fmp->dm_rootdir);
mp->mnt_data = 0;
lockdestroy(&fmp->dm_lock);
free(fmp->dm_dirent, M_DEVFS);
free(fmp, M_DEVFS);
return 0;
}