1.1 --- a/libfsserver/lib/files/ext2_file_opener.cc Wed Mar 02 22:27:19 2022 +0100
1.2 +++ b/libfsserver/lib/files/ext2_file_opener.cc Wed Mar 02 22:27:28 2022 +0100
1.3 @@ -24,6 +24,7 @@
1.4 #include <e2access/path.h>
1.5 #include <fsclient/client.h>
1.6 #include <systypes/fcntl.h>
1.7 +#include <systypes/stat.h>
1.8
1.9 #include "ext2_directory_accessor.h"
1.10 #include "ext2_file_accessor.h"
1.11 @@ -129,22 +130,7 @@
1.12 return L4_EOK;
1.13 }
1.14
1.15 -/* Populate a memory region with statistics metadata for a filesystem object. */
1.16
1.17 -long Ext2FileOpener::stat_object(const char *path, void *base, offset_t size)
1.18 -{
1.19 - struct stat *st = (struct stat *) base;
1.20 - fileid_t fileid;
1.21 - long err = get_fileid(path, 0, &fileid);
1.22 -
1.23 - if (err)
1.24 - return err;
1.25 -
1.26 - if (sizeof(struct stat) > size)
1.27 - return -L4_ENOMEM;
1.28 -
1.29 - return _ops->stat_inode((ext2_ino_t) fileid, st);
1.30 -}
1.31
1.32 /* Remove a filesystem object. */
1.33
1.34 @@ -180,6 +166,33 @@
1.35 (ext2_ino_t) target_parent, path_basename(target));
1.36 }
1.37
1.38 +/* Populate a memory region with statistics metadata for a filesystem object. */
1.39 +
1.40 +long Ext2FileOpener::stat_object(const char *path, void *base, offset_t size)
1.41 +{
1.42 + struct stat st;
1.43 + fileid_t fileid;
1.44 + long err = get_fileid(path, 0, &fileid);
1.45 +
1.46 + if (err)
1.47 + return err;
1.48 +
1.49 + if (sizeof(struct stat) > size)
1.50 + return -L4_ENOMEM;
1.51 +
1.52 + err = _ops->stat_inode((ext2_ino_t) fileid, &st);
1.53 +
1.54 + if (err)
1.55 + return err;
1.56 +
1.57 + /* Use the systypes version of the structure to permit different library
1.58 + implementations on the client and server sides of an IPC invocation. */
1.59 +
1.60 + systypes_copy_to_sys_stat(&st, (sys_stat_t *) base);
1.61 +
1.62 + return L4_EOK;
1.63 +}
1.64 +
1.65 /* Unlink a filesystem object. */
1.66
1.67 long Ext2FileOpener::unlink_object(fileid_t parent_fileid, fileid_t fileid)