Changeset 2799
- Timestamp:
- Jan 6, 2012 5:31:11 PM (17 months ago)
- Location:
- ofw/fs/ext2fs
- Files:
-
- 3 edited
-
dir.fth (modified) (1 diff)
-
extent.fth (modified) (4 diffs)
-
layout.fth (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ofw/fs/ext2fs/dir.fth
r2798 r2799 196 196 \ Short symlinks hold no blocks, but have a string in the direct block list, 197 197 \ so we must not interpret that string as a block list. 198 d.#blks-held d0<> if delete-blocks then 198 d.#blks-held d0<> if 199 extent? if delete-extents else delete-blocks then 200 then 199 201 200 202 \ clear d.#blks-held, link-count, etc. -
ofw/fs/ext2fs/extent.fth
r2798 r2799 1 \ EXT4 extents 1 \ See license at end of file 2 purpose: EXT4 extent handling 3 2 4 d# 12 constant /extent-header 3 5 d# 12 constant /extent-record … … 60 62 ; 61 63 64 : get-extent-block ( 'extent-index -- 'eh ) 65 d.block ( 'eh ) 66 67 \ Error check 68 dup ext-magic? 0= if ( 'eh ) 69 ." EXT4 bad index block" cr 70 debug-me 71 then ( 'eh ) 72 ; 73 62 74 : extent->pblk# ( logical-block# -- d.physical-block# ) 63 75 direct0 ( logical-block# 'eh ) … … 65 77 ext-binsearch ( logical-block# 'extent-index ) 66 78 index-block@ ( logical-block# d.block# ) 67 d.block ( logical-block# 'eh' ) 68 69 \ Error check 70 dup ext-magic? 0= if ( logical-block# 'eh' ) 71 ." EXT4 bad index block" cr 72 debug-me 73 then ( logical-block# 'eh' ) 74 79 get-extent-block ( logical-block# 'eh' ) 75 80 loop ( logical-block# 'eh ) 76 81 … … 86 91 u>d r> extent-block@ d+ ( d.block# ) 87 92 ; 93 94 : free-extent-blocks ( 'extent -- ) 95 dup extent-block@ ( 'extent d.block# ) 96 rot >ee_len short@ 0 ?do ( d.block# ) 97 2dup d.free-block ( d.block# ) 98 1. d+ ( d.block#' ) 99 loop ( d.block#' ) 100 2drop ( ) 101 ; 102 103 : (delete-extents) ( 'eh level -- ) recursive 104 ?dup if ( 'eh level ) 105 \ Level nonzero means 'eh is an index, so recursively free its blocks. 106 1- ( 'eh level' ) 107 over >eh_entries short@ ( 'eh level #entries ) 108 0 ?do ( 'eh level ) 109 i third >extent ( 'eh level 'extent-index ) 110 index-block@ 2>r ( 'eh level r: d.block# ) 111 2r@ get-extent-block ( 'eh level 'subordinate-eh r: d.block# ) 112 over (delete-extents) ( 'eh level r: d.block# ) 113 2r> d.free-block ( 'eh level ) 114 loop ( 'eh level ) 115 2drop ( ) 116 else ( 'eh ) 117 \ Level 0 means 'eh is an extent list 118 \ For each extent in the list ... 119 dup >eh_entries short@ 0 ?do ( 'eh ) 120 \ Free all the blocks in that extent 121 i over >extent free-extent-blocks ( 'eh ) 122 loop ( 'eh ) 123 drop ( ) 124 then ( ) 125 ; 126 127 \ Delete blocks listed in the current set of extents 128 : delete-extents ( -- ) 129 direct0 ( 'eh ) 130 dup >eh_depth short@ ( 'eh depth ) 131 (delete-extents) ( ) 132 ; 133 134 \ LICENSE_BEGIN 135 \ Copyright (c) 2012 FirmWorks 136 \ 137 \ Permission is hereby granted, free of charge, to any person obtaining 138 \ a copy of this software and associated documentation files (the 139 \ "Software"), to deal in the Software without restriction, including 140 \ without limitation the rights to use, copy, modify, merge, publish, 141 \ distribute, sublicense, and/or sell copies of the Software, and to 142 \ permit persons to whom the Software is furnished to do so, subject to 143 \ the following conditions: 144 \ 145 \ The above copyright notice and this permission notice shall be 146 \ included in all copies or substantial portions of the Software. 147 \ 148 \ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 149 \ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 150 \ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 151 \ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 152 \ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 153 \ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 154 \ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 155 \ 156 \ LICENSE_END -
ofw/fs/ext2fs/layout.fth
r2798 r2799 196 196 ; 197 197 : delete-blocks ( -- ) 198 extent? if delete-extents exit then 198 199 delete-directs 199 200 indirect1 del-blk1 if 0 indirect1 int! update then
Note: See TracChangeset
for help on using the changeset viewer.
