summaryrefslogtreecommitdiffhomepage
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-07-06 16:22:45 -0400
committermidipix <writeonce@midipix.org>2016-07-21 03:47:25 -0400
commit74eafc5a244ec602451998c53615c6fee10f581a (patch)
tree8b5beaa4206f79f26c830f936c75cbdaf6a3cd47 /src/driver
parent3882290b0246d8ba1a63ff4000303804b344570e (diff)
downloadptycon-74eafc5a244ec602451998c53615c6fee10f581a.tar.bz2
ptycon-74eafc5a244ec602451998c53615c6fee10f581a.tar.xz
driver: gdi accessor table integration.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/ptyc_driver_ctx.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/driver/ptyc_driver_ctx.c b/src/driver/ptyc_driver_ctx.c
index e21e7ab..cd038ee 100644
--- a/src/driver/ptyc_driver_ctx.c
+++ b/src/driver/ptyc_driver_ctx.c
@@ -7,6 +7,7 @@
#include <ntcon/ntcon.h>
#include <ntapi/ntapi.h>
#include <ntapi/nt_atomic.h>
+#include <gdi/gdi.h>
#include <stdint.h>
@@ -27,6 +28,10 @@ const ntapi_vtbl * ptyc_ntapi;
static ntcon_vtbl ptyc_ntcon_vtbl;
const ntcon_vtbl * const ptyc_ntcon = &ptyc_ntcon_vtbl;
+/* gdi accessor table */
+static gdi_vtbl ptyc_gdi_vtbl;
+const gdi_vtbl * const ptyc_gdi = &ptyc_gdi_vtbl;
+
/* package info */
static const struct ptyc_source_version ptyc_src_version = {
PTYC_TAG_VER_MAJOR,
@@ -42,32 +47,37 @@ struct ptyc_driver_ctx_alloc {
const char * units[];
};
-static int32_t ptyc_ntcon_once = 0;
+static int32_t ptyc_once = 0;
-static int32_t ptyc_ntcon_init(void)
+static int32_t ptyc_vtbl_init(void)
{
int32_t status;
nt_timeout timeout;
- switch (at_locked_cas_32(&ptyc_ntcon_once,0,1)) {
+ switch (at_locked_cas_32(&ptyc_once,0,1)) {
case 0:
if ((status = ntcon_vtbl_init(&ptyc_ntcon_vtbl))) {
- at_locked_add_32(&ptyc_ntcon_once,2);
+ at_locked_add_32(&ptyc_once,2);
+ return status;
+ }
+
+ if ((status = gdi_vtbl_init(&ptyc_gdi_vtbl))) {
+ at_locked_add_32(&ptyc_once,2);
return status;
- } else {
- at_locked_inc_32(&ptyc_ntcon_once);
- return 0;
}
+ at_locked_inc_32(&ptyc_once);
+ return 0;
+
case 1:
timeout.quad = -10;
- for (; (at_locked_cas_32(&ptyc_ntcon_once,0,1) == 1); )
+ for (; (at_locked_cas_32(&ptyc_once,0,1) == 1); )
ntapi->zw_delay_execution(
NT_SYNC_ALERTABLE,
&timeout);
- return (ptyc_ntcon_once == 2)
+ return (ptyc_once == 2)
? 0 : -1;
case 2:
@@ -166,7 +176,7 @@ int ptyc_get_driver_ctx(
if (ptyc_init())
return -1;
- if (ptyc_ntcon_init())
+ if (ptyc_vtbl_init())
return -1;
options = ptyc_default_options;
@@ -233,7 +243,7 @@ int ptyc_create_driver_ctx(
if (ptyc_init())
return -1;
- if (ptyc_ntcon_init())
+ if (ptyc_vtbl_init())
return -1;
if (!(meta = argv_get(argv,ptyc_default_options,0)))