Displaying 3 results from an estimated 3 matches for "implopen".
Did you mean:
imap_open
2020 Apr 21
0
Re: [PATCH nbdkit v2] Add the ability to write plugins in golang.
...etSize and PRead are required for all plugins.
// Other methods are optional.
Close()
GetSize() (uint64, error)
PRead(buf []byte, offset uint64, flags uint32) error
}
Now, we need todo some mapping
var connectionID uint
var connectionMap map[uint]PluginConnectionInterface
//export implOpen
func implOpen(c_readonly C.int) unsafe.Pointer {
readonly := false
if c_readonly != 0 {
readonly = true
}
h, err := pluginImpl.Open(readonly)
if err != nil {
set_error(err)
return nil
}
if h == 0 {
panic("Open method: handle must be != 0")
}
id := connectionI...
2020 Apr 21
2
[PATCH nbdkit v2] Add the ability to write plugins in golang.
...ginImpl.Config(C.GoString(key), C.GoString(value))
+ if err != nil {
+ set_error(err)
+ return -1
+ }
+ return 0
+}
+
+//export implConfigComplete
+func implConfigComplete() C.int {
+ err := pluginImpl.ConfigComplete()
+ if err != nil {
+ set_error(err)
+ return -1
+ }
+ return 0
+}
+
+//export implOpen
+func implOpen(c_readonly C.int) unsafe.Pointer {
+ readonly := false
+ if c_readonly != 0 {
+ readonly = true
+ }
+ h, err := pluginImpl.Open(readonly)
+ if err != nil {
+ set_error(err)
+ return nil
+ }
+ if h == 0 {
+ panic("Open method: handle must be != 0")
+ }
+ return unsafe.Po...
2020 Apr 23
2
Re: [PATCH nbdkit v2] Add the ability to write plugins in golang.
...ginImpl.Config(C.GoString(key), C.GoString(value))
+ if err != nil {
+ set_error(err)
+ return -1
+ }
+ return 0
+}
+
+//export implConfigComplete
+func implConfigComplete() C.int {
+ err := pluginImpl.ConfigComplete()
+ if err != nil {
+ set_error(err)
+ return -1
+ }
+ return 0
+}
+
+//export implOpen
+func implOpen(c_readonly C.int) unsafe.Pointer {
+ readonly := false
+ if c_readonly != 0 {
+ readonly = true
+ }
+ h, err := pluginImpl.Open(readonly)
+ if err != nil {
+ set_error(err)
+ return nil
+ }
+ id := nextConnectionId
+ nextConnectionId++
+ connectionMap[id] = h
+ return unsafe.Point...