Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpvfs Fix etfs pathname handling to not (...
details: https://anonhg.NetBSD.org/src/rev/912911f4b5fb
branches: trunk
changeset: 759125:912911f4b5fb
user: dholland <dholland%NetBSD.org@localhost>
date: Tue Nov 30 01:22:50 2010 +0000
description:
Fix etfs pathname handling to not (mis)use namei's scratch space.
etfs objects must now be registered as absolute paths; however, it is now
possible to access them via relative paths and through symlinks, which
previously worked some times and not others depending on exactly what
namei was doing.
discussed on tech-kern and ok'd by pooka.
diffstat:
sys/rump/librump/rumpvfs/rumpfs.c | 32 +++++++++++++++++++++++++-------
1 files changed, 25 insertions(+), 7 deletions(-)
diffs (80 lines):
diff -r 8ed917843706 -r 912911f4b5fb sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Tue Nov 30 00:14:42 2010 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Tue Nov 30 01:22:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpfs.c,v 1.74 2010/11/22 15:15:35 pooka Exp $ */
+/* $NetBSD: rumpfs.c,v 1.75 2010/11/30 01:22:50 dholland Exp $ */
/*
* Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.74 2010/11/22 15:15:35 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.75 2010/11/30 01:22:50 dholland Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -324,6 +324,13 @@
devminor_t dmin = -1;
int hft, error;
+ if (key[0] != '/') {
+ return EINVAL;
+ }
+ while (key[0] == '/') {
+ key++;
+ }
+
if (rumpuser_getfileinfo(hostpath, &fsize, &hft, &error))
return error;
@@ -396,7 +403,7 @@
if (ftype == RUMP_ETFS_BLK) {
format_bytes(buf, sizeof(buf), size);
- aprint_verbose("%s: hostpath %s (%s)\n", key, hostpath, buf);
+ aprint_verbose("/%s: hostpath %s (%s)\n", key, hostpath, buf);
}
return 0;
@@ -424,9 +431,18 @@
rump_etfs_remove(const char *key)
{
struct etfs *et;
- size_t keylen = strlen(key);
+ size_t keylen;
int rv;
+ if (key[0] != '/') {
+ return EINVAL;
+ }
+ while (key[0] == '/') {
+ key++;
+ }
+
+ keylen = strlen(key);
+
mutex_enter(&etfs_lock);
LIST_FOREACH(et, &etfs_list, et_entries) {
if (keylen == et->et_keylen && strcmp(et->et_key, key) == 0) {
@@ -641,13 +657,15 @@
if (dvp == rootvnode && cnp->cn_nameiop == LOOKUP) {
bool found;
mutex_enter(&etfs_lock);
- found = etfs_find(cnp->cn_pnbuf, &et, false);
+ found = etfs_find(cnp->cn_nameptr, &et, false);
mutex_exit(&etfs_lock);
if (found) {
- char *offset;
+ const char *offset;
- offset = strstr(cnp->cn_pnbuf, et->et_key);
+ /* pointless as et_key is always the whole string */
+ /*offset = strstr(cnp->cn_nameptr, et->et_key);*/
+ offset = cnp->cn_nameptr;
KASSERT(offset);
rn = et->et_rn;
Home |
Main Index |
Thread Index |
Old Index