Exemplo n.º 1
0
// InitWithVolfile initializes the Volume using the given volfile.
// This must be done before calling Mount.
//
// volfile is the path to the locally available volfile
//
// Return value is 0 for success and non 0 for failure
func (v *Volume) InitWithVolfile(volname, volfile string) int {
	cvolname := C.CString(volname)
	cvolfile := C.CString(volfile)
	defer C.free(unsafe.Pointer(cvolname))
	defer C.free(unsafe.Pointer(cvolfile))

	v.fs = C.glfs_new(cvolname)

	ret := C.glfs_set_volfile(v.fs, cvolfile)

	return int(ret)
}
Exemplo n.º 2
0
// Init initializes the Volume.
// This must be performed before calling Mount.
//
// host is the hostname/ip of a gluster server.
// volname is the name of a volume that you want to access.
//
// Return value is 0 for success and non 0 for failure.
func (v *Volume) Init(host string, volname string) int {
	cvolname := C.CString(volname)
	chost := C.CString(host)
	ctrans := C.CString("tcp")
	defer C.free(unsafe.Pointer(cvolname))
	defer C.free(unsafe.Pointer(chost))
	defer C.free(unsafe.Pointer(ctrans))

	v.fs = C.glfs_new(cvolname)

	ret := C.glfs_set_volfile_server(v.fs, ctrans, chost, 24007)

	return int(ret)
}