vfs_vnops.c (12662) | vfs_vnops.c (12767) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 |
39 * $Id: vfs_vnops.c,v 1.19 1995/10/22 09:32:29 davidg Exp $ | 39 * $Id: vfs_vnops.c,v 1.20 1995/12/07 12:47:07 davidg Exp $ |
40 */ 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/kernel.h> 45#include <sys/file.h> 46#include <sys/stat.h> 47#include <sys/buf.h> --- 103 unchanged lines hidden (view full) --- 151 } 152 error = VOP_OPEN(vp, fmode, cred, p); 153 if (error) 154 goto bad; 155 /* 156 * this is here for VMIO support 157 */ 158 if (vp->v_type == VREG) { | 40 */ 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/kernel.h> 45#include <sys/file.h> 46#include <sys/stat.h> 47#include <sys/buf.h> --- 103 unchanged lines hidden (view full) --- 151 } 152 error = VOP_OPEN(vp, fmode, cred, p); 153 if (error) 154 goto bad; 155 /* 156 * this is here for VMIO support 157 */ 158 if (vp->v_type == VREG) { |
159retry: 160 if ((vp->v_flag & VVMIO) == 0) { 161 error = VOP_GETATTR(vp, vap, cred, p); 162 if (error) 163 goto bad; 164 (void) vnode_pager_alloc(vp, vap->va_size, 0, 0); 165 vp->v_flag |= VVMIO; 166 } else { 167 vm_object_t object; 168 if ((object = vp->v_object) && 169 (object->flags & OBJ_DEAD)) { 170 VOP_UNLOCK(vp); 171 tsleep(object, PVM, "vodead", 0); 172 VOP_LOCK(vp); 173 goto retry; 174 } 175 if (!object) 176 panic("vn_open: VMIO object missing"); 177 vm_object_reference(object); 178 } | 159 if ((error = vn_vmio_open(vp, p, cred)) != 0) 160 goto bad; |
179 } 180 if (fmode & FWRITE) 181 vp->v_writecount++; 182 return (0); 183bad: 184 vput(vp); 185 return (error); 186} --- 28 unchanged lines hidden (view full) --- 215 struct ucred *cred; 216 struct proc *p; 217{ 218 int error; 219 220 if (flags & FWRITE) 221 vp->v_writecount--; 222 error = VOP_CLOSE(vp, flags, cred, p); | 161 } 162 if (fmode & FWRITE) 163 vp->v_writecount++; 164 return (0); 165bad: 166 vput(vp); 167 return (error); 168} --- 28 unchanged lines hidden (view full) --- 197 struct ucred *cred; 198 struct proc *p; 199{ 200 int error; 201 202 if (flags & FWRITE) 203 vp->v_writecount--; 204 error = VOP_CLOSE(vp, flags, cred, p); |
223 /* 224 * this code is here for VMIO support, will eventually 225 * be in vfs code. 226 */ 227 if (vp->v_flag & VVMIO) { 228 vrele(vp); 229 if (vp->v_object == NULL) 230 panic("vn_close: VMIO object missing"); 231 vm_object_deallocate(vp->v_object); 232 } else 233 vrele(vp); | 205 vn_vmio_close(vp); |
234 return (error); 235} 236 237/* 238 * Package up an I/O request on a vnode into a uio and do it. 239 */ 240int 241vn_rdwr(rw, vp, base, len, offset, segflg, ioflg, cred, aresid, p) --- 234 unchanged lines hidden (view full) --- 476vn_closefile(fp, p) 477 struct file *fp; 478 struct proc *p; 479{ 480 481 return (vn_close(((struct vnode *)fp->f_data), fp->f_flag, 482 fp->f_cred, p)); 483} | 206 return (error); 207} 208 209/* 210 * Package up an I/O request on a vnode into a uio and do it. 211 */ 212int 213vn_rdwr(rw, vp, base, len, offset, segflg, ioflg, cred, aresid, p) --- 234 unchanged lines hidden (view full) --- 448vn_closefile(fp, p) 449 struct file *fp; 450 struct proc *p; 451{ 452 453 return (vn_close(((struct vnode *)fp->f_data), fp->f_flag, 454 fp->f_cred, p)); 455} |
456 457int 458vn_vmio_open(vp, p, cred) 459 struct vnode *vp; 460 struct proc *p; 461 struct ucred *cred; 462{ 463 struct vattr vat; 464 int error; 465 /* 466 * this is here for VMIO support 467 */ 468 if (vp->v_type == VREG || vp->v_type == VBLK) { 469retry: 470 if ((vp->v_flag & VVMIO) == 0) { 471 if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0) 472 return error; 473 (void) vnode_pager_alloc(vp, vat.va_size, 0, 0); 474 vp->v_flag |= VVMIO; 475 } else { 476 vm_object_t object; 477 if ((object = vp->v_object) && 478 (object->flags & OBJ_DEAD)) { 479 VOP_UNLOCK(vp); 480 tsleep(object, PVM, "vodead", 0); 481 VOP_LOCK(vp); 482 goto retry; 483 } 484 if (!object) 485 panic("vn_open: VMIO object missing"); 486 vm_object_reference(object); 487 } 488 } 489 return 0; 490} 491 492void 493vn_vmio_close(vp) 494 struct vnode *vp; 495{ 496 /* 497 * this code is here for VMIO support, will eventually 498 * be in vfs code. 499 */ 500 if (vp->v_flag & VVMIO) { 501 vrele(vp); 502 if (vp->v_object == NULL) 503 panic("vn_close: VMIO object missing"); 504 vm_object_deallocate(vp->v_object); 505 } else 506 vrele(vp); 507} |
|