Module Name: src
Committed By: manu
Date: Thu Nov 24 01:58:52 UTC 2011
Modified Files:
src/lib/libpuffs: dispatcher.c null.c
Log Message:
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 <[email protected]>
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libpuffs/dispatcher.c
cvs rdiff -u -r1.31 -r1.32 src/lib/libpuffs/null.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libpuffs/dispatcher.c
diff -u src/lib/libpuffs/dispatcher.c:1.36 src/lib/libpuffs/dispatcher.c:1.37
--- src/lib/libpuffs/dispatcher.c:1.36 Mon Jul 4 08:07:30 2011
+++ src/lib/libpuffs/dispatcher.c Thu Nov 24 01:58:52 2011
@@ -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;
}
Index: src/lib/libpuffs/null.c
diff -u src/lib/libpuffs/null.c:1.31 src/lib/libpuffs/null.c:1.32
--- src/lib/libpuffs/null.c:1.31 Thu Nov 24 01:55:33 2011
+++ src/lib/libpuffs/null.c Thu Nov 24 01:58:52 2011
@@ -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_user
{
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_userm
{
struct puffs_node *pn_targ = targ;
- if (rmdir(PNPATH(pn_targ)) == -1)
+ if (rmdir(PCNPATH(pcn)) == -1)
return errno;
puffs_pn_remove(pn_targ);