Date: Tue, 28 Jul 2015 16:39:37 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285963 - stable/10/sys/kern Message-ID: <201507281639.t6SGdbgl008743@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Jul 28 16:39:36 2015 New Revision: 285963 URL: https://svnweb.freebsd.org/changeset/base/285963 Log: MFC r285134 (by mjg): fd: de-k&r-ify functions + some whitespace fixes MFC r285269: Handle copyout for the fcntl(F_OGETLK) using oflock structure. Modified: stable/10/sys/kern/kern_descrip.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_descrip.c ============================================================================== --- stable/10/sys/kern/kern_descrip.c Tue Jul 28 15:05:19 2015 (r285962) +++ stable/10/sys/kern/kern_descrip.c Tue Jul 28 16:39:36 2015 (r285963) @@ -418,9 +418,10 @@ kern_fcntl_freebsd(struct thread *td, in struct flock fl; struct __oflock ofl; intptr_t arg1; - int error; + int error, newcmd; error = 0; + newcmd = cmd; switch (cmd) { case F_OGETLK: case F_OSETLK: @@ -438,31 +439,31 @@ kern_fcntl_freebsd(struct thread *td, in switch (cmd) { case F_OGETLK: - cmd = F_GETLK; - break; + newcmd = F_GETLK; + break; case F_OSETLK: - cmd = F_SETLK; - break; + newcmd = F_SETLK; + break; case F_OSETLKW: - cmd = F_SETLKW; - break; + newcmd = F_SETLKW; + break; } arg1 = (intptr_t)&fl; break; - case F_GETLK: - case F_SETLK: - case F_SETLKW: + case F_GETLK: + case F_SETLK: + case F_SETLKW: case F_SETLK_REMOTE: - error = copyin((void *)(intptr_t)arg, &fl, sizeof(fl)); - arg1 = (intptr_t)&fl; - break; + error = copyin((void *)(intptr_t)arg, &fl, sizeof(fl)); + arg1 = (intptr_t)&fl; + break; default: arg1 = arg; break; } if (error) return (error); - error = kern_fcntl(td, fd, cmd, arg1); + error = kern_fcntl(td, fd, newcmd, arg1); if (error) return (error); if (cmd == F_OGETLK) { @@ -746,7 +747,7 @@ kern_fcntl(struct thread *td, int fd, in if ((flp->l_start > 0 && foffset > OFF_MAX - flp->l_start) || (flp->l_start < 0 && - foffset < OFF_MIN - flp->l_start)) { + foffset < OFF_MIN - flp->l_start)) { FILEDESC_SUNLOCK(fdp); error = EOVERFLOW; fdrop(fp, td); @@ -954,13 +955,13 @@ funsetown(struct sigio **sigiop) struct pgrp *pg = (sigio)->sio_pgrp; PGRP_LOCK(pg); SLIST_REMOVE(&sigio->sio_pgrp->pg_sigiolst, sigio, - sigio, sio_pgsigio); + sigio, sio_pgsigio); PGRP_UNLOCK(pg); } else { struct proc *p = (sigio)->sio_proc; PROC_LOCK(p); SLIST_REMOVE(&sigio->sio_proc->p_sigiolst, sigio, - sigio, sio_pgsigio); + sigio, sio_pgsigio); PROC_UNLOCK(p); } SIGIO_UNLOCK(); @@ -1214,18 +1215,14 @@ struct close_args { #endif /* ARGSUSED */ int -sys_close(td, uap) - struct thread *td; - struct close_args *uap; +sys_close(struct thread *td, struct close_args *uap) { return (kern_close(td, uap->fd)); } int -kern_close(td, fd) - struct thread *td; - int fd; +kern_close(struct thread *td, int fd) { struct filedesc *fdp; struct file *fp; @@ -2312,10 +2309,10 @@ closef(struct file *fp, struct thread *t fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); for (fdtol = fdtol->fdl_next; - fdtol != td->td_proc->p_fdtol; - fdtol = fdtol->fdl_next) { + fdtol != td->td_proc->p_fdtol; + fdtol = fdtol->fdl_next) { if ((fdtol->fdl_leader->p_flag & - P_ADVLOCK) == 0) + P_ADVLOCK) == 0) continue; fdtol->fdl_holdcount++; FILEDESC_XUNLOCK(fdp); @@ -2933,8 +2930,7 @@ filedesc_to_leader_alloc(struct filedesc struct filedesc_to_leader *fdtol; fdtol = malloc(sizeof(struct filedesc_to_leader), - M_FILEDESC_TO_LEADER, - M_WAITOK); + M_FILEDESC_TO_LEADER, M_WAITOK); fdtol->fdl_refcount = 1; fdtol->fdl_holdcount = 0; fdtol->fdl_wakeup = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507281639.t6SGdbgl008743>