1 \ tag
: Utility functions
3 \ deblocker
/ filesystem support
5 \
Copyright (C) 2003, 2004 Samuel Rydh
7 \
See the file
"COPYING" for further information about
8 \
the copyright and warranty status
of this
work.
13 \
-------------------------------------------------------------
14 \
/packages
/disk
-label
(partition handling
)
15 \
-------------------------------------------------------------
17 [IFDEF] CONFIG_DISK_LABEL
20 " disk-label" device
-name
23 variable
part-handlers \ list
with (probe
-xt
, phandle
) elements
24 variable
fs-handlers \ list
with (fs-probe
-xt
, phandle
) elements
26 : find
-part-handler
( block0
-- phandle
| 0 )
32 na1
+ @ r
> rot
2drop exit
39 : find
-filesystem
( offs
.d ih
-- ph
| 0 )
40 >r
fs-handlers
( offs
.d listhead
)
42 2over ( offs
.d nextlist
dictptr offs
.d
)
43 r
@ ( offs
.d nextlist
dictptr offs
.d ih
)
44 3 pick
( offs
.d nextlist
dictptr offs
.d ih
dictptr )
45 @ ( offs
.d nextlist
dictptr offs
.d ih probe
-xt
)
46 execute
( offs
.d nextlist
dictptr flag
? )
48 ( offs
.d nextlist
dictptr )
49 na1
+ ( offs
.d nextlist
dictptr+1 )
50 @ ( offs
.d nextlist
phandle )
51 r
> ( offs
.d nextlist
phandle ih
)
52 rot
( offs
.d
phandle ih nextlist
)
53 2drop ( offs
.d
phandle )
54 -rot
( phandle offs.d
)
58 drop
( offs.d nextlist
)
65 : register
-part-handler
( handler
-ph
-- )
66 dup
" probe" rot
find-method
67 0= abort
" Missing probe method!"
69 part-handlers
list-add
, ,
72 : register
-fs-handler
( handler
-ph
-- )
73 dup
" probe" rot
find-method
74 0= abort
" Missing probe method!"
76 fs-handlers
list-add
, ,
80 \
---------------------------------------------------------------------------
81 \ methods
to register partion
and filesystem packages
used by disk
-label
82 \
---------------------------------------------------------------------------
85 : register
-partition
-package
( -- )
86 " register-part-handler" " disk-label" $
find-package
-method ?dup
if
87 active
-package
swap execute
89 ." [disk-label] internal error" cr
93 : register
-fs-package
( -- )
94 " register-fs-handler" " disk-label" $
find-package
-method ?dup
if
95 active
-package
swap execute
97 ." [misc-files] internal error" cr