MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / Write

Function Write

src/filesystem/vfs/write.cpp:13–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11namespace vfs {
12
13auto Write(File* file, const void* buf, size_t count) -> Expected<size_t> {
14 if (file == nullptr || buf == nullptr) {
15 return std::unexpected(Error(ErrorCode::kInvalidArgument));
16 }
17
18 // 检查写入权限
19 LockGuard<SpinLock> guard(GetVfsState().vfs_lock_);
20 if ((file->flags & OpenFlags::kOWriteOnly) == 0U &&
21 (file->flags & OpenFlags::kOReadWrite) == 0U) {
22 return std::unexpected(Error(ErrorCode::kFsPermissionDenied));
23 }
24
25 if (file->ops == nullptr) {
26 return std::unexpected(Error(ErrorCode::kDeviceNotSupported));
27 }
28
29 return file->ops->Write(file, buf, count);
30}
31
32} // namespace vfs

Callers 15

InterruptInitFunction · 0.85
InterruptInitSMPFunction · 0.85
TimerHandlerFunction · 0.85
TimerInitSMPFunction · 0.85
TimerInitFunction · 0.85
DoMethod · 0.85
SendIpiMethod · 0.85
BroadcastIpiMethod · 0.85
GicdMethod · 0.85
EnableMethod · 0.85
EnableGrp1NsMethod · 0.85
DisableMethod · 0.85

Calls 3

ErrorClass · 0.85
GetVfsStateFunction · 0.85
WriteMethod · 0.45

Tested by 2

ramfs_testFunction · 0.68
fatfs_testFunction · 0.68