access mode (which is an integer) is compatible with the file.
.TP
\fIcommand\fR \fIcreatedirectory\fR \fIr-r-a\fR
-Create a directory with the given name.
+Create a directory with the given name. The command can assume
+that all sub-directories in the path exist and are valid, and
+that the actual desired path does not yet exist (Tcl takes care
+of all of that for us).
.TP
\fIcommand\fR \fIdeletefile\fR \fIr-r-a\fR
Delete the given file.
} else {
set row [mk::select $view -count 1 parent $parent name $ele]
if { $row == "" } {
- return -code error "could not read \"$path\":\
- no such file or directory"
+ vfs::filesystem posixerror $::vfs::posix(ENOENT)
}
set v::cache($db,$parent,$ele) $row
set parent $row
if { $row != "" } {
set v::cache($db,$parent,$tail) $row
} else {
- return -code error "could not read \"$path\":\
- no such file or directory"
+ vfs::filesystem posixerror $::vfs::posix(ENOENT)
}
}
}
set view $db.dirs
set npath {}
+ # This actually does more work than is needed. Tcl's
+ # vfs only requires us to create the last piece, and
+ # Tcl already knows it is not a file.
foreach ele $sp {
set npath [file join $npath $ele]
- if { ![catch {stat $db $npath sb}] } {
+ if {![catch {stat $db $npath sb}] } {
if { $sb(type) != "directory" } {
- return -code error "can't create directory \"$npath\":\
- file already exists"
+ vfs::filesystem posixerror $::vfs::posix(EROFS)
}
set parent [mk::cursor position sb(ino)]
continue
}
} else {
if {[llength $contents]} {
- return -code error "Non-empty"
+ vfs::filesystem posixerror $::vfs::posix(ENOTEMPTY)
}
}
array unset v::cache \
set vfs::posix(EINTR) 4 ;# Interrupted system call
set vfs::posix(EIO) 5 ;# Input/output error
set vfs::posix(ENXIO) 6 ;# Device not configured
-set vfs::posix(E)2BIG 7 ;# Argument list too long
+set vfs::posix(E2BIG) 7 ;# Argument list too long
set vfs::posix(ENOEXEC) 8 ;# Exec format error
set vfs::posix(EBADF) 9 ;# Bad file descriptor
set vfs::posix(ECHILD) 10 ;# No child processes