]> git.ipfire.org Git - thirdparty/glibc.git/blob - hurd/hurd/lookup.h
* hurd/hurd/lookup.h: New file.
[thirdparty/glibc.git] / hurd / hurd / lookup.h
1 /* Declarations of file name translation functions for the GNU Hurd.
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18 Cambridge, MA 02139, USA. */
19
20 #ifndef _HURD_LOOKUP_H
21 #define _HURD_LOOKUP_H 1
22
23 /* These functions all take two callback functions as the first two arguments.
24 The first callback function USE_INIT_PORT is called as follows:
25
26 error_t use_init_port (int which, error_t (*operate) (mach_port_t));
27
28 WHICH is nonnegative value less than INIT_PORT_MAX, indicating which
29 init port is required. The callback function should call *OPERATE
30 with a send right to the appropriate init port. No user reference
31 is consumed; the right will only be used after *OPERATE returns if
32 *OPERATE has added its own user reference.
33
34 The second callback function GET_DTABLE_PORT should behave like `getdport'.
35
36 All these functions return zero on success or an error code on failure. */
37
38
39 /* Open a port to FILE with the given FLAGS and MODE (see <fcntl.h>). If
40 successful, returns zero and store the port to FILE in *PORT; otherwise
41 returns an error code. */
42
43 error_t __hurd_file_name_lookup (error_t (*use_init_port)
44 (int which,
45 error_t (*operate) (mach_port_t)),
46 file_t (*get_dtable_port) (int fd),
47 const char *file_name,
48 int flags, mode_t mode,
49 file_t *result);
50 error_t hurd_file_name_lookup (error_t (*use_init_port)
51 (int which,
52 error_t (*operate) (mach_port_t)),
53 file_t (*get_dtable_port) (int fd),
54 const char *file_name,
55 int flags, mode_t mode,
56 file_t *result);
57
58
59 /* Split FILE into a directory and a name within the directory. Look up a
60 port for the directory and store it in *DIR; store in *NAME a pointer
61 into FILE where the name within directory begins. */
62
63 error_t __hurd_file_name_split (error_t (*use_init_port)
64 (int which,
65 error_t (*operate) (mach_port_t)),
66 file_t (*get_dtable_port) (int fd),
67 const char *file_name,
68 file_t *dir, char **name);
69 error_t hurd_file_name_split (error_t (*use_init_port)
70 (int which,
71 error_t (*operate) (mach_port_t)),
72 file_t (*get_dtable_port) (int fd),
73 const char *file_name,
74 file_t *dir, char **name);
75
76
77 /* Process the values returned by `dir_lookup' et al, and loop doing
78 `dir_lookup' calls until one returns FS_RETRY_NONE. The arguments
79 should be those just passed to and/or returned from `dir_lookup',
80 `fsys_getroot', or `file_invoke_translator'. This function consumes the
81 reference in *RESULT even if it returns an error. */
82
83 error_t __hurd_file_name_lookup_retry (error_t (*use_init_port)
84 (int which,
85 error_t (*operate) (mach_port_t)),
86 file_t (*get_dtable_port) (int fd),
87 enum retry_type doretry,
88 char retryname[1024],
89 int flags, mode_t mode,
90 file_t *result);
91 error_t hurd_file_name_lookup_retry (error_t (*use_init_port)
92 (int which,
93 error_t (*operate) (mach_port_t)),
94 file_t (*get_dtable_port) (int fd),
95 enum retry_type doretry,
96 char retryname[1024],
97 int flags, mode_t mode,
98 file_t *result);
99
100
101 #endif /* hurd/lookup.h */