Check-in [a9fb6a2bd7]
Overview
Comment:Removed partial symlink implementation from KitDLL

Reorganized KitDLL code

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a9fb6a2bd7f21f317a00afa5c69aa4b9c4e17a90
User & Date: rkeene on 2010-09-26 04:50:52
Other Links: manifest | tags
Context
2010-09-26
04:50
Initial dir2c.tcl check-in: 1471135306 user: rkeene tags: trunk
04:50
Removed partial symlink implementation from KitDLL

Reorganized KitDLL code check-in: a9fb6a2bd7 user: rkeene tags: trunk

04:50
Fixed issue with glob of top dir check-in: cc20ec9009 user: rkeene tags: trunk
Changes

Modified kitdll/buildsrc/kitdll-0.0/cvfs.tcl from [abcb041a6c] to [aa949e8f6f].

    16     16   }
    17     17   
    18     18   # Implementation
    19     19   
    20     20   ## Filesystem Data
    21     21   namespace eval ::vfs::kitdll::data {}
    22     22   set ::vfs::kitdll::data(joe) "Test\n"
    23         -set ::vfs::kitdll::data(bob) "joe"
    24     23   set {::vfs::kitdll::metadata()} [list type directory ino 0 mode 0555 nlink 2 uid 0 gid 0 size 0 atime 0 mtime 0 ctime 0]
    25     24   set ::vfs::kitdll::metadata(joe) [list type file ino 1 mode 0444 nlink 1 uid 0 gid 0 size 5 atime 0 mtime 0 ctime 0]
    26         -set ::vfs::kitdll::metadata(bob) [list type link ino 4 mode 0444 nlink 1 uid 0 gid 0 size 5 atime 0 mtime 0 ctime 0]
    27     25   set ::vfs::kitdll::metadata(sub) [list type directory ino 2 mode 0555 nlink 1 uid 0 gid 0 size 0 atime 0 mtime 0 ctime 0]
    28     26   set ::vfs::kitdll::metadata(sub/sub2) [list type directory ino 3 mode 0555 nlink 1 uid 0 gid 0 size 0 atime 0 mtime 0 ctime 0]
    29     27   
    30     28   proc ::vfs::kitdll::data::getData {hashkey file {start 0} {end "end"}} {
    31     29   	if {![info exists ::vfs::kitdll::data($file)]} {
    32     30   		return -code error "Invalid operation"
    33     31   	}
................................................................................
    58     56   
    59     57   		lappend newchildren $tail
    60     58   	}
    61     59   
    62     60   	return $newchildren
    63     61   }
    64     62   
    65         -## VFS
    66         -### Helpers
    67         -namespace eval ::vfs::kitdll::vfsdata {}
    68         -set ::vfs::kitdll::vfsdata::fileidx -1
    69         -
    70         -### Implemented
    71         -#### Single Handler
           63  +## VFS and Chan I/O
           64  +### Dispatchers
    72     65   proc ::vfs::kitdll::vfshandler {hashkey subcmd args} {
    73     66   	set cmd $args
    74     67   	set cmd [linsert $cmd 0 "::vfs::kitdll::vfsop_${subcmd}" $hashkey]
    75     68   
    76     69   	return [eval $cmd]
    77     70   }
    78     71   
