diff options
author | phk <phk@FreeBSD.org> | 2002-10-16 07:51:18 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-10-16 07:51:18 +0000 |
commit | 04dca80dba70e820a49974d1cb00b356c315aaff (patch) | |
tree | 356a601cfcdb4af14144d3044ee9bfcba387991e /sys | |
parent | bb72fa916d6b7f3e89ab4aa5020a2f938867b964 (diff) | |
download | FreeBSD-src-04dca80dba70e820a49974d1cb00b356c315aaff.zip FreeBSD-src-04dca80dba70e820a49974d1cb00b356c315aaff.tar.gz |
A better solution to avoiding variable sized structs in DEVFS.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/fs/devfs/devfs.h | 4 | ||||
-rw-r--r-- | sys/fs/devfs/devfs_vfsops.c | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/fs/devfs/devfs.h b/sys/fs/devfs/devfs.h index 0d34c97..610417c 100644 --- a/sys/fs/devfs/devfs.h +++ b/sys/fs/devfs/devfs.h @@ -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; diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c index 9b2e174..5f4d855 100644 --- a/sys/fs/devfs/devfs_vfsops.c +++ b/sys/fs/devfs/devfs_vfsops.c @@ -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; } |