1 \ *****************************************************************************
2 \ * Copyright (c) 2011 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
10 \ * IBM Corporation - initial implementation
11 \ ****************************************************************************/
13 ." Populating " pwd cr
15 s" network" device-type
17 0 VALUE virtfs-rx-buffer
18 0 VALUE virtfs-tx-buffer
19 FALSE VALUE initialized?
21 2000 CONSTANT VIRTFS-BUF-SIZE \ 8k
23 virtio-setup-vd VALUE virtiodev
29 initialized? 0= IF EXIT THEN
30 virtiodev virtio-fs-shutdown
31 virtfs-rx-buffer VIRTFS-BUF-SIZE free-mem
32 virtfs-tx-buffer VIRTFS-BUF-SIZE free-mem
37 VIRTFS-BUF-SIZE alloc-mem to virtfs-rx-buffer
38 VIRTFS-BUF-SIZE alloc-mem to virtfs-tx-buffer
41 virtfs-tx-buffer ( dev tx )
42 virtfs-rx-buffer ( reg tx rx )
43 VIRTFS-BUF-SIZE ( reg tx rx size )
44 virtio-fs-init ( success )
48 ['] shutdown add-quiesce-xt
53 \ Standard network interface.
56 open 0= IF false EXIT THEN
58 init 0= IF false EXIT THEN
63 : load ( addr -- len )
64 virtiodev swap ( dev addr )
65 my-args ( dev addr str strlen )
66 1 + \ hack to make the following allocate 1 more byte
67 \-to-/ \ convert path elements
68 1 - 2dup + 0 swap c! drop
69 virtio-fs-load ( length )
80 cr s" ping not supported for this device" type cr cr
85 " virtfs" find-alias 0= IF
86 " virtfs" get-node node>path set-alias