Date: Fri, 31 Oct 2014 09:16:00 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273893 - head/sys/kern Message-ID: <201410310916.s9V9G0VT001505@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Fri Oct 31 09:15:59 2014 New Revision: 273893 URL: https://svnweb.freebsd.org/changeset/base/273893 Log: filedesc: tidy up fdfree Implement fdefree_last variant and get rid of 'last' parameter. No functional changes. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Oct 31 08:14:13 2014 (r273892) +++ head/sys/kern/kern_descrip.c Fri Oct 31 09:15:59 2014 (r273893) @@ -291,18 +291,22 @@ fdunused(struct filedesc *fdp, int fd) * Avoid some work if fdp is about to be destroyed. */ static inline void -_fdfree(struct filedesc *fdp, int fd, int last) +fdefree_last(struct filedescent *fde) +{ + + filecaps_free(&fde->fde_caps); +} + +static inline void +fdfree(struct filedesc *fdp, int fd) { struct filedescent *fde; fde = &fdp->fd_ofiles[fd]; #ifdef CAPABILITIES - if (!last) - seq_write_begin(&fde->fde_seq); + seq_write_begin(&fde->fde_seq); #endif - filecaps_free(&fde->fde_caps); - if (last) - return; + fdefree_last(fde); bzero(fde, fde_change_size); fdunused(fdp, fd); #ifdef CAPABILITIES @@ -310,20 +314,6 @@ _fdfree(struct filedesc *fdp, int fd, in #endif } -static inline void -fdfree(struct filedesc *fdp, int fd) -{ - - _fdfree(fdp, fd, 0); -} - -static inline void -fdfree_last(struct filedesc *fdp, int fd) -{ - - _fdfree(fdp, fd, 1); -} - /* * System calls on descriptors. */ @@ -1956,6 +1946,7 @@ fdescfree(struct thread *td) struct filedesc *fdp; int i; struct filedesc_to_leader *fdtol; + struct filedescent *fde; struct file *fp; struct vnode *cdir, *jdir, *rdir, *vp; struct flock lf; @@ -2055,9 +2046,10 @@ fdescfree(struct thread *td) FILEDESC_XUNLOCK(fdp); for (i = 0; i <= fdp->fd_lastfile; i++) { - fp = fdp->fd_ofiles[i].fde_file; + fde = &fdp->fd_ofiles[i]; + fp = fde->fde_file; if (fp != NULL) { - fdfree_last(fdp, i); + fdefree_last(fde); (void) closef(fp, td); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410310916.s9V9G0VT001505>