summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergiu Ivanov <unlimitedscolobb@gmail.com>2009-01-22 22:32:08 +0200
committerSergiu Ivanov <unlimitedscolobb@gmail.com>2009-01-22 22:32:08 +0200
commit26fc5b0f9071e0b6266c01e3bc46ac102b27efa6 (patch)
tree32045ef3701aa140d3004f73416348de9c45df7b
parent65360480a9540e3ed6cfdbc42a3a66c8b08b73dc (diff)
netfs_S_dir_lookup can perform usual lookups
Due to the transition to a different way of building translator stacks netfs_S_dir_lookup has been broken and nsmux could not respond normally to any lookup requests. Now netfs_S_dir_lookup is again capable of doing normal lookups. At the moment nsmux is doing nothing but mirror the real filesystem.
-rw-r--r--magic.c6
-rw-r--r--magic.h8
-rw-r--r--nsmux.c37
3 files changed, 29 insertions, 22 deletions
diff --git a/magic.c b/magic.c
index e50eda169..a7ec19796 100644
--- a/magic.c
+++ b/magic.c
@@ -32,8 +32,8 @@
/*---------------------------------------------------------------------------*/
/*---------Functions---------------------------------------------------------*/
-/*Locates the first unescaped magic separator in the supplied file
- name. Returns NULL in case it finds nothing.*/
+/*Locates the first unescaped magic separator in the supplied
+ filename. Returns NULL in case it finds nothing.*/
char * magic_find_sep (const char * name)
{
/*The position of the separator */
@@ -53,7 +53,7 @@ char * magic_find_sep (const char * name)
} /*magic_process_find_sep */
/*---------------------------------------------------------------------------*/
-/*Unescapes escaped separators in the substring of the file name
+/*Unescapes escaped separators in the substring of the filename
starting at `name` of length `sz`.*/
void magic_unescape (char * name, int sz)
{
diff --git a/magic.h b/magic.h
index 0e97f5b2b..f69a1ec25 100644
--- a/magic.h
+++ b/magic.h
@@ -26,14 +26,14 @@
/*---------------------------------------------------------------------------*/
/*---------Functions---------------------------------------------------------*/
-/*Locates the first unescaped magic separator in the supplied file
- name. Returns NULL in case it finds nothing.*/
+/*Locates the first unescaped magic separator in the supplied
+ filename. Returns NULL in case it finds nothing.*/
char * magic_find_sep (const char * name);
/*---------------------------------------------------------------------------*/
-/*Unescapes escaped separators in the substring of the file name
+/*Unescapes escaped separators in the substring of the filename
starting at `name` of length `sz`.*/
void magic_unescape (char * name, int sz);
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
-#endif /*__LIB_H__*/
+#endif /*__MAGIC_H__*/
diff --git a/nsmux.c b/nsmux.c
index 2400185d7..4e44af7b3 100644
--- a/nsmux.c
+++ b/nsmux.c
@@ -38,6 +38,7 @@
#include "debug.h"
#include "options.h"
#include "ncache.h"
+#include "magic.h"
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
@@ -615,7 +616,8 @@ error_t
{
/*We don't need to do lookups here if a proxy shadow node
is required. The lookup will be done by the translator
- starting procedure.*/
+ starting procedure. Just check whether the file
+ exists.*/
p = file_name_lookup_under (dir->nn->port, name, flags, 0);
if (p == MACH_PORT_NULL)
@@ -642,7 +644,7 @@ error_t
/*If we are at the last component of the path and need to
open a directory, do not do the lookup; the translator
starting procedure will do that.*/
- p =MACH_PORT_NULL;
+ p = MACH_PORT_NULL;
/*we have a directory here */
isdir = 1;
@@ -772,6 +774,9 @@ error_t
when not proxy nodes are to be created) */
io_statbuf_t stat;
+ /*The position of the magic separator in the filename */
+ char * sep;
+
if (!diruser)
return EOPNOTSUPP;
@@ -871,21 +876,24 @@ error_t
/* Attempt a lookup on the next pathname component. */
/*error = netfs_attempt_lookup (diruser->user, dnp, filename, &np);*/
- /*attempt an improved lookup on the next pathname component */
-/* error = netfs_attempt_lookup_improved */
-/* (diruser->user, dnp, filename, flags, lastcomp, &np, &file); */
+ /*try to find the magic separator in the filename */
+ sep = magic_find_sep (filename);
- /*If no problems have occurred during the lookup and we do
- not have O_EXCL */
- if (!error && !excl)
+ if (sep)
{
- /*If a simple file has been looked up */
- if (file)
- /*just return the port */
- goto justport;
+ /*TODO: Create a shadow node and start a translator
+ here. */
+ }
+ else
+ {
+ /*We have to do an ordinary lookup */
- /*If a shadow node has just been created, set the
- required translator on it */
+ error = netfs_attempt_lookup_improved
+ (diruser->user, dnp, filename, flags, lastcomp, &np, &file, 0);
+ if (!error && !excl && (file != MACH_PORT_NULL))
+ /*We have looked up an ordinary file, no proxy nodes
+ have been created; finalize and stop */
+ goto justport;
}
}
@@ -1586,4 +1594,3 @@ int main (int argc, char **argv)
} /*main */
/*---------------------------------------------------------------------------*/
-