1.1 --- a/libfsserver/lib/files/ext2_file_operations.cc Fri Jan 14 01:10:35 2022 +0100
1.2 +++ b/libfsserver/lib/files/ext2_file_operations.cc Thu Jan 27 23:45:17 2022 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * File operations performed by an Ext2-compatible filesystem.
1.6 *
1.7 - * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2021, 2022 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -129,6 +129,25 @@
1.13 return L4_EOK;
1.14 }
1.15
1.16 +/* Rename an object. */
1.17 +
1.18 +long Ext2FileOperations::rename(ext2_ino_t source,
1.19 + ext2_ino_t source_parent, const char *source_basename,
1.20 + ext2_ino_t target_parent, const char *target_basename)
1.21 +{
1.22 + std::lock_guard<std::mutex> guard(_lock);
1.23 +
1.24 + errcode_t retval = image_rename(_fs, source, source_parent, source_basename,
1.25 + target_parent, target_basename);
1.26 +
1.27 + // NOTE: Map error conditions.
1.28 +
1.29 + if (retval)
1.30 + return -L4_EIO;
1.31 +
1.32 + return L4_EOK;
1.33 +}
1.34 +
1.35 /* Unlink an object from a directory. */
1.36
1.37 long Ext2FileOperations::unlink(ext2_ino_t ino_parent, ext2_ino_t ino)
1.38 @@ -145,6 +164,8 @@
1.39 return L4_EOK;
1.40 }
1.41
1.42 +
1.43 +
1.44 /* Obtain the size of a file. */
1.45
1.46 offset_t Ext2FileOperations::get_size(ext2_file_t file)