Back to Wsl

WslcCreateSessionVhdVolume

doc/docs/api-reference/c/storage-apis/wslccreatesessionvhdvolume.md

2.9.4887 B
Original Source

WslcCreateSessionVhdVolume

c
STDAPI WslcCreateSessionVhdVolume(_In_ WslcSession session, _In_ const WslcVhdRequirements* options, _Outptr_opt_result_z_ PWSTR* errorMessage);
ParameterTypeDirection
sessionWslcSessionin
optionsconst WslcVhdRequirements*in
errorMessagePWSTR*out, optional

Return value: HRESULT.

Header notes:

  • WSLC_VHD_TYPE_FIXED is only honored by WslcCreateSessionVhdVolume.
  • uid and gid are honored iff flags & WSLC_VHD_REQ_FLAG_OWNER.

Example:

c
WslcVhdRequirements options = { 0 };
options.name = "cache";
options.sizeBytes = (uint64_t)8 * 1024 * 1024 * 1024;
options.type = WSLC_VHD_TYPE_DYNAMIC;
options.flags = WSLC_VHD_REQ_FLAG_OWNER;
options.uid = (uint32_t)1000;
options.gid = (uint32_t)1000;

HRESULT hr = WslcCreateSessionVhdVolume(session, &options, NULL);