1.1 --- a/libfsserver/lib/files/ext2_file_operations.cc Tue Jan 04 23:27:53 2022 +0100
1.2 +++ b/libfsserver/lib/files/ext2_file_operations.cc Tue Jan 04 23:43:56 2022 +0100
1.3 @@ -113,6 +113,38 @@
1.4 return L4_EOK;
1.5 }
1.6
1.7 +/* Remove an object from a directory. */
1.8 +
1.9 +long Ext2FileOperations::remove(ext2_ino_t ino)
1.10 +{
1.11 + std::lock_guard<std::mutex> guard(_lock);
1.12 +
1.13 + errcode_t retval = image_remove_by_inode(_fs, ino);
1.14 +
1.15 + // NOTE: Map error conditions.
1.16 +
1.17 + if (retval)
1.18 + return -L4_EIO;
1.19 +
1.20 + return L4_EOK;
1.21 +}
1.22 +
1.23 +/* Unlink an object from a directory. */
1.24 +
1.25 +long Ext2FileOperations::unlink(ext2_ino_t ino_parent, ext2_ino_t ino)
1.26 +{
1.27 + std::lock_guard<std::mutex> guard(_lock);
1.28 +
1.29 + errcode_t retval = image_unlink_by_inode(_fs, ino_parent, ino);
1.30 +
1.31 + // NOTE: Map error conditions.
1.32 +
1.33 + if (retval)
1.34 + return -L4_EIO;
1.35 +
1.36 + return L4_EOK;
1.37 +}
1.38 +
1.39 /* Obtain the size of a file. */
1.40
1.41 offset_t Ext2FileOperations::get_size(ext2_file_t file)