+2003-02-17 Vince Darley <vincentdarley@sourceforge.net>
+
+ * library/vfsUtils.tcl: added beginnings of interface for
+ filesystem configuration.
+
2003-02-01 Jean-Claude Wippler <jcw@equi4.com>
* library/vfslib.tcl: fixed bug in new vfs::zstream code,
set auto_index(::vfs::http::utime) [list source [file join $dir httpvfs.tcl]]
set auto_index(::vfs::mk4::Mount) [list source [file join $dir mk4vfs.tcl]]
set auto_index(::vfs::mk4::Unmount) [list source [file join $dir mk4vfs.tcl]]
+set auto_index(::vfs::mk4::state) [list source [file join $dir mk4vfs.tcl]]
set auto_index(::vfs::mk4::handler) [list source [file join $dir mk4vfs.tcl]]
set auto_index(::vfs::mk4::utime) [list source [file join $dir mk4vfs.tcl]]
set auto_index(::vfs::mk4::matchindirectory) [list source [file join $dir mk4vfs.tcl]]
set auto_index(::vfs::log) [list source [file join $dir vfsUtils.tcl]]
set auto_index(::vfs::RegisterMount) [list source [file join $dir vfsUtils.tcl]]
set auto_index(::vfs::unmount) [list source [file join $dir vfsUtils.tcl]]
+set auto_index(::vfs::attributes) [list source [file join $dir vfsUtils.tcl]]
set auto_index(::vfs::haveMount) [list source [file join $dir vfsUtils.tcl]]
set auto_index(::vfs::urlMount) [list source [file join $dir vfsUtils.tcl]]
set auto_index(::vfs::fileUrlMount) [list source [file join $dir vfsUtils.tcl]]
unset _unmountCmd($norm)
}
+# vfs::attributes mountpoint ?-opt val? ?...-opt val?
+proc ::vfs::attributes {mountpoint args} {
+ if {![catch {::vfs::filesystem info $mountpoint} handler]} {
+ regexp {vfs::([^:]+)::handler} $handler -> ns
+ } else {
+ # Let's assume this is a ns directly (not sure if this
+ # code path is a good idea in the long term, but it is
+ # helpful for testing)
+ set ns $mountpoint
+ package require vfs::${ns}
+ }
+
+ set attrs [list "state"]
+ set res {}
+
+ if {![llength $args]} {
+ if {[info exists ns]} {
+ foreach attr $attrs {
+ if {[info commands ::vfs::${ns}::$attr] != ""} {
+ if {[catch {::vfs::${ns}::$attr} val]} {
+ return -code error "error reading filesystem attribute\
+ \"$attr\": $val"
+ } else {
+ lappend res -$attr $val
+ }
+ }
+ }
+ }
+ return $res
+ }
+
+ if {![info exists ns]} {
+ return -code error "filesystem not known or not configurable"
+ }
+
+ while {1} {
+ foreach {attr val} $args {
+ set args [lrange $args 2 end]
+ break
+ }
+ if {[info commands ::vfs::${ns}::$attr] != ""} {
+ if {[catch {::vfs::${ns}::$attr $val} err]} {
+ return -code error "error setting filesystem attribute\
+ \"$attr\": $err"
+ } else {
+ set res $val
+ }
+ } else {
+ return -code error "filesystem attribute \"$attr\" not known"
+ }
+ }
+ if {[llength $args]} {
+ set attr [lindex $args 0]
+ if {[info commands ::vfs::${ns}::$attr] != ""} {
+ if {[catch {::vfs::${ns}::$attr} val]} {
+ return -code error "error reading filesystem attribute\
+ \"$attr\": $val"
+ } else {
+ set res $val
+ }
+ } else {
+ return -code error "filesystem attribute \"$attr\" not known"
+ }
+ }
+ return $res
+}
+
::vfs::autoMountExtension "" ::vfs::mk4::Mount vfs
::vfs::autoMountExtension .bin ::vfs::mk4::Mount vfs
::vfs::autoMountExtension .kit ::vfs::mk4::Mount vfs