1.1 --- a/libfsserver/include/fsserver/block_file_opener.h Sun Jul 25 00:54:12 2021 +0200 1.2 +++ b/libfsserver/include/fsserver/block_file_opener.h Sun Jul 25 17:14:53 2021 +0200 1.3 @@ -37,7 +37,7 @@ 1.4 1.5 /* Configurable methods. */ 1.6 1.7 - virtual fileid_t get_fileid(const char *path, flags_t flags); 1.8 + virtual long get_fileid(const char *path, flags_t flags, fileid_t *fileid); 1.9 1.10 virtual long make_accessor(const char *path, flags_t flags, fileid_t fileid, Accessor **accessor); 1.11 };
2.1 --- a/libfsserver/include/fsserver/ext2_file_opener.h Sun Jul 25 00:54:12 2021 +0200 2.2 +++ b/libfsserver/include/fsserver/ext2_file_opener.h Sun Jul 25 17:14:53 2021 +0200 2.3 @@ -44,7 +44,7 @@ 2.4 2.5 /* Configurable methods. */ 2.6 2.7 - virtual fileid_t get_fileid(const char *path, flags_t flags); 2.8 + virtual long get_fileid(const char *path, flags_t flags, fileid_t *fileid); 2.9 2.10 virtual long make_accessor(const char *path, flags_t flags, fileid_t fileid, Accessor **accessor); 2.11 };
3.1 --- a/libfsserver/include/fsserver/file_opening.h Sun Jul 25 00:54:12 2021 +0200 3.2 +++ b/libfsserver/include/fsserver/file_opening.h Sun Jul 25 17:14:53 2021 +0200 3.3 @@ -30,7 +30,7 @@ 3.4 class FileOpening 3.5 { 3.6 public: 3.7 - virtual fileid_t get_fileid(const char *path, flags_t flags) = 0; 3.8 + virtual long get_fileid(const char *path, flags_t flags, fileid_t *fileid) = 0; 3.9 3.10 virtual long make_accessor(const char *path, flags_t flags, fileid_t fileid, Accessor **accessor) = 0; 3.11 };
4.1 --- a/libfsserver/include/fsserver/host_file_opener.h Sun Jul 25 00:54:12 2021 +0200 4.2 +++ b/libfsserver/include/fsserver/host_file_opener.h Sun Jul 25 17:14:53 2021 +0200 4.3 @@ -56,7 +56,7 @@ 4.4 4.5 /* Configurable methods. */ 4.6 4.7 - virtual fileid_t get_fileid(const char *path, flags_t flags); 4.8 + virtual long get_fileid(const char *path, flags_t flags, fileid_t *fileid); 4.9 4.10 virtual long make_accessor(const char *path, flags_t flags, fileid_t fileid, Accessor **accessor); 4.11 };
5.1 --- a/libfsserver/include/fsserver/test_file_opener.h Sun Jul 25 00:54:12 2021 +0200 5.2 +++ b/libfsserver/include/fsserver/test_file_opener.h Sun Jul 25 17:14:53 2021 +0200 5.3 @@ -37,7 +37,7 @@ 5.4 5.5 /* Configurable methods. */ 5.6 5.7 - virtual fileid_t get_fileid(const char *path, flags_t flags); 5.8 + virtual long get_fileid(const char *path, flags_t flags, fileid_t *fileid); 5.9 5.10 virtual long make_accessor(const char *path, flags_t flags, fileid_t fileid, Accessor **accessor); 5.11 };
6.1 --- a/libfsserver/lib/files/block_file_opener.cc Sun Jul 25 00:54:12 2021 +0200 6.2 +++ b/libfsserver/lib/files/block_file_opener.cc Sun Jul 25 17:14:53 2021 +0200 6.3 @@ -26,14 +26,14 @@ 6.4 6.5 /* Return a file identifier for the given 'path'. */ 6.6 6.7 -fileid_t BlockFileOpener::get_fileid(const char *path, flags_t flags) 6.8 +long BlockFileOpener::get_fileid(const char *path, flags_t flags, fileid_t *fileid) 6.9 { 6.10 /* Obtain any registered identifier for the path. */ 6.11 6.12 - fileid_t fileid = _get_fileid(path, false); 6.13 + *fileid = _get_fileid(path, false); 6.14 6.15 - if (fileid != FILEID_INVALID) 6.16 - return fileid; 6.17 + if (*fileid != FILEID_INVALID) 6.18 + return L4_EOK; 6.19 6.20 /* Test for a valid file or an attempt to create a file. */ 6.21 6.22 @@ -42,12 +42,13 @@ 6.23 if (fp == NULL) 6.24 { 6.25 if (!(flags & O_CREAT)) 6.26 - return FILEID_INVALID; 6.27 + return -L4_ENOENT; 6.28 } 6.29 else 6.30 fclose(fp); 6.31 6.32 - return _get_fileid(path, true); 6.33 + *fileid = _get_fileid(path, true); 6.34 + return L4_EOK; 6.35 } 6.36 6.37 /* Return a new accessor for 'fileid'. */
7.1 --- a/libfsserver/lib/files/ext2_file_opener.cc Sun Jul 25 00:54:12 2021 +0200 7.2 +++ b/libfsserver/lib/files/ext2_file_opener.cc Sun Jul 25 17:14:53 2021 +0200 7.3 @@ -26,7 +26,7 @@ 7.4 7.5 /* Return a file identifier for the given 'path'. */ 7.6 7.7 -fileid_t Ext2FileOpener::get_fileid(const char *path, flags_t flags) 7.8 +long Ext2FileOpener::get_fileid(const char *path, flags_t flags, fileid_t *fileid) 7.9 { 7.10 /* Obtain the inode number. */ 7.11 7.12 @@ -36,9 +36,10 @@ 7.13 // NOTE: Support file creation. 7.14 7.15 if (retval) 7.16 - return FILEID_INVALID; 7.17 + return -L4_ENOENT; 7.18 7.19 - return (fileid_t) ino; 7.20 + *fileid = (fileid_t) ino; 7.21 + return L4_EOK; 7.22 } 7.23 7.24 /* Return a new accessor for 'fileid'. */
8.1 --- a/libfsserver/lib/files/file_paging.cc Sun Jul 25 00:54:12 2021 +0200 8.2 +++ b/libfsserver/lib/files/file_paging.cc Sun Jul 25 17:14:53 2021 +0200 8.3 @@ -116,16 +116,17 @@ 8.4 8.5 /* Obtain an identifier for the file, even for new files. */ 8.6 8.7 - fileid_t fileid = opening->get_fileid(path, flags); 8.8 + fileid_t fileid; 8.9 + long err = opening->get_fileid(path, flags, &fileid); 8.10 8.11 - if (fileid == FILEID_INVALID) 8.12 - return -L4_ENOENT; 8.13 + if (err) 8.14 + return err; 8.15 8.16 /* Obtain any existing page mapper registered for the file, or make a new 8.17 page mapper. */ 8.18 8.19 PageMapper *mapper; 8.20 - long err = get_mapper(opening, path, flags, fileid, &mapper); 8.21 + err = get_mapper(opening, path, flags, fileid, &mapper); 8.22 8.23 if (err) 8.24 return err;
9.1 --- a/libfsserver/lib/files/host_file_opener.cc Sun Jul 25 00:54:12 2021 +0200 9.2 +++ b/libfsserver/lib/files/host_file_opener.cc Sun Jul 25 17:14:53 2021 +0200 9.3 @@ -24,20 +24,21 @@ 9.4 9.5 /* Return a file identifier for the given 'path'. */ 9.6 9.7 -fileid_t HostFileOpener::get_fileid(const char *path, flags_t flags) 9.8 +long HostFileOpener::get_fileid(const char *path, flags_t flags, fileid_t *fileid) 9.9 { 9.10 (void) flags; 9.11 9.12 - /* Test for a valid file or an attempt to create a file. */ 9.13 + /* Test for a valid file. */ 9.14 9.15 FILE *fp = fopen(path, "r"); 9.16 9.17 if (fp == NULL) 9.18 - return FILEID_INVALID; 9.19 + return -L4_ENOENT; 9.20 9.21 fclose(fp); 9.22 9.23 - return _get_fileid(path, true); 9.24 + *fileid = _get_fileid(path, true); 9.25 + return L4_EOK; 9.26 } 9.27 9.28 fileid_t HostFileOpener::_get_fileid(const char *path, bool create)
10.1 --- a/libfsserver/lib/files/test_file_opener.cc Sun Jul 25 00:54:12 2021 +0200 10.2 +++ b/libfsserver/lib/files/test_file_opener.cc Sun Jul 25 17:14:53 2021 +0200 10.3 @@ -33,13 +33,14 @@ 10.4 10.5 /* Return a file identifier for the given 'path'. */ 10.6 10.7 -fileid_t TestFileOpener::get_fileid(const char *path, flags_t flags) 10.8 +long TestFileOpener::get_fileid(const char *path, flags_t flags, fileid_t *fileid) 10.9 { 10.10 (void) flags; 10.11 10.12 /* NOTE: Just convert the path to a number. */ 10.13 10.14 - return atol(path); 10.15 + *fileid = atol(path); 10.16 + return L4_EOK; 10.17 } 10.18 10.19 /* Return a new accessor for 'fileid'. */