14 if (file ==
nullptr) {
19 if (file->ops !=
nullptr) {
20 return file->ops->Seek(file, offset, whence);
24 uint64_t new_offset = file->offset;
31 new_offset =
static_cast<uint64_t
>(offset);
34 if (offset < 0 &&
static_cast<uint64_t
>(-offset) > file->offset) {
38 static_cast<uint64_t
>(
static_cast<int64_t
>(file->offset) + offset);
41 if (file->inode ==
nullptr) {
44 if (offset < 0 &&
static_cast<uint64_t
>(-offset) > file->inode->size) {
47 new_offset =
static_cast<uint64_t
>(
48 static_cast<int64_t
>(file->inode->size) + offset);
54 file->offset = new_offset;