union_subr.c (178485) | union_subr.c (178491) |
---|---|
1/*- 2 * Copyright (c) 1994 Jan-Simon Pendry 3 * Copyright (c) 1994 4 * The Regents of the University of California. All rights reserved. 5 * Copyright (c) 2005, 2006 Masanori Ozawa <ozawa@ongs.co.jp>, ONGS Inc. 6 * Copyright (c) 2006 Daichi Goto <daichi@freebsd.org> 7 * 8 * This code is derived from software contributed to Berkeley by --- 19 unchanged lines hidden (view full) --- 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)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 * Copyright (c) 2005, 2006 Masanori Ozawa <ozawa@ongs.co.jp>, ONGS Inc. 6 * Copyright (c) 2006 Daichi Goto <daichi@freebsd.org> 7 * 8 * This code is derived from software contributed to Berkeley by --- 19 unchanged lines hidden (view full) --- 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)union_subr.c 8.20 (Berkeley) 5/20/95 |
36 * $FreeBSD: head/sys/fs/unionfs/union_subr.c 178485 2008-04-25 09:53:52Z daichi $ | 36 * $FreeBSD: head/sys/fs/unionfs/union_subr.c 178491 2008-04-25 11:37:20Z daichi $ |
37 */ 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/lock.h> 43#include <sys/mutex.h> 44#include <sys/malloc.h> --- 365 unchanged lines hidden (view full) --- 410 * Get the unionfs node status. 411 * You need exclusive lock this vnode. 412 */ 413void 414unionfs_get_node_status(struct unionfs_node *unp, struct thread *td, 415 struct unionfs_node_status **unspp) 416{ 417 struct unionfs_node_status *unsp; | 37 */ 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/lock.h> 43#include <sys/mutex.h> 44#include <sys/malloc.h> --- 365 unchanged lines hidden (view full) --- 410 * Get the unionfs node status. 411 * You need exclusive lock this vnode. 412 */ 413void 414unionfs_get_node_status(struct unionfs_node *unp, struct thread *td, 415 struct unionfs_node_status **unspp) 416{ 417 struct unionfs_node_status *unsp; |
418 pid_t pid = td->td_proc->p_pid; |
|
418 419 KASSERT(NULL != unspp, ("null pointer")); 420 ASSERT_VOP_ELOCKED(UNIONFSTOV(unp), "unionfs_get_node_status"); 421 422 LIST_FOREACH(unsp, &(unp->un_unshead), uns_list) { | 419 420 KASSERT(NULL != unspp, ("null pointer")); 421 ASSERT_VOP_ELOCKED(UNIONFSTOV(unp), "unionfs_get_node_status"); 422 423 LIST_FOREACH(unsp, &(unp->un_unshead), uns_list) { |
423 if (unsp->uns_tid == td->td_tid) { | 424 if (unsp->uns_pid == pid) { |
424 *unspp = unsp; 425 return; 426 } 427 } 428 429 /* create a new unionfs node status */ 430 MALLOC(unsp, struct unionfs_node_status *, 431 sizeof(struct unionfs_node_status), M_TEMP, M_WAITOK | M_ZERO); 432 | 425 *unspp = unsp; 426 return; 427 } 428 } 429 430 /* create a new unionfs node status */ 431 MALLOC(unsp, struct unionfs_node_status *, 432 sizeof(struct unionfs_node_status), M_TEMP, M_WAITOK | M_ZERO); 433 |
433 unsp->uns_tid = td->td_tid; | 434 unsp->uns_pid = pid; |
434 LIST_INSERT_HEAD(&(unp->un_unshead), unsp, uns_list); 435 436 *unspp = unsp; 437} 438 439/* 440 * Remove the unionfs node status, if you can. 441 * You need exclusive lock this vnode. 442 */ 443void | 435 LIST_INSERT_HEAD(&(unp->un_unshead), unsp, uns_list); 436 437 *unspp = unsp; 438} 439 440/* 441 * Remove the unionfs node status, if you can. 442 * You need exclusive lock this vnode. 443 */ 444void |
444unionfs_tryrem_node_status(struct unionfs_node *unp, struct thread *td, | 445unionfs_tryrem_node_status(struct unionfs_node *unp, |
445 struct unionfs_node_status *unsp) 446{ 447 KASSERT(NULL != unsp, ("null pointer")); 448 ASSERT_VOP_ELOCKED(UNIONFSTOV(unp), "unionfs_get_node_status"); 449 450 if (0 < unsp->uns_lower_opencnt || 0 < unsp->uns_upper_opencnt) 451 return; 452 --- 835 unchanged lines hidden --- | 446 struct unionfs_node_status *unsp) 447{ 448 KASSERT(NULL != unsp, ("null pointer")); 449 ASSERT_VOP_ELOCKED(UNIONFSTOV(unp), "unionfs_get_node_status"); 450 451 if (0 < unsp->uns_lower_opencnt || 0 < unsp->uns_upper_opencnt) 452 return; 453 --- 835 unchanged lines hidden --- |