Remove files specified in pcn.
When remove files using name from pnode, another link on this file can be unlinked. E.g. "touch 1; ln 1 2; rm 2" will remove file named "1". Thus puffs_null_node_remove should remove directory entry which name is provided by pcn (as said in puffs_ops.3). Caller should provide appropriately initialized pcn. From Evgeniy Ivanov <lolkaantimat@gmail.com>
This commit is contained in:
parent
a1beaff4aa
commit
77ac17e5c3
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dispatcher.c,v 1.36 2011/07/04 08:07:30 manu Exp $ */
|
||||
/* $NetBSD: dispatcher.c,v 1.37 2011/11/24 01:58:52 manu Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007, 2008 Antti Kantee. All Rights Reserved.
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(lint)
|
||||
__RCSID("$NetBSD: dispatcher.c,v 1.36 2011/07/04 08:07:30 manu Exp $");
|
||||
__RCSID("$NetBSD: dispatcher.c,v 1.37 2011/11/24 01:58:52 manu Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -512,8 +512,17 @@ dispatch(struct puffs_cc *pcc)
|
||||
pcn.pcn_pkcnp = &auxt->pvnr_cn;
|
||||
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
|
||||
|
||||
if (buildpath) {
|
||||
error = puffs_path_pcnbuild(pu, &pcn, opcookie);
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
|
||||
error = pops->puffs_node_remove(pu,
|
||||
opcookie, auxt->pvnr_cookie_targ, &pcn);
|
||||
|
||||
pu->pu_pathfree(pu, &pcn.pcn_po_full);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -661,8 +670,17 @@ dispatch(struct puffs_cc *pcc)
|
||||
pcn.pcn_pkcnp = &auxt->pvnr_cn;
|
||||
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
|
||||
|
||||
if (buildpath) {
|
||||
error = puffs_path_pcnbuild(pu, &pcn, opcookie);
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
|
||||
error = pops->puffs_node_rmdir(pu,
|
||||
opcookie, auxt->pvnr_cookie_targ, &pcn);
|
||||
|
||||
pu->pu_pathfree(pu, &pcn.pcn_po_full);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: null.c,v 1.31 2011/11/24 01:55:33 manu Exp $ */
|
||||
/* $NetBSD: null.c,v 1.32 2011/11/24 01:58:52 manu Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(lint)
|
||||
__RCSID("$NetBSD: null.c,v 1.31 2011/11/24 01:55:33 manu Exp $");
|
||||
__RCSID("$NetBSD: null.c,v 1.32 2011/11/24 01:58:52 manu Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
/*
|
||||
@ -453,7 +453,7 @@ puffs_null_node_remove(struct puffs_usermount *pu, puffs_cookie_t opc,
|
||||
{
|
||||
struct puffs_node *pn_targ = targ;
|
||||
|
||||
if (unlink(PNPATH(pn_targ)) == -1)
|
||||
if (unlink(PCNPATH(pcn)) == -1)
|
||||
return errno;
|
||||
puffs_pn_remove(pn_targ);
|
||||
|
||||
@ -515,7 +515,7 @@ puffs_null_node_rmdir(struct puffs_usermount *pu, puffs_cookie_t opc,
|
||||
{
|
||||
struct puffs_node *pn_targ = targ;
|
||||
|
||||
if (rmdir(PNPATH(pn_targ)) == -1)
|
||||
if (rmdir(PCNPATH(pcn)) == -1)
|
||||
return errno;
|
||||
puffs_pn_remove(pn_targ);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user