diff options
author | Greg Kurz <groug@kaod.org> | 2016-08-30 17:02:27 +0200 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-08-30 19:23:00 +0100 |
commit | 56f101ecce0eafd09e2daf1c4eeb1377d6959261 (patch) | |
tree | 9b7c8ceb972c7a4da49bee92fff49939376e35a1 /hw/9pfs/9p.h | |
parent | 805b5d98c649d26fc44d2d7755a97f18e62b438a (diff) |
9pfs: handle walk of ".." in the root directory
The 9P spec at http://man.cat-v.org/plan_9/5/intro says:
All directories must support walks to the directory .. (dot-dot) meaning
parent directory, although by convention directories contain no explicit
entry for .. or . (dot). The parent of the root directory of a server's
tree is itself.
This means that a client cannot walk further than the root directory
exported by the server. In other words, if the client wants to walk
"/.." or "/foo/../..", the server should answer like the request was
to walk "/".
This patch just does that:
- we cache the QID of the root directory at attach time
- during the walk we compare the QID of each path component with the root
QID to detect if we're in a "/.." situation
- if so, we skip the current component and go to the next one
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/9pfs/9p.h')
-rw-r--r-- | hw/9pfs/9p.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index b4f757ab54..a38603398e 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -236,6 +236,7 @@ typedef struct V9fsState int32_t root_fid; Error *migration_blocker; V9fsConf fsconf; + V9fsQID root_qid; } V9fsState; /* 9p2000.L open flags */ |