Drop ffree() as a separate function and incorporate the only place used.
This commit is contained in:
parent
20ddb405f8
commit
355be4eeda
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138311
@ -1370,22 +1370,6 @@ falloc(struct thread *td, struct file **resultfp, int *resultfd)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free a file descriptor.
|
||||
*/
|
||||
void
|
||||
ffree(struct file *fp)
|
||||
{
|
||||
|
||||
KASSERT(fp->f_count == 0, ("ffree: fp_fcount not 0!"));
|
||||
sx_xlock(&filelist_lock);
|
||||
LIST_REMOVE(fp, f_list);
|
||||
openfiles--;
|
||||
sx_xunlock(&filelist_lock);
|
||||
crfree(fp->f_cred);
|
||||
uma_zfree(file_zone, fp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a new filedesc structure from another.
|
||||
* Copy the current, root, and jail root vnode references.
|
||||
@ -2089,7 +2073,14 @@ fdrop_locked(struct file *fp, struct thread *td)
|
||||
error = fo_close(fp, td);
|
||||
else
|
||||
error = 0;
|
||||
ffree(fp);
|
||||
|
||||
sx_xlock(&filelist_lock);
|
||||
LIST_REMOVE(fp, f_list);
|
||||
openfiles--;
|
||||
sx_xunlock(&filelist_lock);
|
||||
crfree(fp->f_cred);
|
||||
uma_zfree(file_zone, fp);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,6 @@ void fdfree(struct thread *td);
|
||||
struct filedesc *fdinit(struct filedesc *fdp);
|
||||
struct filedesc *fdshare(struct filedesc *fdp);
|
||||
void fdused(struct filedesc *fdp, int fd);
|
||||
void ffree(struct file *fp);
|
||||
struct filedesc_to_leader *
|
||||
filedesc_to_leader_alloc(struct filedesc_to_leader *old,
|
||||
struct filedesc *fdp, struct proc *leader);
|
||||
|
Loading…
Reference in New Issue
Block a user