Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpuffs Remove files specified in pcn.



details:   https://anonhg.NetBSD.org/src/rev/de5358207b7e
branches:  trunk
changeset: 771522:de5358207b7e
user:      manu <manu%NetBSD.org@localhost>
date:      Thu Nov 24 01:58:52 2011 +0000

description:
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@localhost>

diffstat:

 lib/libpuffs/dispatcher.c |  22 ++++++++++++++++++++--
 lib/libpuffs/null.c       |   8 ++++----
 2 files changed, 24 insertions(+), 6 deletions(-)

diffs (90 lines):

diff -r 4e97daddd240 -r de5358207b7e lib/libpuffs/dispatcher.c
--- a/lib/libpuffs/dispatcher.c Thu Nov 24 01:56:22 2011 +0000
+++ b/lib/libpuffs/dispatcher.c Thu Nov 24 01:58:52 2011 +0000
@@ -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 @@
                        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 @@
                        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;
                }
 
diff -r 4e97daddd240 -r de5358207b7e lib/libpuffs/null.c
--- a/lib/libpuffs/null.c       Thu Nov 24 01:56:22 2011 +0000
+++ b/lib/libpuffs/null.c       Thu Nov 24 01:58:52 2011 +0000
@@ -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 @@
 {
        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 @@
 {
        struct puffs_node *pn_targ = targ;
 
-       if (rmdir(PNPATH(pn_targ)) == -1)
+       if (rmdir(PCNPATH(pcn)) == -1)
                return errno;
        puffs_pn_remove(pn_targ);
 



Home | Main Index | Thread Index | Old Index