blob: d3bae12c9ffc2229b7dc3bae9e4f0fbdaf4cd384 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
use fmt;
use fs;
use io;
use os;
export fn mkvol(vol: str) io::file = {
const vol = match (os::create(vol, fs::mode::USER_RWX | fs::mode::GROUP_RX | fs::mode::OTHER_RX, fs::flags::RDWR)) {
case let v: io::file =>
yield v;
case =>
fmt::fatalf("{}: cannot open file {}", os::args[0], os::args[1]);
};
return vol;
};
export fn openvol(vol: str) io::file = {
const vol = match (os::open(vol, fs::flags::RDWR)) {
case let v: io::file =>
yield v;
case =>
fmt::fatalf("{}: cannot open file {}", os::args[0], os::args[1]);
};
return vol;
};
|