// Create creates a ploop image and its DiskDescriptor.xml func Create(p *CreateParam) error { var a C.struct_ploop_create_param once.Do(loadKmod) // default image file name if p.File == "" { p.File = "root.hdd" } a.size = convertSize(p.Size) a.mode = C.int(p.Mode) if p.CLog != 0 { // ploop cluster block size, in 512-byte sectors // default is 1M cluster block size (CLog=11) // 2^11 = 2048 sectors, 2048*512 = 1M a.blocksize = 1 << p.CLog } a.flags = C.uint(p.Flags) a.image = C.CString(p.File) defer cfree(a.image) a.fstype = C.CString("ext4") defer cfree(a.fstype) ret := C.ploop_create_image(&a) return mkerr(ret) }
// Create creates a ploop image and its DiskDescriptor.xml func Create(p *CreateParam) error { var a C.struct_ploop_create_param // default image file name if p.file == "" { p.file = "root.hdd" } a.size = convertSize(p.size) a.mode = C.int(p.mode) a.image = C.CString(p.file) defer cfree(a.image) a.fstype = C.CString("ext4") defer cfree(a.fstype) ret := C.ploop_create_image(&a) return mkerr(ret) }