Deleted Added
full compact
union_subr.c (88318) union_subr.c (89306)
1/*
2 * Copyright (c) 1994 Jan-Simon Pendry
3 * Copyright (c) 1994
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * @(#)union_subr.c 8.20 (Berkeley) 5/20/95
1/*
2 * Copyright (c) 1994 Jan-Simon Pendry
3 * Copyright (c) 1994
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * @(#)union_subr.c 8.20 (Berkeley) 5/20/95
38 * $FreeBSD: head/sys/fs/unionfs/union_subr.c 88318 2001-12-20 22:42:27Z dillon $
38 * $FreeBSD: head/sys/fs/unionfs/union_subr.c 89306 2002-01-13 11:58:06Z alfred $
39 */
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/fcntl.h>
44#include <sys/file.h>
45#include <sys/filedesc.h>
46#include <sys/kernel.h>

--- 996 unchanged lines hidden (view full) ---

1043 struct thread *td;
1044{
1045 struct vnode *vp;
1046 struct ucred *cred = td->td_proc->p_ucred;
1047 struct vattr vat;
1048 struct vattr *vap = &vat;
1049 int fmode = FFLAGS(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL);
1050 int error;
39 */
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/fcntl.h>
44#include <sys/file.h>
45#include <sys/filedesc.h>
46#include <sys/kernel.h>

--- 996 unchanged lines hidden (view full) ---

1043 struct thread *td;
1044{
1045 struct vnode *vp;
1046 struct ucred *cred = td->td_proc->p_ucred;
1047 struct vattr vat;
1048 struct vattr *vap = &vat;
1049 int fmode = FFLAGS(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL);
1050 int error;
1051 int cmode = UN_FILEMODE & ~td->td_proc->p_fd->fd_cmask;
1051 int cmode;
1052 struct componentname cn;
1053
1054 *vpp = NULLVP;
1052 struct componentname cn;
1053
1054 *vpp = NULLVP;
1055 FILEDESC_LOCK(td->td_proc->p_fd);
1056 cmode = UN_FILEMODE & ~td->td_proc->p_fd->fd_cmask;
1057 FILEDESC_UNLOCK(td->td_proc->p_fd);
1055
1056 /*
1057 * Build a new componentname structure (for the same
1058 * reasons outlines in union_mkshadow).
1059 * The difference here is that the file is owned by
1060 * the current user, rather than by the person who
1061 * did the mount, since the current user needs to be
1062 * able to write the file (that's why it is being

--- 255 unchanged lines hidden (view full) ---

1318 error = VOP_OPEN(lvp, FREAD, fp->f_cred, td);
1319 if (error == 0 && vn_canvmio(lvp) == TRUE)
1320 error = vfs_object_create(lvp, td, fp->f_cred);
1321 if (error) {
1322 vput(lvp);
1323 return (error);
1324 }
1325 VOP_UNLOCK(lvp, 0, td);
1058
1059 /*
1060 * Build a new componentname structure (for the same
1061 * reasons outlines in union_mkshadow).
1062 * The difference here is that the file is owned by
1063 * the current user, rather than by the person who
1064 * did the mount, since the current user needs to be
1065 * able to write the file (that's why it is being

--- 255 unchanged lines hidden (view full) ---

1321 error = VOP_OPEN(lvp, FREAD, fp->f_cred, td);
1322 if (error == 0 && vn_canvmio(lvp) == TRUE)
1323 error = vfs_object_create(lvp, td, fp->f_cred);
1324 if (error) {
1325 vput(lvp);
1326 return (error);
1327 }
1328 VOP_UNLOCK(lvp, 0, td);
1329 FILE_LOCK(fp);
1326 fp->f_data = (caddr_t) lvp;
1327 fp->f_offset = 0;
1330 fp->f_data = (caddr_t) lvp;
1331 fp->f_offset = 0;
1332 FILE_UNLOCK(fp);
1328 error = vn_close(*vp, FREAD, fp->f_cred, td);
1329 if (error)
1330 return (error);
1331 *vp = lvp;
1332 return -1; /* goto unionread */
1333 }
1334 }
1335 return error;

--- 25 unchanged lines hidden ---
1333 error = vn_close(*vp, FREAD, fp->f_cred, td);
1334 if (error)
1335 return (error);
1336 *vp = lvp;
1337 return -1; /* goto unionread */
1338 }
1339 }
1340 return error;

--- 25 unchanged lines hidden ---