diff options
author | julian <julian@FreeBSD.org> | 1995-10-04 11:05:09 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1995-10-04 11:05:09 +0000 |
commit | 368d81d28d3e18b2f5282f7c98bd6c83a61c1d4d (patch) | |
tree | bc9161bd15d9dab764dcd567d5089c734d6efdbb | |
parent | 61393d63ff8b556f627e4b656d430ca8470bdd0c (diff) | |
download | FreeBSD-src-368d81d28d3e18b2f5282f7c98bd6c83a61c1d4d.zip FreeBSD-src-368d81d28d3e18b2f5282f7c98bd6c83a61c1d4d.tar.gz |
find some way of letting a node know where in its parent's directory structure
it was referenced from.. stops a rather annoying panic, but
introduces a rather interesting but "I can live with it" bug
`ln a b ; mv a b; echo ?`
returns a rather than b..
I know why but I need to think of the 'correct' answer. at least this is 'safe'
-rw-r--r-- | sys/miscfs/devfs/devfs_vnops.c | 17 | ||||
-rw-r--r-- | sys/miscfs/devfs/devfsdefs.h | 5 |
2 files changed, 13 insertions, 9 deletions
diff --git a/sys/miscfs/devfs/devfs_vnops.c b/sys/miscfs/devfs/devfs_vnops.c index 1eb60bc..9b4a84f 100644 --- a/sys/miscfs/devfs/devfs_vnops.c +++ b/sys/miscfs/devfs/devfs_vnops.c @@ -1,7 +1,7 @@ /* * Written by Julian Elischer (julian@DIALix.oz.au) * - * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.12 1995/09/09 12:51:56 julian Exp $ + * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.13 1995/09/19 07:32:01 julian Exp $ * * symlinks can wait 'til later. */ @@ -180,6 +180,7 @@ DBPRINT(("errr, maybe not cached ")); if(new_nodename) { new_node = new_nodename->dnp; + new_node->last_lookup = new_nodename; /* for unlink */ goto found; } new_node = NULL; /* to be safe */ @@ -843,8 +844,10 @@ abortit: return (error); } if ( error = devfs_vntodn(vp,&tp)) goto abortit; - tnp = dev_findname(tdp,cnp->cn_nameptr); - if(!tnp) panic("devfs_rename: target dissapeared"); + /* + * Assuming we are atomic, dev_lookup left this for us + */ + tnp = tp->last_lookup; /* @@ -1045,12 +1048,10 @@ int devfs_rename(struct vop_rename_args *ap) /*proto*/ if ( error = devfs_vntodn(tdvp,&tdp)) goto abortit; if ( error = devfs_vntodn(fdvp,&fdp)) goto abortit; if ( error = devfs_vntodn(fvp,&fp)) goto abortit; - fnp = dev_findname(fdp,fcnp->cn_nameptr); - if(!fnp) panic("devfs_rename: source dissapeared"); + fnp = fp->last_lookup; if (tvp) { if ( error = devfs_vntodn(tvp,&tp)) goto abortit; - tnp = dev_findname(tdp,tcnp->cn_nameptr); - if(!tnp) panic("devfs_rename: target dissapeared"); + tnp = tp->last_lookup; } else { tp = NULL; tnp = NULL; @@ -1388,6 +1389,8 @@ int devfs_abortop(struct vop_abortop_args *ap) /*proto*/ } */ { DBPRINT(("abortop\n")); + if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF) + FREE(ap->a_cnp->cn_pnbuf, M_NAMEI); return 0; } diff --git a/sys/miscfs/devfs/devfsdefs.h b/sys/miscfs/devfs/devfsdefs.h index 1cbbdd7..6973a98 100644 --- a/sys/miscfs/devfs/devfsdefs.h +++ b/sys/miscfs/devfs/devfsdefs.h @@ -7,7 +7,7 @@ /* * Written by Julian Elischer (julian@DIALIX.oz.au) * - * $Header: /home/ncvs/src/sys/miscfs/devfs/devfsdefs.h,v 1.5 1995/09/06 09:29:19 julian Exp $ + * $Header: /home/ncvs/src/sys/miscfs/devfs/devfsdefs.h,v 1.6 1995/09/06 23:15:55 julian Exp $ */ /* first a couple of defines for compatibility with inodes */ @@ -90,6 +90,7 @@ struct devnode /* the equivalent of an INODE */ u_long vn_id; /* make sure we have the right vnode */ int (***ops)(void *); /* yuk... pointer to pointer(s) to funcs */ int len; /* of any associated info (e.g. dir data) */ + devnm_p last_lookup; /* name I was last looked up from */ union typeinfo { struct { struct cdevsw *cdevsw; @@ -107,7 +108,7 @@ struct devnode /* the equivalent of an INODE */ devnm_p dirlist; devnm_p *dirlast; dn_p parent; - devnm_p myname; + devnm_p myname; /* my entry in .. */ int entrycount; }Dir; struct { |