From: visa Date: Mon, 20 Aug 2018 14:59:02 +0000 (+0000) Subject: Make fnew() return a new file with only one reference. This makes X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5b75427a810b4513a43989a98c8723ba39d8cabf;p=openbsd Make fnew() return a new file with only one reference. This makes the API more logical. OK kettenis@ mpi@ --- diff --git a/sys/dev/diskmap.c b/sys/dev/diskmap.c index bd7509c4284..33a533f0a19 100644 --- a/sys/dev/diskmap.c +++ b/sys/dev/diskmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diskmap.c,v 1.23 2018/08/05 14:23:57 beck Exp $ */ +/* $OpenBSD: diskmap.c,v 1.24 2018/08/20 14:59:02 visa Exp $ */ /* * Copyright (c) 2009, 2010 Joel Sing @@ -127,7 +127,6 @@ diskmapioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) fp->f_data = (caddr_t)vp; fdinsert(fdp, fd, flags, fp); fdpunlock(fdp); - FRELE(fp, p); closef(fp0, p); free(devname, M_DEVBUF, PATH_MAX); diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c index 667e64afee0..18ae95f3c18 100644 --- a/sys/dev/pci/drm/drm_linux.c +++ b/sys/dev/pci/drm/drm_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.c,v 1.28 2018/08/15 13:19:06 visa Exp $ */ +/* $OpenBSD: drm_linux.c,v 1.29 2018/08/20 14:59:02 visa Exp $ */ /* * Copyright (c) 2013 Jonathan Gray * Copyright (c) 2015, 2016 Mark Kettenis @@ -914,7 +914,6 @@ dma_buf_export(const struct dma_buf_export_info *info) dmabuf->size = info->size; dmabuf->file = fp; fp->f_data = dmabuf; - FRELE(fp, p); return dmabuf; } diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 0cdeb5a8a5d..f8a0c09e174 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.179 2018/08/19 02:22:40 visa Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.180 2018/08/20 14:59:02 visa Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -1002,6 +1002,7 @@ restart: return (ENFILE); } + FREF(fp); *resultfp = fp; *resultfd = i; @@ -1031,8 +1032,6 @@ fnew(struct proc *p) fp->f_cred = p->p_ucred; crhold(fp->f_cred); - FREF(fp); - return (fp); }