summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-06-22 14:14:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-06-22 14:14:12 +0000
commit0feae2b086084ce16940249793f7b5ecabe85c52 (patch)
tree98fa9664da9fd8be22e369584c568625bc15f799 /sys
parenta49f87d13c19deac6e87761b349d96038b3acdfc (diff)
KNF
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/exec_ecoff.c6
-rw-r--r--sys/kern/exec_elf.c50
-rw-r--r--sys/kern/exec_elf64.c62
-rw-r--r--sys/kern/exec_script.c24
-rw-r--r--sys/kern/exec_subr.c55
-rw-r--r--sys/kern/init_main.c19
-rw-r--r--sys/kern/kern_descrip.c48
-rw-r--r--sys/kern/kern_exec.c10
-rw-r--r--sys/kern/kern_ktrace.c12
-rw-r--r--sys/kern/kern_malloc.c33
-rw-r--r--sys/kern/kern_physio.c42
-rw-r--r--sys/kern/kern_prot.c20
-rw-r--r--sys/kern/kern_sig.c24
-rw-r--r--sys/kern/subr_extent.c13
-rw-r--r--sys/kern/subr_prf.c60
-rw-r--r--sys/kern/sysv_msg.c6
-rw-r--r--sys/kern/sysv_shm.c22
-rw-r--r--sys/kern/tty_subr.c6
-rw-r--r--sys/kern/uipc_socket.c136
-rw-r--r--sys/kern/uipc_socket2.c18
-rw-r--r--sys/kern/uipc_syscalls.c29
-rw-r--r--sys/kern/vfs_cluster.c42
-rw-r--r--sys/kern/vfs_default.c18
-rw-r--r--sys/kern/vfs_init.c7
-rw-r--r--sys/kern/vfs_lookup.c20
-rw-r--r--sys/kern/vfs_subr.c122
-rw-r--r--sys/kern/vfs_sync.c41
-rw-r--r--sys/kern/vfs_syscalls.c432
-rw-r--r--sys/kern/vfs_vnops.c6
29 files changed, 682 insertions, 701 deletions
diff --git a/sys/kern/exec_ecoff.c b/sys/kern/exec_ecoff.c
index cc560ddba38..8a9260b2e74 100644
--- a/sys/kern/exec_ecoff.c
+++ b/sys/kern/exec_ecoff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_ecoff.c,v 1.6 2000/08/31 14:49:06 ericj Exp $ */
+/* $OpenBSD: exec_ecoff.c,v 1.7 2001/06/22 14:14:07 deraadt Exp $ */
/* $NetBSD: exec_ecoff.c,v 1.8 1996/05/19 20:36:06 jonathan Exp $ */
/*
@@ -69,7 +69,7 @@ exec_ecoff_makecmds(p, epp)
if (ECOFF_BADMAG(execp))
return ENOEXEC;
-
+
switch (execp->a.magic) {
case ECOFF_OMAGIC:
error = exec_ecoff_prep_omagic(p, epp);
@@ -121,7 +121,7 @@ exec_ecoff_prep_omagic(p, epp)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, eap->bsize,
ECOFF_SEGMENT_ALIGN(execp, eap->bss_start), NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
-
+
return exec_setup_stack(p, epp);
}
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c
index 183ad02749a..2eb09508aca 100644
--- a/sys/kern/exec_elf.c
+++ b/sys/kern/exec_elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.c,v 1.31 2001/01/22 14:25:03 art Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.32 2001/06/22 14:14:07 deraadt Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@@ -169,7 +169,7 @@ elf_check_header(ehdr, type)
Elf32_Ehdr *ehdr;
int type;
{
- /*
+ /*
* We need to check magic, class size, endianess, and version before
* we look at the rest of the Elf32_Ehdr structure. These few elements
* are represented in a machine independant fashion.
@@ -178,14 +178,14 @@ elf_check_header(ehdr, type)
ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS ||
ehdr->e_ident[EI_DATA] != ELF_TARG_DATA ||
ehdr->e_ident[EI_VERSION] != ELF_TARG_VER)
- return (ENOEXEC);
-
- /* Now check the machine dependant header */
+ return (ENOEXEC);
+
+ /* Now check the machine dependant header */
if (ehdr->e_machine != ELF_TARG_MACH ||
ehdr->e_version != ELF_TARG_VER)
- return (ENOEXEC);
+ return (ENOEXEC);
- /* Check the type */
+ /* Check the type */
if (ehdr->e_type != type)
return (ENOEXEC);
@@ -206,7 +206,7 @@ olf_check_header(ehdr, type, os)
{
int i;
- /*
+ /*
* We need to check magic, class size, endianess, version, and OS
* before we look at the rest of the Elf32_Ehdr structure. These few
* elements are represented in a machine independant fashion.
@@ -215,20 +215,20 @@ olf_check_header(ehdr, type, os)
ehdr->e_ident[OI_CLASS] != ELF_TARG_CLASS ||
ehdr->e_ident[OI_DATA] != ELF_TARG_DATA ||
ehdr->e_ident[OI_VERSION] != ELF_TARG_VER)
- return (ENOEXEC);
+ return (ENOEXEC);
for (i = 0; i < sizeof elf_probes / sizeof elf_probes[0]; i++)
if ((1 << ehdr->e_ident[OI_OS]) & elf_probes[i].os_mask)
- goto os_ok;
+ goto os_ok;
return (ENOEXEC);
-os_ok:
- /* Now check the machine dependant header */
+os_ok:
+ /* Now check the machine dependant header */
if (ehdr->e_machine != ELF_TARG_MACH ||
ehdr->e_version != ELF_TARG_VER)
- return (ENOEXEC);
+ return (ENOEXEC);
- /* Check the type */
+ /* Check the type */
if (ehdr->e_type != type)
return (ENOEXEC);
@@ -283,18 +283,17 @@ elf_load_psection(vcset, vp, ph, addr, size, prot)
* Because the pagedvn pager can't handle zero fill of the last
* data page if it's not page aligned we map the las page readvn.
*/
- if(ph->p_flags & PF_W) {
+ if (ph->p_flags & PF_W) {
psize = trunc_page(*size);
NEW_VMCMD(vcset, vmcmd_map_pagedvn, psize, *addr, vp,
offset, *prot);
- if(psize != *size) {
+ if (psize != *size) {
NEW_VMCMD(vcset, vmcmd_map_readvn, *size - psize,
*addr + psize, vp, offset + psize, *prot);
}
- }
- else {
- NEW_VMCMD(vcset, vmcmd_map_pagedvn, psize, *addr, vp, offset,
- *prot);
+ } else {
+ NEW_VMCMD(vcset, vmcmd_map_pagedvn, psize, *addr, vp, offset,
+ *prot);
}
/*
@@ -415,7 +414,7 @@ elf_load_file(p, path, epp, ap, last)
if (eh.e_entry >= ph[i].p_vaddr &&
eh.e_entry < (ph[i].p_vaddr + size)) {
epp->ep_entry = addr + eh.e_entry -
- ELF_ALIGN(ph[i].p_vaddr,ph[i].p_align);
+ ELF_ALIGN(ph[i].p_vaddr,ph[i].p_align);
ap->arg_interp = addr;
}
addr += size;
@@ -564,8 +563,8 @@ exec_elf_makecmds(p, epp)
* Decide whether it's text or data by looking
* at the entry point.
*/
- if (eh->e_entry >= addr && eh->e_entry < (addr + size))
- {
+ if (eh->e_entry >= addr &&
+ eh->e_entry < (addr + size)) {
epp->ep_taddr = addr;
epp->ep_tsize = size;
} else {
@@ -632,8 +631,7 @@ exec_elf_makecmds(p, epp)
epp->ep_emul_arg = ap;
epp->ep_entry = eh->e_entry; /* keep check_exec() happy */
- }
- else {
+ } else {
epp->ep_interp = NULL;
epp->ep_entry = eh->e_entry;
}
@@ -672,7 +670,7 @@ exec_elf_fixup(p, epp)
AuxInfo ai[ELF_AUX_ENTRIES], *a;
u_long pos = epp->ep_interp_pos;
- if(epp->ep_interp == 0) {
+ if (epp->ep_interp == 0) {
return (0);
}
diff --git a/sys/kern/exec_elf64.c b/sys/kern/exec_elf64.c
index 39cc5ec1180..f055e4ce67a 100644
--- a/sys/kern/exec_elf64.c
+++ b/sys/kern/exec_elf64.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf64.c,v 1.14 2001/03/29 13:25:34 art Exp $ */
+/* $OpenBSD: exec_elf64.c,v 1.15 2001/06/22 14:14:07 deraadt Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@@ -111,8 +111,8 @@ void elf64_load_psection __P((struct exec_vmcmd_set *, struct vnode *,
int exec_elf64_fixup __P((struct proc *, struct exec_package *));
/* round up and down to page boundaries. */
-#define ELF_ROUND(a, b) (((a) + (b) - 1) & ~((b) - 1))
-#define ELF_TRUNC(a, b) ((a) & ~((b) - 1))
+#define ELF_ROUND(a, b) (((a) + (b) - 1) & ~((b) - 1))
+#define ELF_TRUNC(a, b) ((a) & ~((b) - 1))
/*
* This is the basic elf emul. elf64_probe_funcs may change to other emuls.
@@ -179,7 +179,7 @@ elf64_check_header(ehdr, type)
Elf64_Ehdr *ehdr;
int type;
{
- /*
+ /*
* We need to check magic, class size, endianess, and version before
* we look at the rest of the Elf64_Ehdr structure. These few elements
* are represented in a machine independant fashion.
@@ -188,14 +188,14 @@ elf64_check_header(ehdr, type)
ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS ||
ehdr->e_ident[EI_DATA] != ELF_TARG_DATA ||
ehdr->e_ident[EI_VERSION] != ELF_TARG_VER)
- return (ENOEXEC);
-
- /* Now check the machine dependant header */
+ return (ENOEXEC);
+
+ /* Now check the machine dependant header */
if (ehdr->e_machine != ELF_TARG_MACH ||
ehdr->e_version != ELF_TARG_VER)
- return (ENOEXEC);
+ return (ENOEXEC);
- /* Check the type */
+ /* Check the type */
if (ehdr->e_type != type)
return (ENOEXEC);
@@ -216,7 +216,7 @@ olf64_check_header(ehdr, type, os)
{
int i;
- /*
+ /*
* We need to check magic, class size, endianess, version, and OS
* before we look at the rest of the Elf64_Ehdr structure. These few
* elements are represented in a machine independant fashion.
@@ -225,20 +225,20 @@ olf64_check_header(ehdr, type, os)
ehdr->e_ident[OI_CLASS] != ELF_TARG_CLASS ||
ehdr->e_ident[OI_DATA] != ELF_TARG_DATA ||
ehdr->e_ident[OI_VERSION] != ELF_TARG_VER)
- return (ENOEXEC);
+ return (ENOEXEC);
for (i = 0; i < sizeof elf64_probes / sizeof elf64_probes[0]; i++)
if ((1 << ehdr->e_ident[OI_OS]) & elf64_probes[i].os_mask)
- goto os_ok;
+ goto os_ok;
return (ENOEXEC);
-os_ok:
- /* Now check the machine dependant header */
+os_ok:
+ /* Now check the machine dependant header */
if (ehdr->e_machine != ELF_TARG_MACH ||
ehdr->e_version != ELF_TARG_VER)
- return (ENOEXEC);
+ return (ENOEXEC);
- /* Check the type */
+ /* Check the type */
if (ehdr->e_type != type)
return (ENOEXEC);
@@ -248,7 +248,7 @@ os_ok:
/*
* elf64_load_psection():
- *
+ *
* Load a psection at the appropriate address
*/
void
@@ -293,7 +293,7 @@ elf64_load_psection(vcset, vp, ph, addr, size, prot)
* Because the pagedvn pager can't handle zero fill of the last
* data page if it's not page aligned we map the last page readvn.
*/
- if(ph->p_flags & PF_W) {
+ if (ph->p_flags & PF_W) {
psize = trunc_page(*size);
NEW_VMCMD(vcset, vmcmd_map_pagedvn, psize, *addr, vp,
offset, *prot);
@@ -301,10 +301,9 @@ elf64_load_psection(vcset, vp, ph, addr, size, prot)
NEW_VMCMD(vcset, vmcmd_map_readvn, *size - psize,
*addr + psize, vp, offset + psize, *prot);
}
- }
- else {
- NEW_VMCMD(vcset, vmcmd_map_pagedvn, psize, *addr, vp, offset,
- *prot);
+ } else {
+ NEW_VMCMD(vcset, vmcmd_map_pagedvn, psize, *addr, vp, offset,
+ *prot);
}
/*
@@ -430,7 +429,7 @@ elf64_load_file(p, path, epp, ap, last)
if (eh.e_entry >= ph[i].p_vaddr &&
eh.e_entry < (ph[i].p_vaddr + size)) {
epp->ep_entry = addr + eh.e_entry -
- ELF_TRUNC(ph[i].p_vaddr,ph[i].p_align);
+ ELF_TRUNC(ph[i].p_vaddr,ph[i].p_align);
ap->arg_interp = addr;
}
addr += size;
@@ -519,8 +518,8 @@ exec_elf64_makecmds(p, epp)
if (pp->p_filesz >= sizeof(interp))
goto bad;
if ((error = elf64_read_from(p, epp->ep_vp,
- pp->p_offset, (caddr_t)interp,
- pp->p_filesz)) != 0)
+ pp->p_offset, (caddr_t)interp,
+ pp->p_filesz)) != 0)
goto bad;
break;
}
@@ -552,7 +551,7 @@ exec_elf64_makecmds(p, epp)
}
#endif
for (i = 0; i < sizeof elf64_probes / sizeof elf64_probes[0] && error;
- i++)
+ i++)
if (os == OOS_NULL || ((1 << os) & elf64_probes[i].os_mask))
error = elf64_probes[i].func ?
(*elf64_probes[i].func)(p, epp, interp, &pos, &os) :
@@ -593,9 +592,9 @@ native:
epp->ep_taddr = addr;
epp->ep_tsize = size;
if (epp->ep_daddr == ELF64_NO_ADDR) {
- epp->ep_daddr = addr;
- epp->ep_dsize = size;
- }
+ epp->ep_daddr = addr;
+ epp->ep_dsize = size;
+ }
} else {
epp->ep_daddr = addr;
epp->ep_dsize = size;
@@ -660,8 +659,7 @@ native:
epp->ep_emul_arg = ap;
epp->ep_entry = eh->e_entry; /* keep check_exec() happy */
- }
- else {
+ } else {
epp->ep_interp = NULL;
epp->ep_entry = eh->e_entry;
}
@@ -700,7 +698,7 @@ exec_elf64_fixup(p, epp)
AuxInfo ai[ELF_AUX_ENTRIES], *a;
u_long pos = epp->ep_interp_pos;
- if(epp->ep_interp == 0) {
+ if (epp->ep_interp == 0) {
return (0);
}
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c
index b920555b6da..1ac12a36ef6 100644
--- a/sys/kern/exec_script.c
+++ b/sys/kern/exec_script.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_script.c,v 1.12 2001/05/14 13:31:52 art Exp $ */
+/* $OpenBSD: exec_script.c,v 1.13 2001/06/22 14:14:08 deraadt Exp $ */
/* $NetBSD: exec_script.c,v 1.13 1996/02/04 02:15:06 christos Exp $ */
/*
@@ -270,13 +270,13 @@ fail:
epp->ep_flags |= EXEC_DESTR;
/* kill the opened file descriptor, else close the file */
- if (epp->ep_flags & EXEC_HASFD) {
- epp->ep_flags &= ~EXEC_HASFD;
- (void) fdrelease(p, epp->ep_fd);
- } else
+ if (epp->ep_flags & EXEC_HASFD) {
+ epp->ep_flags &= ~EXEC_HASFD;
+ (void) fdrelease(p, epp->ep_fd);
+ } else
vn_close(scriptvp, FREAD, p->p_ucred, p);
- FREE(epp->ep_ndp->ni_cnd.cn_pnbuf, M_NAMEI);
+ FREE(epp->ep_ndp->ni_cnd.cn_pnbuf, M_NAMEI);
/* free the fake arg list, because we're not returning it */
tmpsap = shellargp;
@@ -286,11 +286,11 @@ fail:
}
FREE(shellargp, M_EXEC);
- /*
- * free any vmspace-creation commands,
- * and release their references
- */
- kill_vmcmds(&epp->ep_vmcmds);
+ /*
+ * free any vmspace-creation commands,
+ * and release their references
+ */
+ kill_vmcmds(&epp->ep_vmcmds);
- return error;
+ return error;
}
diff --git a/sys/kern/exec_subr.c b/sys/kern/exec_subr.c
index cb731604d12..fcdec7bd2b8 100644
--- a/sys/kern/exec_subr.c
+++ b/sys/kern/exec_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_subr.c,v 1.10 2001/02/22 16:08:01 art Exp $ */
+/* $OpenBSD: exec_subr.c,v 1.11 2001/06/22 14:14:08 deraadt Exp $ */
/* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */
/*
@@ -101,7 +101,7 @@ vmcmdset_extend(evsp)
/* reallocate the command set */
nvcp = malloc(evsp->evs_cnt * sizeof(struct exec_vmcmd), M_EXEC,
- M_WAITOK);
+ M_WAITOK);
bcopy(evsp->evs_cmds, nvcp, (ocnt * sizeof(struct exec_vmcmd)));
if (evsp->evs_cmds != evsp->evs_start)
free(evsp->evs_cmds, M_EXEC);
@@ -149,17 +149,17 @@ vmcmd_map_pagedvn(p, cmd)
* call this routine.
*/
#if defined(UVM)
- struct uvm_object *uobj;
+ struct uvm_object *uobj;
int retval;
/*
* map the vnode in using uvm_map.
*/
- if (cmd->ev_len == 0)
- return(0);
- if (cmd->ev_offset & PAGE_MASK)
- return(EINVAL);
+ if (cmd->ev_len == 0)
+ return(0);
+ if (cmd->ev_offset & PAGE_MASK)
+ return(EINVAL);
if (cmd->ev_addr & PAGE_MASK)
return(EINVAL);
if (cmd->ev_len & PAGE_MASK)
@@ -169,18 +169,18 @@ vmcmd_map_pagedvn(p, cmd)
* first, attach to the object
*/
- uobj = uvn_attach((void *) cmd->ev_vp, VM_PROT_READ|VM_PROT_EXECUTE);
- if (uobj == NULL)
- return(ENOMEM);
+ uobj = uvn_attach((void *) cmd->ev_vp, VM_PROT_READ|VM_PROT_EXECUTE);
+ if (uobj == NULL)
+ return(ENOMEM);
/*
* do the map
*/
- retval = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, cmd->ev_len,
- uobj, cmd->ev_offset,
- UVM_MAPFLAG(cmd->ev_prot, VM_PROT_ALL, UVM_INH_COPY,
- UVM_ADV_NORMAL, UVM_FLAG_COPYONW|UVM_FLAG_FIXED));
+ retval = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, cmd->ev_len,
+ uobj, cmd->ev_offset,
+ UVM_MAPFLAG(cmd->ev_prot, VM_PROT_ALL, UVM_INH_COPY,
+ UVM_ADV_NORMAL, UVM_FLAG_COPYONW|UVM_FLAG_FIXED));
/*
* check for error
@@ -220,11 +220,11 @@ vmcmd_map_readvn(p, cmd)
return(KERN_SUCCESS); /* XXXCDC: should it happen? */
cmd->ev_addr = trunc_page(cmd->ev_addr); /* required by uvm_map */
- error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr,
- round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET,
- UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY,
- UVM_ADV_NORMAL,
- UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW));
+ error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr,
+ round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET,
+ UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY,
+ UVM_ADV_NORMAL,
+ UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW));
#else
error = vm_allocate(&p->p_vmspace->vm_map, &cmd->ev_addr,
@@ -247,10 +247,10 @@ vmcmd_map_readvn(p, cmd)
* it mapped read-only, so now we are going to have to call
* uvm_map_protect() to fix up the protection. ICK.
*/
- return(uvm_map_protect(&p->p_vmspace->vm_map,
- trunc_page(cmd->ev_addr),
- round_page(cmd->ev_addr + cmd->ev_len),
- cmd->ev_prot, FALSE));
+ return(uvm_map_protect(&p->p_vmspace->vm_map,
+ trunc_page(cmd->ev_addr),
+ round_page(cmd->ev_addr + cmd->ev_len),
+ cmd->ev_prot, FALSE));
} else {
return(KERN_SUCCESS);
}
@@ -278,11 +278,10 @@ vmcmd_map_zero(p, cmd)
return(KERN_SUCCESS); /* XXXCDC: should it happen? */
cmd->ev_addr = trunc_page(cmd->ev_addr); /* required by uvm_map */
- error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr,
- round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET,
- UVM_MAPFLAG(cmd->ev_prot, UVM_PROT_ALL, UVM_INH_COPY,
- UVM_ADV_NORMAL,
- UVM_FLAG_FIXED|UVM_FLAG_COPYONW));
+ error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr,
+ round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET,
+ UVM_MAPFLAG(cmd->ev_prot, UVM_PROT_ALL, UVM_INH_COPY,
+ UVM_ADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_COPYONW));
#else
error = vm_allocate(&p->p_vmspace->vm_map, &cmd->ev_addr,
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 6a0e8ea168f..f30307b5a1d 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.65 2001/05/17 18:41:44 provos Exp $ */
+/* $OpenBSD: init_main.c,v 1.66 2001/06/22 14:14:08 deraadt Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -463,7 +463,7 @@ main(framep)
#ifdef CRYPTO
/* Create process 5, the crypto kernel thread. */
if (kthread_create(start_crypto, NULL, NULL, "crypto"))
- panic("crypto thread");
+ panic("crypto thread");
#endif /* CRYPTO */
/* Create any other deferred kernel threads. */
@@ -558,11 +558,10 @@ start_init(arg)
#endif
#if defined(UVM)
if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE,
- NULL, UVM_UNKNOWN_OFFSET,
- UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY,
- UVM_ADV_NORMAL,
- UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW))
- != KERN_SUCCESS)
+ NULL, UVM_UNKNOWN_OFFSET,
+ UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY,
+ UVM_ADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW))
+ != KERN_SUCCESS)
panic("init: couldn't allocate argument space");
#else
if (vm_allocate(&p->p_vmspace->vm_map, &addr, (vsize_t)PAGE_SIZE,
@@ -696,9 +695,9 @@ start_reaper(arg)
#ifdef CRYPTO
void
start_crypto(arg)
- void *arg;
+ void *arg;
{
- crypto_thread();
- /* NOTREACHED */
+ crypto_thread();
+ /* NOTREACHED */
}
#endif /* CRYPTO */
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 9ca08ede2d4..5add00e0b86 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.30 2001/05/23 14:50:15 art Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.31 2001/06/22 14:14:08 deraadt Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -95,32 +95,32 @@ filedesc_init()
static __inline int
find_next_zero (u_int *bitmap, int want, u_int bits)
{
- int i, off, maxoff;
+ int i, off, maxoff;
u_int sub;
- if (want > bits)
- return -1;
+ if (want > bits)
+ return -1;
off = want >> NDENTRYSHIFT;
i = want & NDENTRYMASK;
- if (i) {
+ if (i) {
sub = bitmap[off] | ((u_int)~0 >> (NDENTRIES - i));
if (sub != ~0)
goto found;
off++;
- }
+ }
maxoff = NDLOSLOTS(bits);
- while (off < maxoff) {
- if ((sub = bitmap[off]) != ~0)
- goto found;
+ while (off < maxoff) {
+ if ((sub = bitmap[off]) != ~0)
+ goto found;
off++;
- }
+ }
- return -1;
+ return -1;
found:
- return (off << NDENTRYSHIFT) + ffs(~sub) - 1;
+ return (off << NDENTRYSHIFT) + ffs(~sub) - 1;
}
int
@@ -134,17 +134,15 @@ find_last_set(struct filedesc *fd, int last)
while (!bitmap[off] && off >= 0)
off--;
-
if (off < 0)
return 0;
-
+
i = ((off + 1) << NDENTRYSHIFT) - 1;
if (i >= last)
i = last - 1;
while (i > 0 && ofiles[i] == NULL)
i--;
-
return i;
}
@@ -608,7 +606,7 @@ fdalloc(p, want, result)
i = fdp->fd_freefile;
off = i >> NDENTRYSHIFT;
new = find_next_zero(fdp->fd_himap, off,
- (last + NDENTRIES - 1) >> NDENTRYSHIFT);
+ (last + NDENTRIES - 1) >> NDENTRYSHIFT);
if (new != -1) {
i = find_next_zero(&fdp->fd_lomap[new],
new > off ? 0 : i & NDENTRYMASK,
@@ -659,19 +657,19 @@ fdalloc(p, want, result)
if (NDHISLOTS(nfiles) > NDHISLOTS(fdp->fd_nfiles)) {
newhimap = malloc(NDHISLOTS(nfiles) * sizeof(u_int),
- M_FILEDESC, M_WAITOK);
+ M_FILEDESC, M_WAITOK);
newlomap = malloc( NDLOSLOTS(nfiles) * sizeof(u_int),
- M_FILEDESC, M_WAITOK);
+ M_FILEDESC, M_WAITOK);
bcopy(fdp->fd_himap, newhimap,
- (i = NDHISLOTS(fdp->fd_nfiles) * sizeof(u_int)));
+ (i = NDHISLOTS(fdp->fd_nfiles) * sizeof(u_int)));
bzero((char *)newhimap + i,
- NDHISLOTS(nfiles) * sizeof(u_int) - i);
+ NDHISLOTS(nfiles) * sizeof(u_int) - i);
bcopy(fdp->fd_lomap, newlomap,
- (i = NDLOSLOTS(fdp->fd_nfiles) * sizeof(u_int)));
+ (i = NDLOSLOTS(fdp->fd_nfiles) * sizeof(u_int)));
bzero((char *)newlomap + i,
- NDLOSLOTS(nfiles) * sizeof(u_int) - i);
+ NDLOSLOTS(nfiles) * sizeof(u_int) - i);
if (NDHISLOTS(fdp->fd_nfiles) > NDHISLOTS(NDFILE)) {
free(fdp->fd_himap, M_FILEDESC);
@@ -865,9 +863,9 @@ fdcopy(p)
((struct filedesc0 *) newfdp)->fd_dlomap;
} else {
newfdp->fd_himap = malloc(NDHISLOTS(i) * sizeof(u_int),
- M_FILEDESC, M_WAITOK);
+ M_FILEDESC, M_WAITOK);
newfdp->fd_lomap = malloc(NDLOSLOTS(i) * sizeof(u_int),
- M_FILEDESC, M_WAITOK);
+ M_FILEDESC, M_WAITOK);
}
newfdp->fd_nfiles = i;
bcopy(fdp->fd_ofiles, newfdp->fd_ofiles, i * sizeof(struct file **));
@@ -1064,7 +1062,7 @@ filedescopen(dev, mode, type, p)
/*
* XXX Kludge: set curproc->p_dupfd to contain the value of the
- * the file descriptor being sought for duplication. The error
+ * the file descriptor being sought for duplication. The error
* return ensures that the vnode for this device will be released
* by vn_open. Open will detect this special error and take the
* actions in dupfdopen below. Other callers of vn_open or VOP_OPEN
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index cfe0e18af44..38438d2b027 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.51 2001/06/19 07:54:36 deraadt Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.52 2001/06/22 14:14:08 deraadt Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -475,8 +475,8 @@ sys_execve(p, v, retval)
p->p_acflag &= ~AFORK;
/* record proc's vnode, for use by procfs and others */
- if (p->p_textvp)
- vrele(p->p_textvp);
+ if (p->p_textvp)
+ vrele(p->p_textvp);
VREF(pack.ep_vp);
p->p_textvp = pack.ep_vp;
@@ -615,8 +615,8 @@ sys_execve(p, v, retval)
KNOTE(&p->p_klist, NOTE_EXEC);
/* setup new registers and do misc. setup. */
- if(pack.ep_emul->e_fixup != NULL) {
- if((*pack.ep_emul->e_fixup)(p, &pack) != 0)
+ if (pack.ep_emul->e_fixup != NULL) {
+ if ((*pack.ep_emul->e_fixup)(p, &pack) != 0)
goto free_pack_abort;
}
#ifdef MACHINE_STACK_GROWS_UP
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c
index 85becf736ac..4f66006f430 100644
--- a/sys/kern/kern_ktrace.c
+++ b/sys/kern/kern_ktrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_ktrace.c,v 1.22 2000/11/10 18:15:46 art Exp $ */
+/* $OpenBSD: kern_ktrace.c,v 1.23 2001/06/22 14:14:08 deraadt Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */
/*
@@ -525,11 +525,11 @@ ktrcanset(callp, targetp)
struct pcred *target = targetp->p_cred;
if ((caller->pc_ucred->cr_uid == target->p_ruid &&
- target->p_ruid == target->p_svuid &&
- caller->p_rgid == target->p_rgid && /* XXX */
- target->p_rgid == target->p_svgid &&
- (targetp->p_traceflag & KTRFAC_ROOT) == 0) ||
- caller->pc_ucred->cr_uid == 0)
+ target->p_ruid == target->p_svuid &&
+ caller->p_rgid == target->p_rgid && /* XXX */
+ target->p_rgid == target->p_svgid &&
+ (targetp->p_traceflag & KTRFAC_ROOT) == 0) ||
+ caller->pc_ucred->cr_uid == 0)
return (1);
return (0);
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 1ac1c514bd6..bb4dda02829 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_malloc.c,v 1.33 2001/06/21 14:28:53 niklas Exp $ */
+/* $OpenBSD: kern_malloc.c,v 1.34 2001/06/22 14:14:08 deraadt Exp $ */
/* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */
/*
@@ -247,8 +247,7 @@ malloc(size, type, flags)
vm_map_lock(kmem_map);
rv = uvm_map_checkprot(kmem_map, addr,
- addr + sizeof(struct freelist),
- VM_PROT_WRITE);
+ addr + sizeof(struct freelist), VM_PROT_WRITE);
vm_map_unlock(kmem_map);
if (!rv)
@@ -493,8 +492,8 @@ sysctl_malloc(name, namelen, oldp, oldlenp, newp, newlen, p)
size_t newlen;
struct proc *p;
{
- struct kmembuckets kb;
- int i, siz;
+ struct kmembuckets kb;
+ int i, siz;
if (namelen != 2 && name[0] != KERN_MALLOC_BUCKETS &&
name[0] != KERN_MALLOC_KMEMNAMES)
@@ -502,21 +501,21 @@ sysctl_malloc(name, namelen, oldp, oldlenp, newp, newlen, p)
switch (name[0]) {
case KERN_MALLOC_BUCKETS:
- /* Initialize the first time */
- if (buckstring_init == 0) {
+ /* Initialize the first time */
+ if (buckstring_init == 0) {
buckstring_init = 1;
bzero(buckstring, sizeof(buckstring));
- for (siz = 0, i = MINBUCKET; i < MINBUCKET + 16; i++)
- siz += sprintf(buckstring + siz,
- "%d,", (u_int)(1<<i));
+ for (siz = 0, i = MINBUCKET; i < MINBUCKET + 16; i++)
+ siz += sprintf(buckstring + siz,
+ "%d,", (u_int)(1<<i));
/* Remove trailing comma */
if (siz)
buckstring[siz - 1] = '\0';
}
- return (sysctl_rdstring(oldp, oldlenp, newp, buckstring));
+ return (sysctl_rdstring(oldp, oldlenp, newp, buckstring));
case KERN_MALLOC_BUCKET:
- bcopy(&bucket[BUCKETINDX(name[1])], &kb, sizeof(kb));
+ bcopy(&bucket[BUCKETINDX(name[1])], &kb, sizeof(kb));
kb.kb_next = kb.kb_last = 0;
return (sysctl_rdstruct(oldp, oldlenp, newp, &kb, sizeof(kb)));
case KERN_MALLOC_KMEMSTATS:
@@ -530,7 +529,7 @@ sysctl_malloc(name, namelen, oldp, oldlenp, newp, newlen, p)
#endif
case KERN_MALLOC_KMEMNAMES:
#if defined(KMEMSTATS) || defined(DIAGNOSTIC) || defined(FFS_SOFTUPDATES)
- if (memall == NULL) {
+ if (memall == NULL) {
int totlen;
i = lockmgr(&sysctl_kmemlock, LK_EXCLUSIVE, NULL, p);
@@ -545,8 +544,8 @@ sysctl_malloc(name, namelen, oldp, oldlenp, newp, newlen, p)
}
memall = malloc(totlen + M_LAST, M_SYSCTL, M_WAITOK);
bzero(memall, totlen + M_LAST);
- for (siz = 0, i = 0; i < M_LAST; i++)
- siz += sprintf(memall + siz, "%s,",
+ for (siz = 0, i = 0; i < M_LAST; i++)
+ siz += sprintf(memall + siz, "%s,",
memname[i] ? memname[i] : "");
/* Remove trailing comma */
@@ -559,12 +558,12 @@ sysctl_malloc(name, namelen, oldp, oldlenp, newp, newlen, p)
memall[i] = '_';
lockmgr(&sysctl_kmemlock, LK_RELEASE, NULL, p);
}
- return (sysctl_rdstring(oldp, oldlenp, newp, memall));
+ return (sysctl_rdstring(oldp, oldlenp, newp, memall));
#else
return (EOPNOTSUPP);
#endif
default:
- return (EOPNOTSUPP);
+ return (EOPNOTSUPP);
}
/* NOTREACHED */
}
diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c
index 58c5b7a4eb9..ba99b55d2a2 100644
--- a/sys/kern/kern_physio.c
+++ b/sys/kern/kern_physio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_physio.c,v 1.10 2001/05/07 22:16:35 art Exp $ */
+/* $OpenBSD: kern_physio.c,v 1.11 2001/06/22 14:14:09 deraadt Exp $ */
/* $NetBSD: kern_physio.c,v 1.28 1997/05/19 10:43:28 pk Exp $ */
/*-
@@ -103,8 +103,8 @@ physio(strategy, bp, dev, flags, minphys, uio)
#if defined(UVM) /* XXXCDC: map not locked, rethink */
/* XXX - obsolete now that vslock can error? */
if (!uvm_useracc(uio->uio_iov[i].iov_base,
- uio->uio_iov[i].iov_len,
- (flags == B_READ) ? B_WRITE : B_READ))
+ uio->uio_iov[i].iov_len,
+ (flags == B_READ) ? B_WRITE : B_READ))
return (EFAULT);
#else
if (!useracc(uio->uio_iov[i].iov_base,
@@ -249,9 +249,9 @@ after_unlock:
panic("done > todo; strategy broken");
#endif
iovp->iov_len -= done;
- iovp->iov_base += done;
- uio->uio_offset += done;
- uio->uio_resid -= done;
+ iovp->iov_base += done;
+ uio->uio_offset += done;
+ uio->uio_resid -= done;
/*
* Now, check for an error.
@@ -301,13 +301,13 @@ getphysbuf()
int s;
s = splbio();
- while (bswlist.b_actf == NULL) {
- bswlist.b_flags |= B_WANTED;
- tsleep((caddr_t)&bswlist, PRIBIO + 1, "getphys", 0);
- }
- bp = bswlist.b_actf;
- bswlist.b_actf = bp->b_actf;
- splx(s);
+ while (bswlist.b_actf == NULL) {
+ bswlist.b_flags |= B_WANTED;
+ tsleep((caddr_t)&bswlist, PRIBIO + 1, "getphys", 0);
+ }
+ bp = bswlist.b_actf;
+ bswlist.b_actf = bp->b_actf;
+ splx(s);
#else
bp = malloc(sizeof(*bp), M_TEMP, M_WAITOK);
@@ -331,14 +331,14 @@ putphysbuf(bp)
struct buf *bp;
{
#if !defined(UVM)
- bp->b_actf = bswlist.b_actf;
- bswlist.b_actf = bp;
- if (bp->b_vp)
- brelvp(bp);
- if (bswlist.b_flags & B_WANTED) {
- bswlist.b_flags &= ~B_WANTED;
- wakeup(&bswlist);
- }
+ bp->b_actf = bswlist.b_actf;
+ bswlist.b_actf = bp;
+ if (bp->b_vp)
+ brelvp(bp);
+ if (bswlist.b_flags & B_WANTED) {
+ bswlist.b_flags &= ~B_WANTED;
+ wakeup(&bswlist);
+ }
#else
/* XXXCDC: is this necesary? */
if (bp->b_vp)
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 7a86e67f46b..65b3474d264 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_prot.c,v 1.16 2001/06/19 07:54:37 deraadt Exp $ */
+/* $OpenBSD: kern_prot.c,v 1.17 2001/06/22 14:14:09 deraadt Exp $ */
/* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */
/*
@@ -109,7 +109,7 @@ sys_getpgid(curp, v, retval)
struct sys_getpgid_args /* {
syscallarg(pid_t) pid;
} */ *uap = v;
- struct proc *targp = curp;
+ struct proc *targp = curp;
if (SCARG(uap, pid) == 0 || SCARG(uap, pid) == curp->p_pid)
goto found;
@@ -124,14 +124,14 @@ found:
pid_t
sys_getsid(curp, v, retval)
- struct proc *curp;
- void *v;
- register_t *retval;
+ struct proc *curp;
+ void *v;
+ register_t *retval;
{
- struct sys_getsid_args /* {
- syscallarg(pid_t) pid;
- } */ *uap = v;
- struct proc *targp = curp;
+ struct sys_getsid_args /* {
+ syscallarg(pid_t) pid;
+ } */ *uap = v;
+ struct proc *targp = curp;
if (SCARG(uap, pid) == 0 || SCARG(uap, pid) == curp->p_pid)
goto found;
@@ -502,7 +502,7 @@ sys_setgroups(p, v, retval)
return (EINVAL);
pc->pc_ucred = crcopy(pc->pc_ucred);
error = copyin((caddr_t)SCARG(uap, gidset),
- (caddr_t)pc->pc_ucred->cr_groups, ngrp * sizeof(gid_t));
+ (caddr_t)pc->pc_ucred->cr_groups, ngrp * sizeof(gid_t));
if (error)
return (error);
pc->pc_ucred->cr_ngroups = ngrp;
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index b884e6a04ae..fa5b19f99c2 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.44 2001/06/18 09:00:24 art Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.45 2001/06/22 14:14:09 deraadt Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -272,7 +272,7 @@ sys_sigaction(p, v, retval)
}
if (SCARG(uap, nsa)) {
error = copyin((caddr_t)SCARG(uap, nsa), (caddr_t)sa,
- sizeof (vec));
+ sizeof (vec));
if (error)
return (error);
setsigvec(p, signum, sa);
@@ -414,7 +414,7 @@ execsigs(p)
ps->ps_sigstk.ss_size = 0;
ps->ps_sigstk.ss_sp = 0;
ps->ps_flags = 0;
- p->p_flag &= ~P_NOCLDWAIT;
+ p->p_flag &= ~P_NOCLDWAIT;
}
/*
@@ -451,7 +451,7 @@ sys_sigprocmask(p, v, retval)
case SIG_SETMASK:
p->p_sigmask = SCARG(uap, mask) &~ sigcantmask;
break;
-
+
default:
error = EINVAL;
break;
@@ -595,10 +595,10 @@ killpg1(cp, signum, pgid, all)
register struct pcred *pc = cp->p_cred;
struct pgrp *pgrp;
int nfound = 0;
-
- if (all)
+
+ if (all)
/*
- * broadcast
+ * broadcast
*/
for (p = LIST_FIRST(&allproc); p; p = LIST_NEXT(p, p_list)) {
if (p->p_pid <= 1 || p->p_flag & P_SYSTEM ||
@@ -609,8 +609,8 @@ killpg1(cp, signum, pgid, all)
psignal(p, signum);
}
else {
- if (pgid == 0)
- /*
+ if (pgid == 0)
+ /*
* zero pgid means send to my process group.
*/
pgrp = cp->p_pgrp;
@@ -723,8 +723,8 @@ trapsignal(p, signum, code, type, sigval)
p->p_stats->p_ru.ru_nsignals++;
#ifdef KTRACE
if (KTRPOINT(p, KTR_PSIG))
- ktrpsig(p, signum, ps->ps_sigact[signum],
- p->p_sigmask, code);
+ ktrpsig(p, signum, ps->ps_sigact[signum],
+ p->p_sigmask, code);
#endif
(*p->p_emul->e_sendsig)(ps->ps_sigact[signum], signum,
p->p_sigmask, code, type, sigval);
@@ -1439,7 +1439,7 @@ filt_sigdetach(struct knote *kn)
}
/*
- * signal knotes are shared with proc knotes, so we apply a mask to
+ * signal knotes are shared with proc knotes, so we apply a mask to
* the hint in order to differentiate them from process hints. This
* could be avoided by using a signal-specific knote list, but probably
* isn't worth the trouble.
diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c
index dac25fa6928..a1663c4e083 100644
--- a/sys/kern/subr_extent.c
+++ b/sys/kern/subr_extent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_extent.c,v 1.14 2001/05/08 19:40:55 fgsch Exp $ */
+/* $OpenBSD: subr_extent.c,v 1.15 2001/06/22 14:14:09 deraadt Exp $ */
/* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */
/*-
@@ -95,7 +95,7 @@ extent_register(ex)
struct extent *ex;
{
/* Is this redundant? */
- if(ext_listp == NULL){
+ if (ext_listp == NULL){
LIST_INIT(&ext_list);
ext_listp = &ext_list;
}
@@ -118,7 +118,8 @@ extent_find(name)
struct extent *ep;
for(ep = ext_listp->lh_first; ep != NULL; ep = ep->ex_link.le_next){
- if(!strcmp(ep->ex_name, name)) return(ep);
+ if (!strcmp(ep->ex_name, name))
+ return(ep);
}
return(NULL);
@@ -641,7 +642,7 @@ extent_alloc_subregion1(ex, substart, subend, size, alignment, skew, boundary,
* Calculate the next boundary after the start
* of this region.
*/
- dontcross = EXTENT_ALIGN(newstart+1, boundary,
+ dontcross = EXTENT_ALIGN(newstart+1, boundary,
(flags & EX_BOUNDZERO) ? 0 : ex->ex_start)
- 1;
@@ -718,7 +719,7 @@ extent_alloc_subregion1(ex, substart, subend, size, alignment, skew, boundary,
*/
if (!LE_OV(newstart, (size - 1), subend))
goto fail;
-
+
last = rp;
}
@@ -742,7 +743,7 @@ extent_alloc_subregion1(ex, substart, subend, size, alignment, skew, boundary,
* Calculate the next boundary after the start
* of this region.
*/
- dontcross = EXTENT_ALIGN(newstart+1, boundary,
+ dontcross = EXTENT_ALIGN(newstart+1, boundary,
(flags & EX_BOUNDZERO) ? 0 : ex->ex_start)
- 1;
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index 019dd038a3e..b0b072c765e 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_prf.c,v 1.31 2001/02/22 19:33:22 mickey Exp $ */
+/* $OpenBSD: subr_prf.c,v 1.32 2001/06/22 14:14:09 deraadt Exp $ */
/* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */
/*-
@@ -97,8 +97,8 @@ extern int uvm_doswapencrypt;
* local prototypes
*/
-static int kprintf __P((const char *, int, void *,
- char *, va_list));
+static int kprintf __P((const char *, int, void *,
+ char *, va_list));
static void putchar __P((int, int, struct tty *));
@@ -146,8 +146,8 @@ void (*v_putc) __P((int)) = cnputc; /* start with cnputc (normal cons) */
*/
/*
- * Partial support (the failure case) of the assertion facility
- * commonly found in userland.
+ * Partial support (the failure case) of the assertion facility
+ * commonly found in userland.
*/
void
__assert(t, f, l, e)
@@ -174,7 +174,7 @@ tablefull(tab)
* panic: handle an unresolvable fatal error
*
* prints "panic: <message>" and reboots. if called twice (i.e. recursive
- * call) we avoid trying to sync the disk and just reboot (to avoid
+ * call) we avoid trying to sync the disk and just reboot (to avoid
* recursive panics).
*/
@@ -345,11 +345,11 @@ putchar(c, flags, tp)
mbp->msg_bufl = min(mbp->msg_bufl+1, mbp->msg_bufs);
if (mbp->msg_bufx < 0 || mbp->msg_bufx >= mbp->msg_bufs)
mbp->msg_bufx = 0;
- /* If the buffer is full, keep the most recent data. */
- if (mbp->msg_bufr == mbp->msg_bufx) {
- if (++mbp->msg_bufr >= mbp->msg_bufs)
- mbp->msg_bufr = 0;
- }
+ /* If the buffer is full, keep the most recent data. */
+ if (mbp->msg_bufr == mbp->msg_bufx) {
+ if (++mbp->msg_bufr >= mbp->msg_bufs)
+ mbp->msg_bufr = 0;
+ }
}
if ((flags & TOCONS) && constty == NULL && c != '\0')
(*v_putc)(c);
@@ -428,7 +428,7 @@ tprintf_close(sess)
}
/*
- * tprintf: given tprintf handle to a process [obtained with tprintf_open],
+ * tprintf: given tprintf handle to a process [obtained with tprintf_open],
* send a message to the controlling tty for that process.
*
* => also sends message to /dev/klog
@@ -569,9 +569,9 @@ int
sprintf(char *buf, const char *fmt, ...)
#else
sprintf(buf, fmt, va_alist)
- char *buf;
- const char *cfmt;
- va_dcl
+ char *buf;
+ const char *cfmt;
+ va_dcl
#endif
{
int retval;
@@ -616,10 +616,10 @@ int
snprintf(char *buf, size_t size, const char *fmt, ...)
#else
snprintf(buf, size, fmt, va_alist)
- char *buf;
- size_t size;
- const char *cfmt;
- va_dcl
+ char *buf;
+ size_t size;
+ const char *cfmt;
+ va_dcl
#endif
{
int retval;
@@ -641,10 +641,10 @@ snprintf(buf, size, fmt, va_alist)
*/
int
vsnprintf(buf, size, fmt, ap)
- char *buf;
- size_t size;
- const char *fmt;
- va_list ap;
+ char *buf;
+ size_t size;
+ const char *fmt;
+ va_list ap;
{
int retval;
char *p;
@@ -660,7 +660,7 @@ vsnprintf(buf, size, fmt, ap)
/*
* kprintf: scaled down version of printf(3).
*
- * this version based on vfprintf() from libc which was derived from
+ * this version based on vfprintf() from libc which was derived from
* software contributed to Berkeley by Chris Torek.
*
* Two additional formats:
@@ -807,11 +807,11 @@ rflag: ch = *fmt++;
reswitch: switch (ch) {
/* XXX: non-standard '%:' format */
#ifndef __powerpc__
- case ':':
+ case ':':
if (oflags != TOBUFONLY) {
cp = va_arg(ap, char *);
- kprintf(cp, oflags, vp,
- NULL, va_arg(ap, va_list));
+ kprintf(cp, oflags, vp,
+ NULL, va_arg(ap, va_list));
}
continue; /* no output */
#endif
@@ -865,9 +865,9 @@ reswitch: switch (ch) {
#ifdef DDB
/* XXX: non-standard '%r' format (print int in db_radix) */
case 'r':
- if ((oflags & TODDB) == 0)
+ if ((oflags & TODDB) == 0)
goto default_case;
-
+
if (db_radix == 16)
goto case_z; /* signed hex */
_uquad = SARG();
@@ -882,7 +882,7 @@ reswitch: switch (ch) {
/* XXX: non-standard '%z' format ("signed hex", a "hex %i")*/
case 'z':
case_z:
- if ((oflags & TODDB) == 0)
+ if ((oflags & TODDB) == 0)
goto default_case;
xdigs = "0123456789abcdef";
diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c
index 66d34143026..70f94c2d407 100644
--- a/sys/kern/sysv_msg.c
+++ b/sys/kern/sysv_msg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_msg.c,v 1.9 2001/05/16 17:14:35 millert Exp $ */
+/* $OpenBSD: sysv_msg.c,v 1.10 2001/06/22 14:14:09 deraadt Exp $ */
/* $NetBSD: sysv_msg.c,v 1.19 1996/02/09 19:00:18 christos Exp $ */
/*
@@ -825,8 +825,8 @@ sys_msgrcv(p, v, retval)
struct msg **prev;
for (previous = NULL, prev = &msqptr->msg_first;
- (msghdr = *prev) != NULL;
- previous = msghdr, prev = &msghdr->msg_next) {
+ (msghdr = *prev) != NULL;
+ previous = msghdr, prev = &msghdr->msg_next) {
/*
* Is this message's type an exact match or is
* this message's type less than or equal to
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index d508b6e96ab..74e5387b3fa 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_shm.c,v 1.17 2001/05/16 17:14:36 millert Exp $ */
+/* $OpenBSD: sysv_shm.c,v 1.18 2001/06/22 14:14:09 deraadt Exp $ */
/* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */
/*
@@ -69,7 +69,7 @@ struct shmid_ds *shm_find_segment_by_shmid __P((int));
* per proc array of 'struct shmmap_state'
*/
-#define SHMSEG_FREE 0x0200
+#define SHMSEG_FREE 0x0200
#define SHMSEG_REMOVED 0x0400
#define SHMSEG_ALLOCATED 0x0800
#define SHMSEG_WANTED 0x1000
@@ -164,8 +164,8 @@ shm_delete_mapping(vm, shmmap_s)
#ifdef UVM
result = uvm_deallocate(&vm->vm_map, shmmap_s->va, size);
#else
- result = vm_map_remove(&vm->vm_map,
- shmmap_s->va, shmmap_s->va + size);
+ result = vm_map_remove(&vm->vm_map, shmmap_s->va,
+ shmmap_s->va + size);
#endif
if (result != KERN_SUCCESS)
return EINVAL;
@@ -263,17 +263,15 @@ sys_shmat(p, v, retval)
return EINVAL;
} else {
/* This is just a hint to vm_mmap() about where to put it. */
- attach_va =
- round_page((vaddr_t)p->p_vmspace->vm_taddr + MAXTSIZ +
- MAXDSIZ);
+ attach_va = round_page((vaddr_t)p->p_vmspace->vm_taddr +
+ MAXTSIZ + MAXDSIZ);
}
shm_handle = shmseg->shm_internal;
#ifdef UVM
uao_reference(shm_handle->shm_object);
rv = uvm_map(&p->p_vmspace->vm_map, &attach_va, size,
- shm_handle->shm_object, 0,
- UVM_MAPFLAG(prot, prot, UVM_INH_SHARE,
- UVM_ADV_RANDOM, 0));
+ shm_handle->shm_object, 0, UVM_MAPFLAG(prot, prot,
+ UVM_INH_SHARE, UVM_ADV_RANDOM, 0));
if (rv != KERN_SUCCESS) {
return ENOMEM;
}
@@ -285,7 +283,7 @@ sys_shmat(p, v, retval)
return ENOMEM;
}
vm_map_protect(&p->p_vmspace->vm_map, attach_va, attach_va + size,
- prot, 0);
+ prot, 0);
vm_map_inherit(&p->p_vmspace->vm_map,
attach_va, attach_va + size, VM_INHERIT_SHARE);
#endif
@@ -331,7 +329,7 @@ sys_shmctl(p, v, retval)
if ((error = ipcperm(cred, &shmseg->shm_perm, IPC_M)) != 0)
return error;
error = copyin(SCARG(uap, buf), (caddr_t)&inbuf,
- sizeof(inbuf));
+ sizeof(inbuf));
if (error)
return error;
shmseg->shm_perm.uid = inbuf.shm_perm.uid;
diff --git a/sys/kern/tty_subr.c b/sys/kern/tty_subr.c
index dbd1a48e201..0edd29ff68d 100644
--- a/sys/kern/tty_subr.c
+++ b/sys/kern/tty_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_subr.c,v 1.11 2001/05/16 12:52:58 ho Exp $ */
+/* $OpenBSD: tty_subr.c,v 1.12 2001/06/22 14:14:09 deraadt Exp $ */
/* $NetBSD: tty_subr.c,v 1.13 1996/02/09 19:00:43 christos Exp $ */
/*
@@ -50,7 +50,7 @@
* defined we allocate an array of bits -- 1/8th as much memory but
* setbit(), clrbit(), and isset() take more cpu. If QBITS is
* undefined, we just use an array of bytes.
- *
+ *
* If TTY_QUOTE functionality isn't required by a line discipline,
* it can free c_cq and set it to NULL. This speeds things up,
* and also does not use any extra memory. This is useful for (say)
@@ -309,7 +309,7 @@ out:
if (clp->c_cq) {
#ifdef QBITS
if (c & TTY_QUOTE)
- setbit(clp->c_cq, i);
+ setbit(clp->c_cq, i);
else
clrbit(clp->c_cq, i);
#else
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 42c4c4a1a0d..c1edf104a6b 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.34 2001/05/25 22:08:23 itojun Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.35 2001/06/22 14:14:09 deraadt Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -57,11 +57,11 @@ void filt_sowdetach(struct knote *kn);
int filt_sowrite(struct knote *kn, long hint);
int filt_solisten(struct knote *kn, long hint);
-struct filterops solisten_filtops =
+struct filterops solisten_filtops =
{ 1, NULL, filt_sordetach, filt_solisten };
struct filterops soread_filtops =
{ 1, NULL, filt_sordetach, filt_soread };
-struct filterops sowrite_filtops =
+struct filterops sowrite_filtops =
{ 1, NULL, filt_sowdetach, filt_sowrite };
@@ -108,9 +108,8 @@ socreate(dom, aso, type, proto)
so->so_ruid = p->p_cred->p_ruid;
so->so_euid = p->p_ucred->cr_uid;
so->so_proto = prp;
- error =
- (*prp->pr_usrreq)(so, PRU_ATTACH, NULL, (struct mbuf *)(long)proto,
- NULL);
+ error = (*prp->pr_usrreq)(so, PRU_ATTACH, NULL,
+ (struct mbuf *)(long)proto, NULL);
if (error) {
so->so_state |= SS_NOFDREF;
sofree(so);
@@ -446,70 +445,71 @@ restart:
if (flags & MSG_EOR)
top->m_flags |= M_EOR;
} else do {
- if (top == 0) {
- MGETHDR(m, M_WAIT, MT_DATA);
- mlen = MHLEN;
- m->m_pkthdr.len = 0;
- m->m_pkthdr.rcvif = (struct ifnet *)0;
- } else {
- MGET(m, M_WAIT, MT_DATA);
- mlen = MLEN;
- }
- if (resid >= MINCLSIZE && space >= MCLBYTES) {
- MCLGET(m, M_WAIT);
- if ((m->m_flags & M_EXT) == 0)
- goto nopages;
- mlen = MCLBYTES;
+ if (top == 0) {
+ MGETHDR(m, M_WAIT, MT_DATA);
+ mlen = MHLEN;
+ m->m_pkthdr.len = 0;
+ m->m_pkthdr.rcvif = (struct ifnet *)0;
+ } else {
+ MGET(m, M_WAIT, MT_DATA);
+ mlen = MLEN;
+ }
+ if (resid >= MINCLSIZE && space >= MCLBYTES) {
+ MCLGET(m, M_WAIT);
+ if ((m->m_flags & M_EXT) == 0)
+ goto nopages;
+ mlen = MCLBYTES;
#ifdef MAPPED_MBUFS
- len = min(MCLBYTES, resid);
-#else
- if (atomic && top == 0) {
- len = min(MCLBYTES - max_hdr, resid);
- m->m_data += max_hdr;
- } else
len = min(MCLBYTES, resid);
+#else
+ if (atomic && top == 0) {
+ len = min(MCLBYTES - max_hdr, resid);
+ m->m_data += max_hdr;
+ } else
+ len = min(MCLBYTES, resid);
#endif
- space -= len;
- } else {
+ space -= len;
+ } else {
nopages:
- len = min(min(mlen, resid), space);
- space -= len;
- /*
- * For datagram protocols, leave room
- * for protocol headers in first mbuf.
- */
- if (atomic && top == 0 && len < mlen)
- MH_ALIGN(m, len);
- }
- error = uiomove(mtod(m, caddr_t), (int)len, uio);
- resid = uio->uio_resid;
- m->m_len = len;
- *mp = m;
- top->m_pkthdr.len += len;
+ len = min(min(mlen, resid), space);
+ space -= len;
+ /*
+ * For datagram protocols, leave room
+ * for protocol headers in first mbuf.
+ */
+ if (atomic && top == 0 && len < mlen)
+ MH_ALIGN(m, len);
+ }
+ error = uiomove(mtod(m, caddr_t), (int)len,
+ uio);
+ resid = uio->uio_resid;
+ m->m_len = len;
+ *mp = m;
+ top->m_pkthdr.len += len;
+ if (error)
+ goto release;
+ mp = &m->m_next;
+ if (resid <= 0) {
+ if (flags & MSG_EOR)
+ top->m_flags |= M_EOR;
+ break;
+ }
+ } while (space > 0 && atomic);
+ if (dontroute)
+ so->so_options |= SO_DONTROUTE;
+ s = splsoftnet(); /* XXX */
+ error = (*so->so_proto->pr_usrreq)(so,
+ (flags & MSG_OOB) ? PRU_SENDOOB : PRU_SEND,
+ top, addr, control);
+ splx(s);
+ if (dontroute)
+ so->so_options &= ~SO_DONTROUTE;
+ clen = 0;
+ control = 0;
+ top = 0;
+ mp = &top;
if (error)
goto release;
- mp = &m->m_next;
- if (resid <= 0) {
- if (flags & MSG_EOR)
- top->m_flags |= M_EOR;
- break;
- }
- } while (space > 0 && atomic);
- if (dontroute)
- so->so_options |= SO_DONTROUTE;
- s = splsoftnet(); /* XXX */
- error = (*so->so_proto->pr_usrreq)(so, (flags & MSG_OOB) ?
- PRU_SENDOOB : PRU_SEND,
- top, addr, control);
- splx(s);
- if (dontroute)
- so->so_options &= ~SO_DONTROUTE;
- clen = 0;
- control = 0;
- top = 0;
- mp = &top;
- if (error)
- goto release;
} while (resid && space > 0);
} while (resid);
@@ -845,7 +845,7 @@ dontblock:
if (uio_error)
error = uio_error;
-
+
if (flagsp)
*flagsp |= flags;
release:
@@ -1091,7 +1091,7 @@ sogetopt(so, level, optname, mp)
case SO_RCVTIMEO:
{
int val = (optname == SO_SNDTIMEO ?
- so->so_snd.sb_timeo : so->so_rcv.sb_timeo);
+ so->so_snd.sb_timeo : so->so_rcv.sb_timeo);
m->m_len = sizeof(struct timeval);
mtod(m, struct timeval *)->tv_sec = val / hz;
@@ -1167,7 +1167,7 @@ filt_soread(struct knote *kn, long hint)
kn->kn_data = so->so_rcv.sb_cc;
if (so->so_state & SS_CANTRCVMORE) {
- kn->kn_flags |= EV_EOF;
+ kn->kn_flags |= EV_EOF;
kn->kn_fflags = so->so_error;
return (1);
}
@@ -1198,7 +1198,7 @@ filt_sowrite(struct knote *kn, long hint)
kn->kn_data = sbspace(&so->so_snd);
if (so->so_state & SS_CANTSENDMORE) {
- kn->kn_flags |= EV_EOF;
+ kn->kn_flags |= EV_EOF;
kn->kn_fflags = so->so_error;
return (1);
}
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index fec9a367b3a..4f669b00488 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket2.c,v 1.17 2001/05/26 04:38:32 angelos Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.18 2001/06/22 14:14:10 deraadt Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@@ -81,7 +81,7 @@ u_long sb_max = SB_MAX; /* patchable */
* structure queued on so_q0 by calling sonewconn(). When the connection
* is established, soisconnected() is called, and transfers the
* socket structure to so_q, making it available to accept().
- *
+ *
* If a socket is closed with sockets on either
* so_q0 or so_q, these sockets are dropped.
*
@@ -164,7 +164,7 @@ sonewconn1(head, connstatus)
if (head->so_qlen + head->so_q0len > head->so_qlimit * 3)
return ((struct socket *)0);
MALLOC(so, struct socket *, sizeof(*so), M_SOCKET, M_DONTWAIT);
- if (so == NULL)
+ if (so == NULL)
return ((struct socket *)0);
bzero((caddr_t)so, sizeof(*so));
so->so_type = head->so_type;
@@ -285,7 +285,7 @@ sbwait(sb)
sb->sb_timeo));
}
-/*
+/*
* Lock a sockbuf already known to be locked;
* return any error returned from sleep (EINTR).
*/
@@ -297,9 +297,9 @@ sb_lock(sb)
while (sb->sb_flags & SB_LOCK) {
sb->sb_flags |= SB_WANT;
- error = tsleep((caddr_t)&sb->sb_flags,
- (sb->sb_flags & SB_NOINTR) ?
- PSOCK : PSOCK|PCATCH, netio, 0);
+ error = tsleep((caddr_t)&sb->sb_flags,
+ (sb->sb_flags & SB_NOINTR) ?
+ PSOCK : PSOCK|PCATCH, netio, 0);
if (error)
return (error);
}
@@ -669,8 +669,8 @@ sbcompress(sb, m, n)
eor |= m->m_flags & M_EOR;
if (m->m_len == 0 &&
(eor == 0 ||
- (((o = m->m_next) || (o = n)) &&
- o->m_type == m->m_type))) {
+ (((o = m->m_next) || (o = n)) &&
+ o->m_type == m->m_type))) {
m = m_free(m);
continue;
}
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 9cba7d90786..32a283b5633 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.38 2001/05/16 12:52:58 ho Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.39 2001/06/22 14:14:10 deraadt Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -179,7 +179,7 @@ sys_accept(p, v, retval)
break;
}
error = tsleep((caddr_t)&so->so_timeo, PSOCK | PCATCH,
- netcon, 0);
+ netcon, 0);
if (error) {
splx(s);
return (error);
@@ -268,7 +268,7 @@ sys_connect(p, v, retval)
s = splsoftnet();
while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
error = tsleep((caddr_t)&so->so_timeo, PSOCK | PCATCH,
- netcon, 0);
+ netcon, 0);
if (error)
break;
}
@@ -437,7 +437,7 @@ sendit(p, s, mp, flags, retsize)
#ifdef KTRACE
struct iovec *ktriov = NULL;
#endif
-
+
if ((error = getsock(p->p_fd, s, &fp)) != 0)
return (error);
auio.uio_iov = mp->msg_iov;
@@ -497,7 +497,7 @@ sendit(p, s, mp, flags, retsize)
#endif
len = auio.uio_resid;
error = sosend((struct socket *)fp->f_data, to, &auio,
- NULL, control, flags);
+ NULL, control, flags);
if (error) {
if (auio.uio_resid != len && (error == ERESTART ||
error == EINTR || error == EWOULDBLOCK))
@@ -540,8 +540,7 @@ sys_recvfrom(p, v, retval)
if (SCARG(uap, fromlenaddr)) {
error = copyin((caddr_t)SCARG(uap, fromlenaddr),
- (caddr_t)&msg.msg_namelen,
- sizeof (msg.msg_namelen));
+ (caddr_t)&msg.msg_namelen, sizeof (msg.msg_namelen));
if (error)
return (error);
} else
@@ -554,7 +553,7 @@ sys_recvfrom(p, v, retval)
msg.msg_control = 0;
msg.msg_flags = SCARG(uap, flags);
return (recvit(p, SCARG(uap, s), &msg,
- (caddr_t)SCARG(uap, fromlenaddr), retval));
+ (caddr_t)SCARG(uap, fromlenaddr), retval));
}
int
@@ -573,7 +572,7 @@ sys_recvmsg(p, v, retval)
register int error;
error = copyin((caddr_t)SCARG(uap, msg), (caddr_t)&msg,
- sizeof (msg));
+ sizeof (msg));
if (error)
return (error);
if (msg.msg_iovlen <= 0 || msg.msg_iovlen > IOV_MAX)
@@ -591,7 +590,7 @@ sys_recvmsg(p, v, retval)
uiov = msg.msg_iov;
msg.msg_iov = iov;
error = copyin((caddr_t)uiov, (caddr_t)iov,
- (unsigned)(msg.msg_iovlen * sizeof (struct iovec)));
+ (unsigned)(msg.msg_iovlen * sizeof (struct iovec)));
if (error)
goto done;
if ((error = recvit(p, SCARG(uap, s), &msg, (caddr_t)0, retval)) == 0) {
@@ -623,7 +622,7 @@ recvit(p, s, mp, namelenp, retsize)
#ifdef KTRACE
struct iovec *ktriov = NULL;
#endif
-
+
if ((error = getsock(p->p_fd, s, &fp)) != 0)
return (error);
auio.uio_iov = mp->msg_iov;
@@ -673,7 +672,7 @@ recvit(p, s, mp, namelenp, retsize)
if (len <= 0 || from == 0)
len = 0;
else {
- /* save sa_len before it is destroyed by MSG_COMPAT */
+ /* save sa_len before it is destroyed by MSG_COMPAT */
if (len > from->m_len)
len = from->m_len;
/* else if len < from->m_len ??? */
@@ -806,7 +805,7 @@ sys_setsockopt(p, v, retval)
if (m == NULL)
return (ENOBUFS);
error = copyin(SCARG(uap, val), mtod(m, caddr_t),
- SCARG(uap, valsize));
+ SCARG(uap, valsize));
if (error) {
(void) m_free(m);
return (error);
@@ -840,7 +839,7 @@ sys_getsockopt(p, v, retval)
return (error);
if (SCARG(uap, val)) {
error = copyin((caddr_t)SCARG(uap, avalsize),
- (caddr_t)&valsize, sizeof (valsize));
+ (caddr_t)&valsize, sizeof (valsize));
if (error)
return (error);
} else
@@ -874,7 +873,7 @@ sys_pipe(p, v, retval)
if ((error = sys_opipe(p, v, rval)) != 0)
return (error);
-
+
fds[0] = rval[0];
fds[1] = rval[1];
error = copyout((caddr_t)fds, (caddr_t)SCARG(uap, fdp),
diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c
index bd1d70d8b05..9de90d5920f 100644
--- a/sys/kern/vfs_cluster.c
+++ b/sys/kern/vfs_cluster.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_cluster.c,v 1.24 2001/05/28 00:23:02 gluk Exp $ */
+/* $OpenBSD: vfs_cluster.c,v 1.25 2001/06/22 14:14:10 deraadt Exp $ */
/* $NetBSD: vfs_cluster.c,v 1.12 1996/04/22 01:39:05 christos Exp $ */
/*-
@@ -156,7 +156,7 @@ cluster_read(vp, ci, filesize, lblkno, size, cred, bpp)
if (!ISSEQREAD(ci, lblkno)) {
ci->ci_ralen = 0;
ci->ci_maxra = lblkno;
- } else if ((u_quad_t)(ioblkno + 1) * (u_quad_t)size <= filesize &&
+ } else if ((u_quad_t)(ioblkno + 1) * (u_quad_t)size <= filesize &&
!alreadyincore &&
!(error = VOP_BMAP(vp, ioblkno, NULL, &blkno, &num_ra)) &&
blkno != -1) {
@@ -194,10 +194,10 @@ cluster_read(vp, ci, filesize, lblkno, size, cred, bpp)
bp->b_blkno = blkno;
/* Case 5: check how many blocks to read ahead */
++ioblkno;
- if ((u_quad_t)(ioblkno + 1) * (u_quad_t)size
- > filesize ||
+ if ((u_quad_t)(ioblkno + 1) * (u_quad_t)size >
+ filesize ||
incore(vp, ioblkno) || (error = VOP_BMAP(vp,
- ioblkno, NULL, &blkno, &num_ra)) || blkno == -1)
+ ioblkno, NULL, &blkno, &num_ra)) || blkno == -1)
goto skip_readahead;
/*
* Adjust readahead as above.
@@ -241,7 +241,7 @@ skip_readahead:
if (bp) {
if (bp->b_flags & (B_DONE | B_DELWRI))
panic("cluster_read: DONE bp");
- else
+ else
error = VOP_STRATEGY(bp);
}
@@ -483,22 +483,22 @@ cluster_callback(bp)
*/
void
cluster_write(bp, ci, filesize)
- struct buf *bp;
+ struct buf *bp;
struct cluster_info *ci;
u_quad_t filesize;
{
- struct vnode *vp;
- daddr_t lbn;
- int maxclen, cursize;
+ struct vnode *vp;
+ daddr_t lbn;
+ int maxclen, cursize;
- vp = bp->b_vp;
- lbn = bp->b_lblkno;
+ vp = bp->b_vp;
+ lbn = bp->b_lblkno;
/* Initialize vnode to beginning of file. */
if (lbn == 0)
ci->ci_lasta = ci->ci_clen = ci->ci_cstart = ci->ci_lastw = 0;
- if (ci->ci_clen == 0 || lbn != ci->ci_lastw + 1 ||
+ if (ci->ci_clen == 0 || lbn != ci->ci_lastw + 1 ||
(bp->b_blkno != ci->ci_lasta + btodb(bp->b_bcount))) {
maxclen = MAXBSIZE / vp->v_mount->mnt_stat.f_iosize - 1;
if (ci->ci_clen != 0) {
@@ -528,7 +528,7 @@ cluster_write(bp, ci, filesize)
* Failed, push the previous cluster.
*/
for (bpp = buflist->bs_children;
- bpp < endbp; bpp++)
+ bpp < endbp; bpp++)
brelse(*bpp);
free(buflist, M_SEGMENT);
cluster_wbuild(vp, NULL, bp->b_bcount,
@@ -538,7 +538,7 @@ cluster_write(bp, ci, filesize)
* Succeeded, keep building cluster.
*/
for (bpp = buflist->bs_children;
- bpp <= endbp; bpp++)
+ bpp <= endbp; bpp++)
bdwrite(*bpp);
free(buflist, M_SEGMENT);
ci->ci_lastw = lbn;
@@ -554,7 +554,7 @@ cluster_write(bp, ci, filesize)
*/
if ((u_quad_t)(lbn + 1) * (u_quad_t)bp->b_bcount != filesize &&
(VOP_BMAP(vp, lbn, NULL, &bp->b_blkno, &maxclen) ||
- bp->b_blkno == -1)) {
+ bp->b_blkno == -1)) {
bawrite(bp);
ci->ci_clen = 0;
ci->ci_lasta = bp->b_blkno;
@@ -562,13 +562,13 @@ cluster_write(bp, ci, filesize)
ci->ci_lastw = lbn;
return;
}
- ci->ci_clen = maxclen;
- if (maxclen == 0) { /* I/O not contiguous */
+ ci->ci_clen = maxclen;
+ if (maxclen == 0) { /* I/O not contiguous */
ci->ci_cstart = lbn + 1;
- bawrite(bp);
- } else { /* Wait for rest of cluster */
+ bawrite(bp);
+ } else { /* Wait for rest of cluster */
ci->ci_cstart = lbn;
- bdwrite(bp);
+ bdwrite(bp);
}
} else if (lbn == ci->ci_cstart + ci->ci_clen) {
/*
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index dae644d9c14..c00deeb9d14 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_default.c,v 1.5 2001/06/05 20:54:52 provos Exp $ */
+/* $OpenBSD: vfs_default.c,v 1.6 2001/06/22 14:14:10 deraadt Exp $ */
/*
@@ -67,7 +67,7 @@ vop_generic_revoke(v)
void *v;
{
struct vop_revoke_args /* {
- struct vnode *a_vp;
+ struct vnode *a_vp;
int a_flags;
} */ *ap = v;
struct vnode *vp, *vq;
@@ -208,13 +208,13 @@ vop_generic_lock(v)
vnflags |= LK_INTERLOCK;
return(lockmgr(vp->v_vnlock, vnflags, &vp->v_interlock, ap->a_p));
#else /* for now */
- /*
- * Since we are not using the lock manager, we must clear
- * the interlock here.
- */
- if (ap->a_flags & LK_INTERLOCK)
- simple_unlock(&ap->a_vp->v_interlock);
- return (0);
+ /*
+ * Since we are not using the lock manager, we must clear
+ * the interlock here.
+ */
+ if (ap->a_flags & LK_INTERLOCK)
+ simple_unlock(&ap->a_vp->v_interlock);
+ return (0);
#endif
}
diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c
index c99dad50bcf..38592b6d962 100644
--- a/sys/kern/vfs_init.c
+++ b/sys/kern/vfs_init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_init.c,v 1.10 2000/09/27 16:13:46 mickey Exp $ */
+/* $OpenBSD: vfs_init.c,v 1.11 2001/06/22 14:14:10 deraadt Exp $ */
/* $NetBSD: vfs_init.c,v 1.6 1996/02/09 19:00:58 christos Exp $ */
/*
@@ -131,8 +131,7 @@ vfs_opv_init_explicit(vfs_opv_desc)
}
for (opve_descp = vfs_opv_desc->opv_desc_ops;
- opve_descp->opve_op;
- opve_descp++) {
+ opve_descp->opve_op; opve_descp++) {
/*
* Sanity check: is this operation listed
* in the list of operations? We check this
@@ -182,7 +181,7 @@ vfs_opv_init_default(vfs_opv_desc)
for (j = 0; j < vfs_opv_numops; j++)
if (opv_desc_vector[j] == NULL)
- opv_desc_vector[j] =
+ opv_desc_vector[j] =
opv_desc_vector[VOFFSET(vop_default)];
}
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index a26cf001f81..e354cea4b5d 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_lookup.c,v 1.18 2000/11/10 18:15:48 art Exp $ */
+/* $OpenBSD: vfs_lookup.c,v 1.19 2001/06/22 14:14:10 deraadt Exp $ */
/* $NetBSD: vfs_lookup.c,v 1.17 1996/02/09 19:00:59 christos Exp $ */
/*
@@ -132,14 +132,14 @@ namei(ndp)
}
/*
- * Strip trailing slashes, as requested
+ * Strip trailing slashes, as requested
*/
if (cnp->cn_flags & STRIPSLASHES) {
char *end = cnp->cn_pnbuf + ndp->ni_pathlen - 2;
cp = end;
- while (cp >= cnp->cn_pnbuf &&
- (*cp == '/')) cp--;
+ while (cp >= cnp->cn_pnbuf && (*cp == '/'))
+ cp--;
/* Still some remaining characters in the buffer */
if (cp >= cnp->cn_pnbuf) {
@@ -147,7 +147,7 @@ namei(ndp)
*(cp + 1) = '\0';
}
}
-
+
ndp->ni_loopcnt = 0;
/*
@@ -259,7 +259,7 @@ badlink:
* the target is returned locked, otherwise it is returned unlocked.
* When creating or renaming and LOCKPARENT is specified, the target may not
* be ".". When deleting and LOCKPARENT is specified, the target may be ".".
- *
+ *
* Overall outline of lookup:
*
* dirloop:
@@ -514,8 +514,8 @@ unionlookup:
* if so find the root of the mounted file system.
*/
while (dp->v_type == VDIR && (mp = dp->v_mountedhere) &&
- (cnp->cn_flags & NOCROSSMOUNT) == 0) {
- if (vfs_busy(mp, 0, 0, p))
+ (cnp->cn_flags & NOCROSSMOUNT) == 0) {
+ if (vfs_busy(mp, 0, 0, p))
continue;
error = VFS_ROOT(mp, &tdp);
vfs_unbusy(mp, p);
@@ -567,7 +567,7 @@ terminal:
*/
if (rdonly || (dp->v_mount->mnt_flag & MNT_RDONLY) ||
(wantparent &&
- (ndp->ni_dvp->v_mount->mnt_flag & MNT_RDONLY))) {
+ (ndp->ni_dvp->v_mount->mnt_flag & MNT_RDONLY))) {
error = EROFS;
goto bad2;
}
@@ -707,7 +707,7 @@ relookup(dvp, vpp, cnp)
*/
if (rdonly || (dp->v_mount->mnt_flag & MNT_RDONLY) ||
(wantparent &&
- (dvp->v_mount->mnt_flag & MNT_RDONLY))) {
+ (dvp->v_mount->mnt_flag & MNT_RDONLY))) {
error = EROFS;
goto bad2;
}
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index e80f0e6d0d6..7d22512d8cf 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.61 2001/06/05 21:47:07 provos Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.62 2001/06/22 14:14:10 deraadt Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -94,7 +94,7 @@ int suid_clear = 1; /* 1 => clear SUID / SGID on owner change */
#define bufremvn(bp) { \
LIST_REMOVE(bp, b_vnbufs); \
(bp)->b_vnbufs.le_next = NOLIST; \
-}
+}
struct freelst vnode_hold_list; /* list of vnodes referencing buffers */
struct freelst vnode_free_list; /* vnode free list */
@@ -186,7 +186,7 @@ vfs_busy(mp, flags, interlkp, p)
lkflags |= LK_INTERLOCK;
if (lockmgr(&mp->mnt_lock, lkflags, interlkp, p))
panic("vfs_busy: unexpected lock failure");
- return (0);
+ return (0);
}
@@ -217,7 +217,7 @@ vfs_rootmountalloc(fstypename, devname, mpp)
struct proc *p = curproc; /* XXX */
struct vfsconf *vfsp;
struct mount *mp;
-
+
for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
if (!strcmp(vfsp->vfc_name, fstypename))
break;
@@ -253,7 +253,7 @@ vfs_mountroot()
struct vfsconf *vfsp;
extern int (*mountroot)(void);
int error;
-
+
if (mountroot != NULL)
return ((*mountroot)());
for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next) {
@@ -265,7 +265,7 @@ vfs_mountroot()
}
return (ENODEV);
}
-
+
/*
* Lookup a mount point by filesystem identifier.
*/
@@ -403,7 +403,7 @@ getnewvnode(tag, mp, vops, vpp)
s = splbio();
if ((numvnodes < desiredvnodes) ||
((TAILQ_FIRST(listhd = &vnode_free_list) == NULL) &&
- ((TAILQ_FIRST(listhd = &vnode_hold_list) == NULL) || toggle))) {
+ ((TAILQ_FIRST(listhd = &vnode_hold_list) == NULL) || toggle))) {
splx(s);
simple_unlock(&vnode_free_list_slock);
vp = pool_get(&vnode_pool, PR_WAITOK);
@@ -411,7 +411,7 @@ getnewvnode(tag, mp, vops, vpp)
numvnodes++;
} else {
for (vp = TAILQ_FIRST(listhd); vp != NULLVP;
- vp = TAILQ_NEXT(vp, v_freelist)) {
+ vp = TAILQ_NEXT(vp, v_freelist)) {
if (simple_lock_try(&vp->v_interlock))
break;
}
@@ -481,7 +481,7 @@ insmntque(vp, mp)
/*
* Delete from old mount point vnode list, if on one.
*/
-
+
if (vp->v_mount != NULL)
LIST_REMOVE(vp, v_mntvnodes);
/*
@@ -599,8 +599,7 @@ loop:
break;
}
-
- /*
+ /*
* Common case is actually in the if statement
*/
if (vp == NULL || !(vp->v_tag == VT_NON && vp->v_type == VBLK)) {
@@ -621,14 +620,14 @@ loop:
return (NULLVP);
}
- /*
+ /*
* This code is the uncommon case. It is called in case
* we found an alias that was VT_NON && vtype of VBLK
* This means we found a block device that was created
* using bdevvp.
* An example of such a vnode is the root partition device vnode
* craeted in ffs_mountroot.
- *
+ *
* The vnodes created by bdevvp should not be aliased (why?).
*/
@@ -653,7 +652,7 @@ loop:
*/
int
vget(vp, flags, p)
- struct vnode *vp;
+ struct vnode *vp;
int flags;
struct proc *p;
{
@@ -721,17 +720,16 @@ vref(vp)
static __inline__ void
vputonfreelist(vp)
- struct vnode *vp;
-
+ struct vnode *vp;
{
- int s;
+ int s;
struct freelst *lst;
s = splbio();
#ifdef DIAGNOSTIC
if (vp->v_usecount != 0)
panic("Use count is not zero!");
-
+
if (vp->v_bioflag & VBIOONFREELIST) {
vprint("vnode already on free list: ", vp);
panic("vnode already on free list");
@@ -740,11 +738,11 @@ vputonfreelist(vp)
vp->v_bioflag |= VBIOONFREELIST;
- if (vp->v_holdcnt > 0)
+ if (vp->v_holdcnt > 0)
lst = &vnode_hold_list;
else
lst = &vnode_free_list;
-
+
if (vp->v_type == VBAD)
TAILQ_INSERT_HEAD(lst, vp, v_freelist);
else
@@ -769,7 +767,7 @@ vput(vp)
simple_lock(&vp->v_interlock);
#ifdef DIAGNOSTIC
- if (vp->v_usecount == 0) {
+ if (vp->v_usecount == 0) {
vprint("vrele: bad ref count", vp);
panic("vrele: ref cnt");
}
@@ -786,7 +784,7 @@ vput(vp)
vprint("vrele: bad writecount", vp);
panic("vrele: v_writecount != 0");
}
-#endif
+#endif
vputonfreelist(vp);
simple_unlock(&vp->v_interlock);
@@ -810,7 +808,7 @@ vrele(vp)
#endif
simple_lock(&vp->v_interlock);
#ifdef DIAGNOSTIC
- if (vp->v_usecount == 0) {
+ if (vp->v_usecount == 0) {
vprint("vrele: bad ref count", vp);
panic("vrele: ref cnt");
}
@@ -893,7 +891,7 @@ loop:
*/
if (vp == skipvp)
continue;
-
+
simple_lock(&vp->v_interlock);
/*
* Skip over a vnodes marked VSYSTEM.
@@ -1129,7 +1127,7 @@ vgonel(vp, p)
if (vp->v_mount != NULL)
insmntque(vp, (struct mount *)0);
/*
- * If special device, remove it from special device alias list
+ * If special device, remove it from special device alias list
* if it is on one.
*/
if ((vp->v_type == VBLK || vp->v_type == VCHR) && vp->v_specinfo != 0) {
@@ -1168,7 +1166,7 @@ vgonel(vp, p)
}
/*
* If it is on the freelist and not already at the head,
- * move it to the head of the list.
+ * move it to the head of the list.
*/
vp->v_type = VBAD;
@@ -1179,7 +1177,8 @@ vgonel(vp, p)
if (vp->v_usecount == 0 &&
(vp->v_bioflag & VBIOONFREELIST)) {
int s;
- simple_lock(&vnode_free_list_slock);
+
+ simple_lock(&vnode_free_list_slock);
s = splbio();
if (vp->v_holdcnt > 0)
@@ -1190,7 +1189,7 @@ vgonel(vp, p)
TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist);
}
splx(s);
- simple_unlock(&vnode_free_list_slock);
+ simple_unlock(&vnode_free_list_slock);
}
}
@@ -1325,14 +1324,13 @@ printlockedvnodes()
printf("Locked vnodes\n");
simple_lock(&mountlist_slock);
for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist);
- mp = nmp) {
- if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) {
+ mp = nmp) {
+ if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) {
nmp = CIRCLEQ_NEXT(mp, mnt_list);
continue;
}
- for (vp = mp->mnt_vnodelist.lh_first;
- vp != NULL;
- vp = vp->v_mntvnodes.le_next) {
+ for (vp = mp->mnt_vnodelist.lh_first; vp;
+ vp = vp->v_mntvnodes.le_next) {
if (VOP_ISLOCKED(vp))
vprint((char *)0, vp);
}
@@ -1417,19 +1415,18 @@ sysctl_vnode(where, sizep, p)
return (0);
}
ewhere = where + *sizep;
-
+
simple_lock(&mountlist_slock);
for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist);
- mp = nmp) {
+ mp = nmp) {
if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) {
nmp = CIRCLEQ_NEXT(mp, mnt_list);
continue;
}
savebp = bp;
again:
- for (vp = mp->mnt_vnodelist.lh_first;
- vp != NULL;
- vp = nvp) {
+ for (vp = mp->mnt_vnodelist.lh_first; vp != NULL;
+ vp = nvp) {
/*
* Check that the vp is still associated with
* this filesystem. RACE: could have been
@@ -1644,7 +1641,7 @@ vfs_export_lookup(mp, nep, nam)
if (rnh != NULL) {
np = (struct netcred *)
(*rnh->rnh_matchaddr)((caddr_t)saddr,
- rnh);
+ rnh);
if (np && np->netc_rnodes->rn_flags & RNF_ROOT)
np = NULL;
}
@@ -1672,13 +1669,13 @@ vaccess(file_mode, uid, gid, acc_mode, cred)
struct ucred *cred;
{
mode_t mask;
-
+
/* User id 0 always gets access. */
if (cred->cr_uid == 0)
return 0;
-
+
mask = 0;
-
+
/* Otherwise, check the owner. */
if (cred->cr_uid == uid) {
if (acc_mode & VEXEC)
@@ -1689,7 +1686,7 @@ vaccess(file_mode, uid, gid, acc_mode, cred)
mask |= S_IWUSR;
return (file_mode & mask) == mask ? 0 : EACCES;
}
-
+
/* Otherwise, check the groups. */
if (cred->cr_gid == gid || groupmember(gid, cred)) {
if (acc_mode & VEXEC)
@@ -1700,7 +1697,7 @@ vaccess(file_mode, uid, gid, acc_mode, cred)
mask |= S_IWGRP;
return (file_mode & mask) == mask ? 0 : EACCES;
}
-
+
/* Otherwise, check everyone else. */
if (acc_mode & VEXEC)
mask |= S_IXOTH;
@@ -1725,7 +1722,7 @@ vfs_unmountall()
retry:
allerror = 0;
for (mp = CIRCLEQ_LAST(&mountlist); mp != CIRCLEQ_END(&mountlist);
- mp = nmp) {
+ mp = nmp) {
nmp = CIRCLEQ_PREV(mp, mnt_list);
if ((error = dounmount(mp, MNT_FORCE, curproc)) != 0) {
printf("unmount of %s failed with error %d\n",
@@ -1792,7 +1789,7 @@ vfs_syncwait(verbose)
p = curproc? curproc : &proc0;
sys_sync(p, (void *)0, (register_t *)0);
-
+
/* Wait for sync to finish. */
dcount = 10000;
for (iter = 0; iter < 20; iter++) {
@@ -1824,7 +1821,7 @@ vfs_syncwait(verbose)
if (verbose)
printf("%d ", nbusy);
DELAY(40000 * iter);
- }
+ }
return nbusy;
}
@@ -1883,8 +1880,8 @@ fs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
}
-/*
- * Routines dealing with vnodes and buffers
+/*
+ * Routines dealing with vnodes and buffers
*/
/*
@@ -1964,7 +1961,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
loop:
s = splbio();
for (;;) {
- if ((blist = vp->v_cleanblkhd.lh_first) &&
+ if ((blist = vp->v_cleanblkhd.lh_first) &&
(flags & V_SAVEMETA))
while (blist && blist->b_lblkno < 0)
blist = blist->b_vnbufs.le_next;
@@ -2080,7 +2077,7 @@ bgetvp(vp, bp)
/*
* Disassociate a buffer from a vnode.
- *
+ *
* Manipulates vnode buffer queues. Must be called at splbio().
*/
void
@@ -2112,7 +2109,7 @@ brelvp(bp)
/*
* If it is on the holdlist and the hold count drops to
- * zero, move it to the free list.
+ * zero, move it to the free list.
*/
if ((vp->v_bioflag & VBIOONFREELIST) &&
vp->v_holdcnt == 0 && vp->v_usecount == 0) {
@@ -2142,7 +2139,7 @@ buf_replacevnode(bp, newvp)
if (oldvp)
brelvp(bp);
-
+
if ((bp->b_flags & (B_READ | B_DONE)) == 0) {
newvp->v_numoutput++; /* put it on swapdev */
vwakeup(oldvp);
@@ -2223,9 +2220,8 @@ vfs_register(vfs)
#endif
/* Check if filesystem already known */
- for (vfspp = &vfsconf, vfsp = vfsconf;
- vfsp;
- vfspp = &vfsp->vfc_next, vfsp = vfsp->vfc_next)
+ for (vfspp = &vfsconf, vfsp = vfsconf; vfsp;
+ vfspp = &vfsp->vfc_next, vfsp = vfsp->vfc_next)
if (strcmp(vfsp->vfc_name, vfs->vfc_name) == 0)
return (EEXIST);
@@ -2243,7 +2239,7 @@ vfs_register(vfs)
return 0;
}
-
+
int
vfs_unregister(vfs)
struct vfsconf *vfs;
@@ -2253,20 +2249,19 @@ vfs_unregister(vfs)
int maxtypenum;
/* Find our vfsconf struct */
- for (vfspp = &vfsconf, vfsp = vfsconf;
- vfsp;
- vfspp = &vfsp->vfc_next, vfsp = vfsp->vfc_next) {
+ for (vfspp = &vfsconf, vfsp = vfsconf; vfsp;
+ vfspp = &vfsp->vfc_next, vfsp = vfsp->vfc_next) {
if (strcmp(vfsp->vfc_name, vfs->vfc_name) == 0)
break;
}
- if (!vfsp) /* Not found */
+ if (!vfsp) /* Not found */
return (ENOENT);
- if (vfsp->vfc_refcount) /* In use */
+ if (vfsp->vfc_refcount) /* In use */
return (EBUSY);
- /* Remove from list and free */
+ /* Remove from list and free */
*vfspp = vfsp->vfc_next;
maxtypenum = 0;
@@ -2276,7 +2271,6 @@ vfs_unregister(vfs)
maxtypenum = vfsp->vfc_typenum;
maxvfsconf = maxtypenum;
-
return 0;
}
diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c
index 6c2bcf36579..3b8c9274f39 100644
--- a/sys/kern/vfs_sync.c
+++ b/sys/kern/vfs_sync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_sync.c,v 1.18 2001/03/16 15:51:58 art Exp $ */
+/* $OpenBSD: vfs_sync.c,v 1.19 2001/06/22 14:14:11 deraadt Exp $ */
/*
* Portions of this code are:
@@ -61,7 +61,7 @@ int softdep_process_worklist __P((struct mount *));
/*
* The workitem queue.
- */
+ */
#define SYNCER_MAXDELAY 32 /* maximum sync delay time */
#define SYNCER_DEFAULT 30 /* default sync delay time */
int syncer_maxdelay = SYNCER_MAXDELAY; /* maximum delay time */
@@ -69,7 +69,7 @@ time_t syncdelay = SYNCER_DEFAULT; /* time to delay syncing vnodes */
int rushjob = 0; /* number of slots to run ASAP */
int stat_rush_requests = 0; /* number of rush requests */
-
+
static int syncer_delayno = 0;
static long syncer_mask;
LIST_HEAD(synclist, vnode);
@@ -79,7 +79,7 @@ struct proc *syncerproc;
/*
* The workitem queue.
- *
+ *
* It is useful to delay writes of file data and filesystem metadata
* for tens of seconds so that quickly created and deleted files need
* not waste disk bandwidth being created and removed. To realize this,
@@ -139,7 +139,7 @@ vn_syncer_add_to_worklist(vp, delay)
* System filesystem synchronizer daemon.
*/
-void
+void
sched_sync(p)
struct proc *p;
{
@@ -178,8 +178,8 @@ sched_sync(p)
if (LIST_FIRST(slp) == vp) {
/*
* Note: disk vps can remain on the
- * worklist too with no dirty blocks, but
- * since sync_fsync() moves it to a different
+ * worklist too with no dirty blocks, but
+ * since sync_fsync() moves it to a different
* slot we are safe.
*/
if (LIST_FIRST(&vp->v_dirtyblkhd) == NULL &&
@@ -264,7 +264,7 @@ int sync_inactive __P((void *));
#define sync_unlock vop_generic_unlock
int sync_print __P((void *));
#define sync_islocked vop_generic_islocked
-
+
int (**sync_vnodeop_p) __P((void *));
struct vnodeopv_entry_desc sync_vnodeop_entries[] = {
{ &vop_default_desc, vn_default_error },
@@ -278,8 +278,9 @@ struct vnodeopv_entry_desc sync_vnodeop_entries[] = {
{ &vop_islocked_desc, sync_islocked }, /* islocked */
{ (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
};
-struct vnodeopv_desc sync_vnodeop_opv_desc =
- { &sync_vnodeop_p, sync_vnodeop_entries };
+struct vnodeopv_desc sync_vnodeop_opv_desc = {
+ &sync_vnodeop_p, sync_vnodeop_entries
+};
/*
* Create a new filesystem syncer vnode for the specified mount point.
@@ -399,14 +400,14 @@ sync_print(v)
void *v;
{
- struct vop_print_args /* {
- struct vnode *a_vp;
- } */ *ap = v;
- struct vnode *vp = ap->a_vp;
-
- printf("syncer vnode");
- if (vp->v_vnlock != NULL)
- lockmgr_printinfo(vp->v_vnlock);
- printf("\n");
- return (0);
+ struct vop_print_args /* {
+ struct vnode *a_vp;
+ } */ *ap = v;
+ struct vnode *vp = ap->a_vp;
+
+ printf("syncer vnode");
+ if (vp->v_vnlock != NULL)
+ lockmgr_printinfo(vp->v_vnlock);
+ printf("\n");
+ return (0);
}
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index fc064d9fe46..0ca88c8e73f 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.76 2001/05/23 13:15:07 art Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.77 2001/06/22 14:14:11 deraadt Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -72,15 +72,15 @@ static int change_dir __P((struct nameidata *, struct proc *));
void checkdirs __P((struct vnode *));
/*
- * Redirection info so we don't have to include the union fs routines in
+ * Redirection info so we don't have to include the union fs routines in
* the kernel directly. This way, we can build unionfs as an LKM. The
* pointer gets filled in later, when we modload the LKM, or when the
* compiled-in unionfs code gets initialized. For now, we just set
* it to a stub routine.
*/
-int (*union_check_p) __P((struct proc *, struct vnode **,
- struct file *, struct uio, int *)) = NULL;
+int (*union_check_p) __P((struct proc *, struct vnode **,
+ struct file *, struct uio, int *)) = NULL;
/*
* Virtual File System System Calls
@@ -171,7 +171,7 @@ sys_mount(p, v, retval)
*/
if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)) ||
(va.va_uid != p->p_ucred->cr_uid &&
- (error = suser(p->p_ucred, &p->p_acflag)))) {
+ (error = suser(p->p_ucred, &p->p_acflag)))) {
vput(vp);
return (error);
}
@@ -200,9 +200,9 @@ sys_mount(p, v, retval)
* If we get an integer for the filesystem type instead of a
* string, we check to see if it matches one of the historic
* filesystem types.
- */
+ */
fstypenum = (u_long)SCARG(uap, type);
-
+
for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
if (vfsp->vfc_typenum == fstypenum)
break;
@@ -258,7 +258,7 @@ update:
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_SOFTDEP |
MNT_NOATIME | MNT_FORCE);
mp->mnt_flag |= SCARG(uap, flags) & (MNT_NOSUID | MNT_NOEXEC |
- MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC |
+ MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC |
MNT_SOFTDEP | MNT_NOATIME | MNT_FORCE);
/*
* Mount the filesystem.
@@ -442,7 +442,7 @@ dounmount(mp, flags, p)
if (mp->mnt_syncer != NULL)
vgone(mp->mnt_syncer);
if (((mp->mnt_flag & MNT_RDONLY) ||
- (error = VFS_SYNC(mp, MNT_WAIT, p->p_ucred, p)) == 0) ||
+ (error = VFS_SYNC(mp, MNT_WAIT, p->p_ucred, p)) == 0) ||
(flags & MNT_FORCE))
error = VFS_UNMOUNT(mp, flags, p);
simple_lock(&mountlist_slock);
@@ -492,7 +492,7 @@ sys_sync(p, v, retval)
simple_lock(&mountlist_slock);
for (mp = CIRCLEQ_LAST(&mountlist); mp != CIRCLEQ_END(&mountlist);
- mp = nmp) {
+ mp = nmp) {
if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) {
nmp = CIRCLEQ_PREV(mp, mnt_list);
continue;
@@ -657,7 +657,7 @@ sys_getfsstat(p, v, retval)
count = 0;
simple_lock(&mountlist_slock);
for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist);
- mp = nmp) {
+ mp = nmp) {
if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) {
nmp = CIRCLEQ_NEXT(mp, mnt_list);
continue;
@@ -669,7 +669,7 @@ sys_getfsstat(p, v, retval)
if (flags != MNT_NOWAIT &&
flags != MNT_LAZY &&
(flags == MNT_WAIT ||
- flags == 0) &&
+ flags == 0) &&
(error = VFS_STATFS(mp, sp, p))) {
simple_lock(&mountlist_slock);
nmp = CIRCLEQ_NEXT(mp, mnt_list);
@@ -737,7 +737,7 @@ sys_fchdir(p, v, retval)
error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p);
while (!error && (mp = vp->v_mountedhere) != NULL) {
- if (vfs_busy(mp, 0, 0, p))
+ if (vfs_busy(mp, 0, 0, p))
continue;
error = VFS_ROOT(mp, &tdp);
vfs_unbusy(mp, p);
@@ -969,7 +969,7 @@ sys_getfh(p, v, retval)
* Must be super user
*/
error = suser(p->p_ucred, &p->p_acflag);
- if(error)
+ if (error)
return (error);
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
SCARG(uap, fname), p);
@@ -2036,90 +2036,90 @@ sys_fchown(p, v, retval)
struct vattr vattr;
int error;
struct file *fp;
- u_short mode;
+ u_short mode;
- if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
- return (error);
- vp = (struct vnode *)fp->f_data;
- VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
+ if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
+ return (error);
+ vp = (struct vnode *)fp->f_data;
+ VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
- if (vp->v_mount->mnt_flag & MNT_RDONLY)
- error = EROFS;
- else {
+ if (vp->v_mount->mnt_flag & MNT_RDONLY)
+ error = EROFS;
+ else {
if ((SCARG(uap, uid) != -1 || SCARG(uap, gid) != -1) &&
(suser(p->p_ucred, &p->p_acflag) || suid_clear)) {
- error = VOP_GETATTR(vp, &vattr, p->p_ucred, p);
- if (error)
- goto out;
- mode = vattr.va_mode & ~(VSUID | VSGID);
- if (mode == vattr.va_mode)
- mode = VNOVAL;
- }
- else
- mode = VNOVAL;
- VATTR_NULL(&vattr);
- vattr.va_uid = SCARG(uap, uid);
- vattr.va_gid = SCARG(uap, gid);
- vattr.va_mode = mode;
- error = VOP_SETATTR(vp, &vattr, p->p_ucred, p);
- }
+ error = VOP_GETATTR(vp, &vattr, p->p_ucred, p);
+ if (error)
+ goto out;
+ mode = vattr.va_mode & ~(VSUID | VSGID);
+ if (mode == vattr.va_mode)
+ mode = VNOVAL;
+ } else
+ mode = VNOVAL;
+ VATTR_NULL(&vattr);
+ vattr.va_uid = SCARG(uap, uid);
+ vattr.va_gid = SCARG(uap, gid);
+ vattr.va_mode = mode;
+ error = VOP_SETATTR(vp, &vattr, p->p_ucred, p);
+ }
out:
- VOP_UNLOCK(vp, 0, p);
- return (error);
+ VOP_UNLOCK(vp, 0, p);
+ return (error);
}
+
/*
* Set the access and modification times given a path name.
*/
/* ARGSUSED */
int
sys_utimes(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
+ struct proc *p;
+ void *v;
+ register_t *retval;
{
- register struct sys_utimes_args /* {
- syscallarg(char *) path;
- syscallarg(struct timeval *) tptr;
- } */ *uap = v;
- register struct vnode *vp;
- struct timeval tv[2];
- struct vattr vattr;
- int error;
- struct nameidata nd;
-
- VATTR_NULL(&vattr);
- if (SCARG(uap, tptr) == NULL) {
- microtime(&tv[0]);
- tv[1] = tv[0];
- vattr.va_vaflags |= VA_UTIMES_NULL;
- } else {
- error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv,
- sizeof (tv));
- if (error)
- return (error);
+ register struct sys_utimes_args /* {
+ syscallarg(char *) path;
+ syscallarg(struct timeval *) tptr;
+ } */ *uap = v;
+ register struct vnode *vp;
+ struct timeval tv[2];
+ struct vattr vattr;
+ int error;
+ struct nameidata nd;
+
+ VATTR_NULL(&vattr);
+ if (SCARG(uap, tptr) == NULL) {
+ microtime(&tv[0]);
+ tv[1] = tv[0];
+ vattr.va_vaflags |= VA_UTIMES_NULL;
+ } else {
+ error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv,
+ sizeof (tv));
+ if (error)
+ return (error);
/* XXX workaround timeval matching the VFS constant VNOVAL */
if (tv[0].tv_sec == VNOVAL)
tv[0].tv_sec = VNOVAL - 1;
if (tv[1].tv_sec == VNOVAL)
tv[1].tv_sec = VNOVAL - 1;
- }
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
- if ((error = namei(&nd)) != 0)
- return (error);
- vp = nd.ni_vp;
- VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
+ }
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
+ if ((error = namei(&nd)) != 0)
+ return (error);
+ vp = nd.ni_vp;
+ VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
- if (vp->v_mount->mnt_flag & MNT_RDONLY)
- error = EROFS;
- else {
- vattr.va_atime.tv_sec = tv[0].tv_sec;
- vattr.va_atime.tv_nsec = tv[0].tv_usec * 1000;
- vattr.va_mtime.tv_sec = tv[1].tv_sec;
- vattr.va_mtime.tv_nsec = tv[1].tv_usec * 1000;
- error = VOP_SETATTR(vp, &vattr, p->p_ucred, p);
- }
+ if (vp->v_mount->mnt_flag & MNT_RDONLY)
+ error = EROFS;
+ else {
+ vattr.va_atime.tv_sec = tv[0].tv_sec;
+ vattr.va_atime.tv_nsec = tv[0].tv_usec * 1000;
+ vattr.va_mtime.tv_sec = tv[1].tv_sec;
+ vattr.va_mtime.tv_nsec = tv[1].tv_usec * 1000;
+ error = VOP_SETATTR(vp, &vattr, p->p_ucred, p);
+ }
vput(vp);
- return (error);
+ return (error);
}
@@ -2150,7 +2150,7 @@ sys_futimes(p, v, retval)
vattr.va_vaflags |= VA_UTIMES_NULL;
} else {
error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv,
- sizeof (tv));
+ sizeof (tv));
if (error)
return (error);
/* XXX workaround timeval matching the VFS constant VNOVAL */
@@ -2311,14 +2311,14 @@ sys_rename(p, v, retval)
fvp = fromnd.ni_vp;
flags = LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART;
- /*
+ /*
* rename("foo/", "bar/"); is OK
*/
if (fvp->v_type == VDIR)
flags |= STRIPSLASHES;
NDINIT(&tond, RENAME, flags,
- UIO_USERSPACE, SCARG(uap, to), p);
+ UIO_USERSPACE, SCARG(uap, to), p);
if ((error = namei(&tond)) != 0) {
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
vrele(fromnd.ni_dvp);
@@ -2401,9 +2401,8 @@ sys_mkdir(p, v, retval)
int error;
struct nameidata nd;
-
- NDINIT(&nd, CREATE, LOCKPARENT | STRIPSLASHES,
- UIO_USERSPACE, SCARG(uap, path), p);
+ NDINIT(&nd, CREATE, LOCKPARENT | STRIPSLASHES,
+ UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
@@ -2628,52 +2627,52 @@ getvnode(fdp, fd, fpp)
*/
int
sys_pread(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
+ struct proc *p;
+ void *v;
+ register_t *retval;
{
- struct sys_pread_args /* {
- syscallarg(int) fd;
- syscallarg(void *) buf;
- syscallarg(size_t) nbyte;
- syscallarg(int) pad;
- syscallarg(off_t) offset;
- } */ *uap = v;
- struct filedesc *fdp = p->p_fd;
- struct file *fp;
- struct vnode *vp;
- off_t offset;
- int error, fd = SCARG(uap, fd);
-
- if ((u_int)fd >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[fd]) == NULL ||
+ struct sys_pread_args /* {
+ syscallarg(int) fd;
+ syscallarg(void *) buf;
+ syscallarg(size_t) nbyte;
+ syscallarg(int) pad;
+ syscallarg(off_t) offset;
+ } */ *uap = v;
+ struct filedesc *fdp = p->p_fd;
+ struct file *fp;
+ struct vnode *vp;
+ off_t offset;
+ int error, fd = SCARG(uap, fd);
+
+ if ((u_int)fd >= fdp->fd_nfiles ||
+ (fp = fdp->fd_ofiles[fd]) == NULL ||
#if notyet
- (fp->f_iflags & FIF_WANTCLOSE) != 0 ||
+ (fp->f_iflags & FIF_WANTCLOSE) != 0 ||
#endif
- (fp->f_flag & FREAD) == 0)
- return (EBADF);
+ (fp->f_flag & FREAD) == 0)
+ return (EBADF);
#if notyet
- FILE_USE(fp);
+ FILE_USE(fp);
#endif
- vp = (struct vnode *)fp->f_data;
- if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
- error = ESPIPE;
- goto out;
- }
+ vp = (struct vnode *)fp->f_data;
+ if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
+ error = ESPIPE;
+ goto out;
+ }
- offset = SCARG(uap, offset);
+ offset = SCARG(uap, offset);
- /* dofileread() will unuse the descriptor for us */
- return (dofileread(p, fd, fp, SCARG(uap, buf), SCARG(uap, nbyte),
- &offset, retval));
+ /* dofileread() will unuse the descriptor for us */
+ return (dofileread(p, fd, fp, SCARG(uap, buf), SCARG(uap, nbyte),
+ &offset, retval));
out:
#if notyet
- FILE_UNUSE(fp, p);
+ FILE_UNUSE(fp, p);
#endif
- return (error);
+ return (error);
}
/*
@@ -2681,52 +2680,52 @@ sys_pread(p, v, retval)
*/
int
sys_preadv(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
+ struct proc *p;
+ void *v;
+ register_t *retval;
{
- struct sys_preadv_args /* {
- syscallarg(int) fd;
- syscallarg(const struct iovec *) iovp;
- syscallarg(int) iovcnt;
- syscallarg(int) pad;
- syscallarg(off_t) offset;
- } */ *uap = v;
- struct filedesc *fdp = p->p_fd;
- struct file *fp;
- struct vnode *vp;
- off_t offset;
- int error, fd = SCARG(uap, fd);
-
- if ((u_int)fd >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[fd]) == NULL ||
+ struct sys_preadv_args /* {
+ syscallarg(int) fd;
+ syscallarg(const struct iovec *) iovp;
+ syscallarg(int) iovcnt;
+ syscallarg(int) pad;
+ syscallarg(off_t) offset;
+ } */ *uap = v;
+ struct filedesc *fdp = p->p_fd;
+ struct file *fp;
+ struct vnode *vp;
+ off_t offset;
+ int error, fd = SCARG(uap, fd);
+
+ if ((u_int)fd >= fdp->fd_nfiles ||
+ (fp = fdp->fd_ofiles[fd]) == NULL ||
#if notyet
- (fp->f_iflags & FIF_WANTCLOSE) != 0 ||
+ (fp->f_iflags & FIF_WANTCLOSE) != 0 ||
#endif
- (fp->f_flag & FREAD) == 0)
- return (EBADF);
+ (fp->f_flag & FREAD) == 0)
+ return (EBADF);
#if notyet
- FILE_USE(fp);
+ FILE_USE(fp);
#endif
- vp = (struct vnode *)fp->f_data;
- if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
- error = ESPIPE;
- goto out;
- }
+ vp = (struct vnode *)fp->f_data;
+ if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
+ error = ESPIPE;
+ goto out;
+ }
- offset = SCARG(uap, offset);
+ offset = SCARG(uap, offset);
- /* dofilereadv() will unuse the descriptor for us */
- return (dofilereadv(p, fd, fp, SCARG(uap, iovp), SCARG(uap, iovcnt),
- &offset, retval));
+ /* dofilereadv() will unuse the descriptor for us */
+ return (dofilereadv(p, fd, fp, SCARG(uap, iovp), SCARG(uap, iovcnt),
+ &offset, retval));
out:
#if notyet
- FILE_UNUSE(fp, p);
+ FILE_UNUSE(fp, p);
#endif
- return (error);
+ return (error);
}
/*
@@ -2734,52 +2733,52 @@ sys_preadv(p, v, retval)
*/
int
sys_pwrite(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
+ struct proc *p;
+ void *v;
+ register_t *retval;
{
- struct sys_pwrite_args /* {
- syscallarg(int) fd;
- syscallarg(const void *) buf;
- syscallarg(size_t) nbyte;
- syscallarg(int) pad;
- syscallarg(off_t) offset;
- } */ *uap = v;
- struct filedesc *fdp = p->p_fd;
- struct file *fp;
- struct vnode *vp;
- off_t offset;
- int error, fd = SCARG(uap, fd);
-
- if ((u_int)fd >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[fd]) == NULL ||
+ struct sys_pwrite_args /* {
+ syscallarg(int) fd;
+ syscallarg(const void *) buf;
+ syscallarg(size_t) nbyte;
+ syscallarg(int) pad;
+ syscallarg(off_t) offset;
+ } */ *uap = v;
+ struct filedesc *fdp = p->p_fd;
+ struct file *fp;
+ struct vnode *vp;
+ off_t offset;
+ int error, fd = SCARG(uap, fd);
+
+ if ((u_int)fd >= fdp->fd_nfiles ||
+ (fp = fdp->fd_ofiles[fd]) == NULL ||
#if notyet
- (fp->f_iflags & FIF_WANTCLOSE) != 0 ||
+ (fp->f_iflags & FIF_WANTCLOSE) != 0 ||
#endif
- (fp->f_flag & FWRITE) == 0)
- return (EBADF);
+ (fp->f_flag & FWRITE) == 0)
+ return (EBADF);
#if notyet
- FILE_USE(fp);
+ FILE_USE(fp);
#endif
- vp = (struct vnode *)fp->f_data;
- if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
- error = ESPIPE;
- goto out;
- }
+ vp = (struct vnode *)fp->f_data;
+ if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
+ error = ESPIPE;
+ goto out;
+ }
- offset = SCARG(uap, offset);
+ offset = SCARG(uap, offset);
- /* dofilewrite() will unuse the descriptor for us */
- return (dofilewrite(p, fd, fp, SCARG(uap, buf), SCARG(uap, nbyte),
- &offset, retval));
+ /* dofilewrite() will unuse the descriptor for us */
+ return (dofilewrite(p, fd, fp, SCARG(uap, buf), SCARG(uap, nbyte),
+ &offset, retval));
out:
#if notyet
- FILE_UNUSE(fp, p);
+ FILE_UNUSE(fp, p);
#endif
- return (error);
+ return (error);
}
@@ -2788,50 +2787,49 @@ sys_pwrite(p, v, retval)
*/
int
sys_pwritev(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
+ struct proc *p;
+ void *v;
+ register_t *retval;
{
- struct sys_pwritev_args /* {
- syscallarg(int) fd;
- syscallarg(const struct iovec *) iovp;
- syscallarg(int) iovcnt;
- syscallarg(int) pad;
- syscallarg(off_t) offset;
- } */ *uap = v;
- struct filedesc *fdp = p->p_fd;
- struct file *fp;
- struct vnode *vp;
- off_t offset;
- int error, fd = SCARG(uap, fd);
-
- if ((u_int)fd >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[fd]) == NULL ||
+ struct sys_pwritev_args /* {
+ syscallarg(int) fd;
+ syscallarg(const struct iovec *) iovp;
+ syscallarg(int) iovcnt;
+ syscallarg(int) pad;
+ syscallarg(off_t) offset;
+ } */ *uap = v;
+ struct filedesc *fdp = p->p_fd;
+ struct file *fp;
+ struct vnode *vp;
+ off_t offset;
+ int error, fd = SCARG(uap, fd);
+
+ if ((u_int)fd >= fdp->fd_nfiles ||
+ (fp = fdp->fd_ofiles[fd]) == NULL ||
#if notyet
- (fp->f_iflags & FIF_WANTCLOSE) != 0 ||
+ (fp->f_iflags & FIF_WANTCLOSE) != 0 ||
#endif
- (fp->f_flag & FWRITE) == 0)
- return (EBADF);
+ (fp->f_flag & FWRITE) == 0)
+ return (EBADF);
#if notyet
- FILE_USE(fp);
+ FILE_USE(fp);
#endif
- vp = (struct vnode *)fp->f_data;
- if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
- error = ESPIPE;
- goto out;
- }
+ vp = (struct vnode *)fp->f_data;
+ if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
+ error = ESPIPE;
+ goto out;
+ }
- offset = SCARG(uap, offset);
+ offset = SCARG(uap, offset);
- /* dofilewritev() will unuse the descriptor for us */
- return (dofilewritev(p, fd, fp, SCARG(uap, iovp), SCARG(uap, iovcnt),
- &offset, retval));
+ /* dofilewritev() will unuse the descriptor for us */
+ return (dofilewritev(p, fd, fp, SCARG(uap, iovp), SCARG(uap, iovcnt),
+ &offset, retval));
out:
#if notyet
- FILE_UNUSE(fp, p);
+ FILE_UNUSE(fp, p);
#endif
- return (error);
+ return (error);
}
-
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index e01b1c60e31..15d137c8f6f 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_vnops.c,v 1.30 2001/05/14 12:38:47 art Exp $ */
+/* $OpenBSD: vfs_vnops.c,v 1.31 2001/06/22 14:14:11 deraadt Exp $ */
/* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */
/*
@@ -64,7 +64,7 @@
int vn_read __P((struct file *fp, off_t *off, struct uio *uio,
struct ucred *cred));
int vn_write __P((struct file *fp, off_t *off, struct uio *uio,
- struct ucred *cred));
+ struct ucred *cred));
int vn_select __P((struct file *fp, int which, struct proc *p));
int vn_kqfilter __P((struct file *fp, struct knote *kn));
int vn_closefile __P((struct file *fp, struct proc *p));
@@ -448,7 +448,7 @@ vn_ioctl(fp, com, data, p)
return VOP_IOCTL(vp, com, data, fp->f_flag,
p->p_ucred, p);
if (com == FIONBIO || com == FIOASYNC) /* XXX */
- return (0); /* XXX */
+ return (0); /* XXX */
/* fall into... */
default: