Fixed more errors.
parent
6f8dbe44b0
commit
1f56395068
|
@ -130,7 +130,7 @@ func (in *inode) checkInvariants() {
|
||||||
|
|
||||||
// INVARIANT: Contains no duplicate names in used entries.
|
// INVARIANT: Contains no duplicate names in used entries.
|
||||||
childNames := make(map[string]struct{})
|
childNames := make(map[string]struct{})
|
||||||
for i, e := range in.entries {
|
for _, e := range in.entries {
|
||||||
if e.Type != fuseutil.DT_Unknown {
|
if e.Type != fuseutil.DT_Unknown {
|
||||||
if _, ok := childNames[e.Name]; ok {
|
if _, ok := childNames[e.Name]; ok {
|
||||||
panic(fmt.Sprintf("Duplicate name: %s", e.Name))
|
panic(fmt.Sprintf("Duplicate name: %s", e.Name))
|
||||||
|
@ -286,7 +286,7 @@ func (in *inode) RemoveChild(name string) {
|
||||||
// REQUIRES: in.isDir()
|
// REQUIRES: in.isDir()
|
||||||
// LOCKS_REQUIRED(in.mu)
|
// LOCKS_REQUIRED(in.mu)
|
||||||
func (in *inode) ReadDir(offset int, size int) (data []byte, err error) {
|
func (in *inode) ReadDir(offset int, size int) (data []byte, err error) {
|
||||||
if !in.dir {
|
if !in.isDir() {
|
||||||
panic("ReadDir called on non-directory.")
|
panic("ReadDir called on non-directory.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,8 +315,8 @@ func (in *inode) ReadDir(offset int, size int) (data []byte, err error) {
|
||||||
// REQUIRES: in.isFile()
|
// REQUIRES: in.isFile()
|
||||||
// LOCKS_REQUIRED(in.mu)
|
// LOCKS_REQUIRED(in.mu)
|
||||||
func (in *inode) ReadAt(p []byte, off int64) (n int, err error) {
|
func (in *inode) ReadAt(p []byte, off int64) (n int, err error) {
|
||||||
if in.dir {
|
if !in.isFile() {
|
||||||
panic("ReadAt called on directory.")
|
panic("ReadAt called on non-file.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the offset is in range.
|
// Ensure the offset is in range.
|
||||||
|
@ -339,8 +339,8 @@ func (in *inode) ReadAt(p []byte, off int64) (n int, err error) {
|
||||||
// REQUIRES: in.isFile()
|
// REQUIRES: in.isFile()
|
||||||
// LOCKS_REQUIRED(in.mu)
|
// LOCKS_REQUIRED(in.mu)
|
||||||
func (in *inode) WriteAt(p []byte, off int64) (n int, err error) {
|
func (in *inode) WriteAt(p []byte, off int64) (n int, err error) {
|
||||||
if in.dir {
|
if !in.isFile() {
|
||||||
panic("WriteAt called on directory.")
|
panic("WriteAt called on non-file.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the modification time.
|
// Update the modification time.
|
||||||
|
|
Loading…
Reference in New Issue