Deleted Added
sdiff udiff text old ( 12662 ) new ( 12767 )
full compact
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 $
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 }
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);
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);
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}