vfs_vnops.c (9456) | vfs_vnops.c (9507) |
---|---|
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.13 1995/06/28 12:32:47 davidg Exp $ | 39 * $Id: vfs_vnops.c,v 1.14 1995/07/09 06:57:53 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> --- 98 unchanged lines hidden (view full) --- 146 vap->va_size = 0; 147 error = VOP_SETATTR(vp, vap, cred, p); 148 if (error) 149 goto bad; 150 } 151 error = VOP_OPEN(vp, fmode, cred, p); 152 if (error) 153 goto bad; | 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> --- 98 unchanged lines hidden (view full) --- 146 vap->va_size = 0; 147 error = VOP_SETATTR(vp, vap, cred, p); 148 if (error) 149 goto bad; 150 } 151 error = VOP_OPEN(vp, fmode, cred, p); 152 if (error) 153 goto bad; |
154 if (fmode & FWRITE) 155 vp->v_writecount++; | |
156 /* 157 * this is here for VMIO support 158 */ 159 if (vp->v_type == VREG) { | 154 /* 155 * this is here for VMIO support 156 */ 157 if (vp->v_type == VREG) { |
160 vm_object_t object; 161 vm_pager_t pager; | |
162retry: 163 if ((vp->v_flag & VVMIO) == 0) { 164 error = VOP_GETATTR(vp, vap, cred, p); 165 if (error) 166 goto bad; 167 if (vnode_pager_alloc(vp, vap->va_size, 0, 0) == NULL) 168 panic("vn_open: failed to allocate object"); 169 vp->v_flag |= VVMIO; 170 } else { | 158retry: 159 if ((vp->v_flag & VVMIO) == 0) { 160 error = VOP_GETATTR(vp, vap, cred, p); 161 if (error) 162 goto bad; 163 if (vnode_pager_alloc(vp, vap->va_size, 0, 0) == NULL) 164 panic("vn_open: failed to allocate object"); 165 vp->v_flag |= VVMIO; 166 } else { |
167 vm_object_t object; |
|
171 if ((object = vp->v_object) && 172 (object->flags & OBJ_DEAD)) { 173 VOP_UNLOCK(vp); 174 tsleep(object, PVM, "vodead", 0); 175 VOP_LOCK(vp); 176 goto retry; 177 } 178 if (!object) 179 panic("vn_open: VMIO object missing"); | 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"); |
180 pager = object->pager; 181 if (!pager) 182 panic("vn_open: VMIO pager missing"); 183 (void) vm_object_lookup(pager); | 177 vm_object_reference(object); |
184 } 185 } | 178 } 179 } |
180 if (fmode & FWRITE) 181 vp->v_writecount++; |
|
186 return (0); 187bad: 188 vput(vp); 189 return (error); 190} 191 192/* 193 * Check for write permissions on the specified vnode. --- 302 unchanged lines hidden --- | 182 return (0); 183bad: 184 vput(vp); 185 return (error); 186} 187 188/* 189 * Check for write permissions on the specified vnode. --- 302 unchanged lines hidden --- |