Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/puffs/mount_9p puffs9p_node_rename - 9P rename is d...



details:   https://anonhg.NetBSD.org/src/rev/301ef3306a87
branches:  trunk
changeset: 933553:301ef3306a87
user:      uwe <uwe%NetBSD.org@localhost>
date:      Wed May 27 03:25:13 2020 +0000

description:
puffs9p_node_rename - 9P rename is done with Twstat and can only
change the last pathname component.  Return EXDEV for attempts to move
a file to a different directory to make mv(1) fall back to copying.

diffstat:

 usr.sbin/puffs/mount_9p/node.c |  24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diffs (51 lines):

diff -r bddd85a2961e -r 301ef3306a87 usr.sbin/puffs/mount_9p/node.c
--- a/usr.sbin/puffs/mount_9p/node.c    Wed May 27 02:04:37 2020 +0000
+++ b/usr.sbin/puffs/mount_9p/node.c    Wed May 27 03:25:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $    */
+/*     $NetBSD: node.c,v 1.28 2020/05/27 03:25:13 uwe Exp $    */
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $");
+__RCSID("$NetBSD: node.c,v 1.28 2020/05/27 03:25:13 uwe Exp $");
 #endif /* !lint */
 
 #include <assert.h>
@@ -572,22 +572,22 @@
        return rv;
 }
 
-/*
- * 9P supports renames only for files within a directory
- * from what I could tell.  So just support in-directory renames
- * for now.
- */ 
 int
-puffs9p_node_rename(struct puffs_usermount *pu, void *opc, void *src,
-       const struct puffs_cn *pcn_src, void *targ_dir, void *targ,
-       const struct puffs_cn *pcn_targ)
+puffs9p_node_rename(struct puffs_usermount *pu,
+                   void *src_dir, void *src, const struct puffs_cn *pcn_src,
+                   void *targ_dir, void *targ, const struct puffs_cn *pcn_targ)
 {
        AUTOVAR(pu);
        struct puffs_node *pn_src = src;
        struct p9pnode *p9n_src = pn_src->pn_data;
 
-       if (opc != targ_dir) {
-               rv = EOPNOTSUPP;
+       /*
+        * 9P rename can only change the last pathname component.
+        * Return EXDEV for attempts to move a file to a different
+        * directory to make mv(1) fall back to copying.
+        */
+       if (src_dir != targ_dir) {
+               rv = EXDEV;
                goto out;
        }
 



Home | Main Index | Thread Index | Old Index