Kernel/Plan9FS: Use KString instead of String in one place

This commit is contained in:
Andreas Kling 2021-09-04 23:45:04 +02:00
parent 9d736772bd
commit 211c1c087d
Notes: sideshowbarker 2024-07-18 04:44:35 +09:00

View file

@ -782,13 +782,14 @@ KResultOr<size_t> Plan9FSInode::write_bytes(off_t offset, size_t size, const Use
size = fs().adjust_buffer_size(size);
auto data_copy = data.copy_into_string(size); // FIXME: this seems ugly
if (data_copy.is_null())
return EFAULT;
auto data_copy_or_error = data.try_copy_into_kstring(size); // FIXME: this seems ugly
if (data_copy_or_error.is_error())
return data_copy_or_error.error();
auto data_copy = data_copy_or_error.release_value();
Plan9FS::Message message { fs(), Plan9FS::Message::Type::Twrite };
message << fid() << (u64)offset;
message.append_data(data_copy);
message.append_data(data_copy->view());
result = fs().post_message_and_wait_for_a_reply(message);
if (result.is_error())
return result.error();