vmm_unix, create_block: first create file, and then truncate
This commit is contained in:
parent
325f6c3b22
commit
030f5aa379
|
@ -199,6 +199,8 @@ let create_block name size =
|
||||||
Bos.OS.File.exists block_name >>= function
|
Bos.OS.File.exists block_name >>= function
|
||||||
| true -> Error (`Msg "file already exists")
|
| true -> Error (`Msg "file already exists")
|
||||||
| false ->
|
| false ->
|
||||||
|
let fd = Unix.(openfile (Fpath.to_string block_name) [O_CREAT] 0o600) in
|
||||||
|
close_no_err fd ;
|
||||||
bytes_of_mb size >>= fun size' ->
|
bytes_of_mb size >>= fun size' ->
|
||||||
Bos.OS.File.truncate block_name size'
|
Bos.OS.File.truncate block_name size'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue