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 /vd-len BUFFER: virtiodev
24 virtiodev virtio-setup-vd
30 initialized? 0= IF EXIT THEN
31 virtiodev virtio-fs-shutdown
32 virtfs-rx-buffer VIRTFS-BUF-SIZE free-mem
33 virtfs-tx-buffer VIRTFS-BUF-SIZE free-mem
38 VIRTFS-BUF-SIZE alloc-mem to virtfs-rx-buffer
39 VIRTFS-BUF-SIZE alloc-mem to virtfs-tx-buffer
42 virtfs-tx-buffer ( dev tx )
43 virtfs-rx-buffer ( reg tx rx )
44 VIRTFS-BUF-SIZE ( reg tx rx size )
45 virtio-fs-init ( success )
49 ['] shutdown add-quiesce-xt
54 \ Standard network interface.
57 open 0= IF false EXIT THEN
59 init 0= IF false EXIT THEN
64 : load ( addr -- len )
65 virtiodev swap ( dev addr )
66 my-args ( dev addr str strlen )
67 1 + \ hack to make the following allocate 1 more byte
68 \-to-/ \ convert path elements
69 1 - 2dup + 0 swap c! drop
70 virtio-fs-load ( length )
81 cr s" ping not supported for this device" type cr cr
86 " virtfs" find-alias 0= IF
87 " virtfs" get-node node>path set-alias