__hurd_file_name_lookup (error_t (*use_init_port)
(int which, error_t (*operate) (file_t)),
file_t (*get_dtable_port) (int fd),
+ error_t (*lookup)
+ (file_t dir, char *name, int flags, mode_t mode,
+ retry_type *do_retry, string_t retry_name,
+ mach_port_t *result),
const char *file_name, int flags, mode_t mode,
file_t *result)
{
enum retry_type doretry;
char retryname[1024]; /* XXX string_t LOSES! */
- error_t lookup (mach_port_t startdir)
+ error_t lookup_op (mach_port_t startdir)
{
while (file_name[0] == '/')
file_name++;
- return lookup_error (__dir_lookup (startdir, file_name, flags, mode,
- &doretry, retryname, result));
+ return lookup_error ((*lookup) (startdir, file_name, flags, mode,
+ &doretry, retryname, result));
}
+ if (! lookup)
+ lookup = __dir_lookup;
+
err = (*use_init_port) (file_name[0] == '/'
? INIT_PORT_CRDIR : INIT_PORT_CWDIR,
- &lookup);
+ &lookup_op);
if (! err)
- err = __hurd_file_name_lookup_retry (use_init_port, get_dtable_port,
+ err = __hurd_file_name_lookup_retry (use_init_port, get_dtable_port, lookup,
doretry, retryname, flags, mode,
result);
__hurd_file_name_lookup_retry (error_t (*use_init_port)
(int which, error_t (*operate) (file_t)),
file_t (*get_dtable_port) (int fd),
+ error_t (*lookup)
+ (file_t dir, char *name, int flags, mode_t mode,
+ retry_type *do_retry, string_t retry_name,
+ mach_port_t *result),
enum retry_type doretry,
char retryname[1024],
int flags, mode_t mode,
char *file_name;
int nloops;
- error_t lookup (file_t startdir)
+ error_t lookup_op (file_t startdir)
{
while (file_name[0] == '/')
file_name++;
- return lookup_error (__dir_lookup (startdir, file_name, flags, mode,
- &doretry, retryname, result));
+ return lookup_error ((*lookup) (startdir, file_name, flags, mode,
+ &doretry, retryname, result));
}
error_t reauthenticate (file_t unauth)
{
return err;
}
+ if (! lookup)
+ lookup = __dir_lookup;
+
nloops = 0;
err = 0;
do
if (startdir != MACH_PORT_NULL)
{
- err = lookup (startdir);
+ err = lookup_op (startdir);
__mach_port_deallocate (__mach_task_self (), startdir);
startdir = MACH_PORT_NULL;
}
else
- err = (*use_init_port) (dirport, &lookup);
+ err = (*use_init_port) (dirport, &lookup_op);
} while (! err);
return err;
__hurd_file_name_split (error_t (*use_init_port)
(int which, error_t (*operate) (file_t)),
file_t (*get_dtable_port) (int fd),
+ error_t (*lookup)
+ (file_t dir, char *name, int flags, mode_t mode,
+ retry_type *do_retry, string_t retry_name,
+ mach_port_t *result),
const char *file_name,
file_t *dir, char **name)
{
memcpy (dirname, file_name, lastslash - file_name);
dirname[lastslash - file_name] = '\0';
*name = (char *) lastslash + 1;
- return __hurd_file_name_lookup (use_init_port, get_dtable_port,
- dirname, 0, 0, dir);
+ return
+ __hurd_file_name_lookup (use_init_port, get_dtable_port, lookup,
+ dirname, 0, 0, dir);
}
}
else
error_t err;
file_t result;
- err = __hurd_file_name_lookup (&_hurd_ports_use, &__getdport,
+ err = __hurd_file_name_lookup (&_hurd_ports_use, &__getdport, 0,
file_name, flags, mode & ~_hurd_umask,
&result);
error_t err;
file_t result;
- err = __hurd_file_name_split (&_hurd_ports_use, &__getdport,
+ err = __hurd_file_name_split (&_hurd_ports_use, &__getdport, 0,
file_name, &result, name);
return err ? (__hurd_fail (err), MACH_PORT_NULL) : result;
_hurd_ports_use (which, operate));
}
- err = __hurd_file_name_lookup (&use_init_port, &__getdport,
+ err = __hurd_file_name_lookup (&use_init_port, &__getdport, 0,
file_name, flags, mode & ~_hurd_umask,
&result);