Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symlink Support #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions extent.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ func (en *ExtentNavigator) Read(offset uint64) (data []byte, err error) {
}
}()

// If the inode is not using extents, its data is stored in inode.i_block.
if !en.inode.Flag(InodeFlagExtents) {
ayushr2 marked this conversation as resolved.
Show resolved Hide resolved
if en.inode.Size() > uint64(len(en.inode.Data().IBlock)) {
ayushr2 marked this conversation as resolved.
Show resolved Hide resolved
log.Panicf("Inode size is %v bytes but does not use extents", en.inode.Size())
ayushr2 marked this conversation as resolved.
Show resolved Hide resolved
}

length := en.inode.Size() - offset
data = make([]byte, length)

copy(data, en.inode.Data().IBlock[offset:en.inode.Size()])
ayushr2 marked this conversation as resolved.
Show resolved Hide resolved
return
dsoprea marked this conversation as resolved.
Show resolved Hide resolved
}

sb := en.inode.BlockGroupDescriptor().Superblock()

blockSize := uint64(sb.BlockSize())
Expand Down
2 changes: 0 additions & 2 deletions inode.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@ func NewInodeWithReadSeeker(bgd *BlockGroupDescriptor, rs io.ReadSeeker, absolut
if inode.Flag(InodeFlagIndex) == true {
// TODO(dustin): Might be present in large directories. We might need to implement both mechanisms (this and "linear directories").
log.Panicf("hash-tree directories not currently supported")
} else if inode.Flag(InodeFlagExtents) == false {
log.Panicf("only inodes having extent trees are supported")
}

return inode, nil
Expand Down