From: Ben Gras Date: Tue, 20 Jan 2009 13:43:00 +0000 (+0000) Subject: mostly harmless sanity checks. X-Git-Tag: v3.1.4~131 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/nslookup.html?a=commitdiff_plain;h=45ec30f6af1f8a3d568d1711aac52ffe9ed87383;p=minix.git mostly harmless sanity checks. --- diff --git a/servers/vfs/mount.c b/servers/vfs/mount.c index 7448fa3cd..b36df80f1 100644 --- a/servers/vfs/mount.c +++ b/servers/vfs/mount.c @@ -71,6 +71,8 @@ PUBLIC int do_mount() { endpoint_t fs_e; + CHECK_VREFS; + /* Only the super-user may do MOUNT. */ if (!super_user) return(EPERM); @@ -104,6 +106,8 @@ PRIVATE int mount_fs(endpoint_t fs_e) struct vmnt *vmp, *vmp2; char *label; struct node_details res; + + CHECK_VREFS; /* Only the super-user may do MOUNT. */ if (!super_user) return(EPERM); @@ -339,6 +343,7 @@ PRIVATE int mount_fs(endpoint_t fs_e) tfp->fp_wd = root_node; } + CHECK_VREFS; return(OK); } @@ -372,6 +377,7 @@ PRIVATE int mount_fs(endpoint_t fs_e) printf("VFSmount: moving opened block spec to new FS_e: %d...\n", fs_e); bspec->v_bfs_e = fs_e; } + CHECK_VREFS; return(OK); } @@ -405,6 +411,8 @@ Dev_t dev; struct dmap *dp; int count, r; int fs_e; + + CHECK_VREFS; /* Find vmnt */ for (vmp_i = &vmnt[0]; vmp_i < &vmnt[NR_MNTS]; ++vmp_i) { @@ -504,6 +512,7 @@ Dev_t dev; vmp->m_dev = NO_DEV; vmp->m_fs_e = NONE; vmp->m_driver_e = NONE; + CHECK_VREFS; return(OK); } diff --git a/servers/vfs/proto.h b/servers/vfs/proto.h index abd92dd55..70454dd4f 100644 --- a/servers/vfs/proto.h +++ b/servers/vfs/proto.h @@ -254,11 +254,10 @@ _PROTOTYPE( void vnode_clean_refs, (struct vnode *vp) ); #if 0 _PROTOTYPE( struct vnode *get_vnode, (int fs_e, int inode_nr) ); _PROTOTYPE( struct vnode *get_vnode_x, (int fs_e, int inode_nr) ); -#endif -#if 0 _PROTOTYPE( void mark_vn, (struct vnode *vp, char *file, int line) ); -_PROTOTYPE( int check_vrefs, (void) ); #endif +#define CHECK_VREFS do { if(!check_vrefs()) panic("VFS", "check_vrefs failed", NO_NUM);} while(0) +_PROTOTYPE( int check_vrefs, (void) ); /* write.c */ _PROTOTYPE( int do_write, (void) );