................................................................................
    79     72   proc ::vfs::kitdll::chanhandler {hashkey subcmd args} {
    80     73   	set cmd $args
    81     74   	set cmd [linsert $cmd 0 "::vfs::kitdll::chanop_${subcmd}" $hashkey]
    82     75   
    83     76   	return [eval $cmd]
    84     77   }
    85     78   
    86         -#### Actual handlers
    87         -##### Finished
           79  +### Actual handlers
           80  +#### Channel operation handlers
           81  +proc ::vfs::kitdll::chanop_initialize {hashkey chanId mode} {
           82  +	return [list initialize finalize watch read seek]
           83  +}
           84  +
           85  +proc ::vfs::kitdll::chanop_finalize {hashkey chanId} {
           86  +	unset -nocomplain ::vfs::kitdll::chandata([list $hashkey $chanId])
           87  +
           88  +	return
           89  +}
           90  +
           91  +proc ::vfs::kitdll::chanop_watch {hashkey chanId eventSpec} {
           92  +	array set chaninfo $::vfs::kitdll::chandata([list $hashkey $chanId])
           93  +
           94  +	set chaninfo(watching) $eventSpec
           95  +
           96  +	set ::vfs::kitdll::chandata([list $hashkey $chanId]) [array get chaninfo]
           97  +
           98  +	if {[lsearch -exact $chaninfo(watching) "read"] != -1} {
           99  +		after 0 [list catch "chan postevent $chanId [list {read}]"]
          100  +	}
          101  +
          102  +	return
          103  +}
          104  +
          105  +proc ::vfs::kitdll::chanop_read {hashkey chanId bytes} {
          106  +	array set chaninfo $::vfs::kitdll::chandata([list $hashkey $chanId])
          107  +
          108  +	set pos $chaninfo(pos)
          109  +	set len $chaninfo(len)
          110  +
          111  +	if {[lsearch -exact $chaninfo(watching) "read"] != -1} {
          112  +		after 0 [list catch "chan postevent $chanId [list {read}]"]
          113  +	}
          114  +
          115  +	if {$pos == $len} {
          116  +		return ""
          117  +	}
          118  +
          119  +	set end [expr {$pos + $bytes}]
          120  +	if {$end > $len} {
          121  +		set end $len
          122  +	}
          123  +
          124  +	set data [::vfs::kitdll::data::getData $hashkey $chaninfo(file) $pos $end]
          125  +
          126  +	set dataLen [string length $data]
          127  +	incr pos $dataLen
          128  +
          129  +	set chaninfo(pos) $pos
          130  +
          131  +	set ::vfs::kitdll::chandata([list $hashkey $chanId]) [array get chaninfo]
          132  +
          133  +	return $data
          134  +}
          135  +
          136  +#### VFS operation handlers
    88    137   proc ::vfs::kitdll::vfsop_stat {hashkey root relative actualpath} {
    89    138   	catch {
    90    139   		set ret [::vfs::kitdll::data::getMetadata $hashkey $relative]
    91    140   	}
    92    141   
    93    142   	if {![info exists ret]} {
    94    143   		vfs::filesystem posixerror $::vfs::posix(ENOENT)
................................................................................
   105    154   	}
   106    155   
   107    156   	return 1
   108    157   }
   109    158   
   110    159   proc ::vfs::kitdll::vfsop_matchindirectory {hashkey root relative actualpath pattern types} {
   111    160   	set ret [list]
          161  +
          162  +	catch {
          163  +		array set metadata [::vfs::kitdll::data::getMetadata $hashkey $relative]
          164  +	}
          165  +
          166  +	if {![info exists metadata]} {
          167  +		return [list]
          168  +	}
   112    169   
   113    170   	if {$pattern == ""} {
   114         -		catch {
   115         -			set test [::vfs::kitdll::data::getMetadata $hashkey $relative]
   116         -		}
   117         -
   118         -		if {![info exists test]} {
   119         -			set children [list]
   120         -		}
   121    171   
   122    172   		set children [list $relative]
   123    173   	} else {
   124    174   		set children [::vfs::kitdll::data::getChildren $hashkey $relative]
   125    175   	}
   126    176   
   127    177   	foreach child $children {
................................................................................
   203    253   			return [format {0%o} $metadata(mode)]
   204    254   		}
   205    255   	}
   206    256   
   207    257   	return -code error "Invalid index"
   208    258   }
   209    259   
   210         -proc ::vfs::kitdll::chanop_initialize {hashkey chanId mode} {
   211         -	return [list initialize finalize watch read seek]
   212         -}
   213         -
   214         -proc ::vfs::kitdll::chanop_finalize {hashkey chanId} {
   215         -	unset -nocomplain ::vfs::kitdll::chandata([list $hashkey $chanId])
   216         -
   217         -	return
   218         -}
   219         -
   220         -proc ::vfs::kitdll::chanop_watch {hashkey chanId eventSpec} {
   221         -	array set chaninfo $::vfs::kitdll::chandata([list $hashkey $chanId])
   222         -
   223         -	set chaninfo(watching) $eventSpec
   224         -
   225         -	set ::vfs::kitdll::chandata([list $hashkey $chanId]) [array get chaninfo]
   226         -
   227         -	if {[lsearch -exact $chaninfo(watching) "read"] != -1} {
   228         -		after 0 [list catch "chan postevent $chanId [list {read}]"]
   229         -	}
   230         -
   231         -	return
   232         -}
   233         -
   234         -proc ::vfs::kitdll::chanop_read {hashkey chanId bytes} {
   235         -	array set chaninfo $::vfs::kitdll::chandata([list $hashkey $chanId])
   236         -
   237         -	set pos $chaninfo(pos)
   238         -	set len $chaninfo(len)
   239         -
   240         -	if {[lsearch -exact $chaninfo(watching) "read"] != -1} {
   241         -		after 0 [list catch "chan postevent $chanId [list {read}]"]
   242         -	}
   243         -
   244         -	if {$pos == $len} {
   245         -		return ""
   246         -	}
   247         -
   248         -	set end [expr {$pos + $bytes}]
   249         -	if {$end > $len} {
   250         -		set end $len
   251         -	}
   252         -
   253         -	set data [::vfs::kitdll::data::getData $hashkey $chaninfo(file) $pos $end]
   254         -
   255         -	set dataLen [string length $data]
   256         -	incr pos $dataLen
   257         -
   258         -	set chaninfo(pos) $pos
   259         -
   260         -	set ::vfs::kitdll::chandata([list $hashkey $chanId]) [array get chaninfo]
   261         -
   262         -	return $data
   263         -}
   264         -
   265    260   proc ::vfs::kitdll::vfsop_open {hashkey root relative actualpath mode permissions} {
   266    261   	if {$mode != "" && $mode != "r"} {
   267    262   		vfs::filesystem posixerror $::vfs::posix(EROFS)
   268    263   	}
   269    264   
   270    265   	catch {
   271    266   		array set metadata [::vfs::kitdll::data::getMetadata $hashkey $relative]
................................................................................
   300    295   
   301    296   		return [list $chan]
   302    297   	}
   303    298   
   304    299   	return -code error "No way to generate a channel, need either Tcl 8.5+, \"rechan\""
   305    300   }
   306    301   
   307         -### No-Ops since we are a readonly filesystem
          302  +##### No-Ops since we are a readonly filesystem
   308    303   proc ::vfs::kitdll::vfsop_createdirectory {args} {
   309    304   	vfs::filesystem posixerror $::vfs::posix(EROFS)
   310    305   }
   311    306   proc ::vfs::kitdll::vfsop_deletefile {args} {
   312    307   	vfs::filesystem posixerror $::vfs::posix(EROFS)
   313    308   }
   314    309   proc ::vfs::kitdll::vfsop_removedirectory {args} {