summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-12-12 00:04:51 -0500
committermidipix <writeonce@midipix.org>2016-12-12 00:08:00 -0500
commitcd5d5c3277aa300cac91d09ba02212c06e6b1218 (patch)
treeaa27d6ad3f0b5879aa10b9ad976b6b52cc5efbdd
parent28d040d8c243d28e1f851bb80f1d5ba30d22fd3c (diff)
downloadntapi-cd5d5c3277aa300cac91d09ba02212c06e6b1218.tar.bz2
ntapi-cd5d5c3277aa300cac91d09ba02212c06e6b1218.tar.xz
vmount module: removed current impl. of the virtual mount system client.
the current design of the virtual mount system turned out to be less than ideal in terms of both simplicity and robustness. since its importance seems to be rather marginal at the moment, it is better to first remove it in its entirety, and then, given sufficient interest, re-implement and integrate it into the system.
-rw-r--r--include/ntapi/nt_vmount.h329
-rw-r--r--include/ntapi/ntapi.h14
-rw-r--r--project/common.mk8
-rw-r--r--project/headers.mk1
-rw-r--r--project/tree.mk1
-rw-r--r--src/internal/ntapi.c14
-rw-r--r--src/internal/ntapi_fnapi.h13
-rw-r--r--src/vmount/ntapi_vms_cache.c216
-rw-r--r--src/vmount/ntapi_vms_client_connect.c86
-rw-r--r--src/vmount/ntapi_vms_client_disconnect.c37
-rw-r--r--src/vmount/ntapi_vms_helper.c118
-rw-r--r--src/vmount/ntapi_vms_point_attach.c52
-rw-r--r--src/vmount/ntapi_vms_ref_count.c96
-rw-r--r--src/vmount/ntapi_vms_table_query.c45
14 files changed, 0 insertions, 1030 deletions
diff --git a/include/ntapi/nt_vmount.h b/include/ntapi/nt_vmount.h
deleted file mode 100644
index 5fcaab1..0000000
--- a/include/ntapi/nt_vmount.h
+++ /dev/null
@@ -1,329 +0,0 @@
-#ifndef _NT_VMOUNT_H_
-#define _NT_VMOUNT_H_
-
-#include "nt_abi.h"
-#include "nt_compiler.h"
-#include "nt_port.h"
-#include "nt_file.h"
-#include "nt_statfs.h"
-#include "nt_tty.h"
-
-/**
- * vmount api:
- * -----------
- * this header provides an api that can be used to
- * implement a virtual mount system. note, however,
- * that this library does not (and should not)
- * provide the server-side implementation of the
- * system, but only the client-side functionality.
- * in the larger-scale midipix project, for
- * instance, a session-wide virtual mount system
- * is provided by the subsystem ntctty; if you
- * are writing a free-standing midipix application,
- * then you may either use the interfaces provided
- * by ntctty, or roll your own.
-**/
-
-
-/** virtual mount system: concepts
- * ------------------------------
- * elements of the virtual mount system are exposed to the
- * client in terms of offsets from the virtual mount system
- * base address, rather than absolute pointers. when using
- * a shared memory section, this allows each client to map
- * the virtual mount system at an address that is independent
- * of all other clients. most importantly, clients are only
- * granted read-only access to the section, and it is hence
- * impossible for a malformed client to trash the contents
- * of the virtual mount system.
- *
- * to locate information regarding a particular mount point,
- * the client traverses the virtual mount system using several
- * numeric keys.
- *
- * the server_key member of the virtual mount system structure,
- * in combination with the node-specific server keys, allow clients
- * to efficiently use a single ref_counter server call at the end of
- * the path resolution process.
- *
- * in the larger-scale midipix project, the above call fails only when
- * a referenced mount point has in the meantime become invalid; in other
- * words, the call shall succeed even if the queried mount point is
- * no longer found at the top of the target directory stack.
-**/
-
-
-typedef intptr_t nt_vms_offset;
-typedef struct nt_vms_cache_interface * nt_vms_cache;
-
-
-typedef struct _nt_vms_flags {
- uint16_t rel_depth;
- uint16_t attr;
-} nt_vms_flags;
-
-typedef struct __attr_ptr_size_aligned__ _nt_vms_point {
- intptr_t target;
- intptr_t source;
- nt_vms_offset parent;
- nt_vms_offset prev;
- nt_vms_offset next;
- int32_t fstype;
- nt_vms_flags flags;
- nt_luid luid;
- intptr_t ref_count;
- intptr_t server_key;
- int32_t stack_index;
- int32_t status;
- nt_fii fii;
- uint32_t dev_name_hash;
- uint16_t dev_name_strlen;
- uint16_t dev_name_maxlen;
- nt_vms_offset dev_name;
- uint32_t end_component_hash;
- uint16_t end_component_strlen;
- uint16_t end_component_maxlen;
- nt_vms_offset end_component;
- uint32_t src_fstype_hash;
- uint32_t src_attr;
- uint32_t src_control_flags;
- wchar16_t src_drive_letter;
- wchar16_t src_padding;
- nt_guid src_volume_guid;
- nt_fii src_fii;
- uint32_t src_dev_name_hash;
- uint32_t reserved;
-} nt_vms_point;
-
-
-typedef struct _nt_vms_node {
- nt_vms_offset prev;
- nt_vms_offset next;
- uint32_t end_component_hash;
- uint32_t dev_name_hash;
- nt_large_integer index_number;
- nt_vms_offset stack;
-} nt_vms_node;
-
-
-typedef struct __attr_ptr_size_aligned__ _nt_vms_system {
- intptr_t client_key;
- intptr_t server_key;
- void * hroot;
- intptr_t vms_points_cap;
- nt_vms_offset dev_name_head_node; /* dev_name_hash, fii.index_number */
- nt_vms_offset end_component_head_node; /* end_component_hash, dev_name_hash, fii.index_number */
-} nt_vms_system;
-
-
-typedef enum _nt_vms_opcodes {
- NT_VMS_CLIENT_OPCODE_BASE = 0x80000,
- /* virtual mount system daemon opcodes */
- NT_VMS_CLIENT_CONNECT = NT_VMS_CLIENT_OPCODE_BASE,
- NT_VMS_CLIENT_DISCONNECT,
- NT_VMS_CLIENT_UNSHARE,
- NT_VMS_CLIENT_CONFIG,
- NT_VMS_POINT_ATTACH,
- NT_VMS_POINT_DETACH,
- NT_VMS_POINT_GET_HANDLES,
- NT_VMS_POINT_GET_VOLINFO,
- NT_VMS_REF_COUNT_INC,
- NT_VMS_REF_COUNT_DEC,
- NT_VMS_TABLE_QUERY,
- NT_VMS_TABLE_CLONE,
- /* client opcodes: exclusive upper limit */
- NT_VMS_CLIENT_OPCODE_CAP
-} nt_vms_opcodes;
-
-typedef struct __attr_ptr_size_aligned__ _nt_vms_msg_info {
- uintptr_t msg_id;
- uint32_t opcode;
- int32_t status;
- uintptr_t msg_key;
-} nt_vms_msg_info;
-
-
-typedef struct __attr_ptr_size_aligned__ _nt_vms_daemon_info {
- nt_guid daemon_guid;
- uint32_t srv_pid;
- uint32_t srv_tid;
- uint32_t session;
- uint32_t instance;
- uint32_t ver_maj;
- uint32_t ver_min;
- uint32_t section_size;
- uint32_t advisory_size;
- uint32_t points_mounted;
- uint32_t points_available;
- void * section_handle;
-} nt_vms_daemon_info;
-
-
-/* attach/detach */
-typedef struct __attr_ptr_size_aligned__ _nt_vms_point_info {
- nt_vms_point point;
- nt_fii src_fii;
- uint32_t src_dev_name_hash;
- uint32_t src_flags;
-} nt_vms_point_info;
-
-
-/* inc/dec */
-typedef struct __attr_ptr_size_aligned__ _nt_vms_ref_count_info {
- nt_vms_offset ref_point;
- nt_luid luid;
- intptr_t server_key;
- intptr_t ref_count;
- nt_fii fii;
- uint32_t dev_name_hash;
- int32_t stack_index;
- void * hsource;
- void * htarget;
-} nt_vms_ref_count_info;
-
-
-/* query/clone */
-typedef struct __attr_ptr_size_aligned__ _nt_vms_table_info {
- intptr_t client_key;
- intptr_t client_section_addr;
- intptr_t client_section_size;
- intptr_t reserved;
-} nt_vms_table_info;
-
-
-typedef struct __attr_ptr_size_aligned__ _nt_vms_daemon_msg {
- nt_port_message header;
- struct {
- nt_vms_msg_info msginfo;
-
- union {
- nt_vms_daemon_info vmsinfo;
- nt_vms_point_info pointinfo;
- nt_vms_ref_count_info refcntinfo;
- };
- } data;
-} nt_vms_daemon_msg;
-
-
-typedef struct __attr_ptr_size_aligned__ _nt_vms_port_msg {
- nt_port_message header;
- nt_vms_msg_info msginfo;
-
- union {
- nt_vms_daemon_info vmsinfo;
- nt_vms_point_info pointinfo;
- nt_vms_ref_count_info refcntinfo;
- };
-} nt_vms_port_msg;
-
-
-/* vms helper functions */
-typedef nt_vms_node * __stdcall ntapi_vms_get_end_component_first_node(
- __in nt_vms_system * pvms_sys,
- __in uint32_t end_component_hash);
-
-
-typedef nt_vms_node * __stdcall ntapi_vms_get_node_by_dev_name(
- __in nt_vms_system * pvms_sys,
- __in uint32_t dev_name_hash,
- __in nt_large_integer index_number);
-
-
-typedef nt_vms_node * __stdcall ntapi_vms_get_node_by_end_component(
- __in nt_vms_system * pvms_sys,
- __in uint32_t end_component_hash,
- __in uint32_t dev_name_hash,
- __in nt_large_integer index_number);
-
-
-typedef nt_vms_point * __stdcall ntapi_vms_get_top_of_stack_mount_point(
- __in nt_vms_system * pvms_sys,
- __in nt_vms_node * node);
-
-
-/* vms optional cache functions */
-typedef nt_vms_cache __stdcall ntapi_vms_cache_alloc(
- __in nt_vms_system * vms_sys,
- __in uint32_t flags __reserved,
- __in void * options __reserved,
- __out int32_t * status __optional);
-
-
-typedef int32_t __stdcall ntapi_vms_cache_free(
- __in nt_vms_cache cache);
-
-
-typedef int32_t __stdcall ntapi_vms_cache_record_append(
- __in nt_vms_cache cache,
- __in void * hfile,
- __in uint32_t dev_name_hash,
- __in nt_large_integer index_number,
- __in intptr_t client_key,
- __in intptr_t server_key);
-
-
-typedef int32_t __stdcall ntapi_vms_cache_record_remove(
- __in nt_vms_cache cache,
- __in void * hfile);
-
-
-/* vms server calls */
-typedef int32_t __stdcall ntapi_vms_client_connect(
- __out void ** hvms,
- __in nt_tty_vms_info * vmsinfo);
-
-
-typedef int32_t __stdcall ntapi_vms_client_disconnect(
- __in void * hvms);
-
-
-typedef int32_t __stdcall ntapi_vms_client_unshare(
- __in void * hvms,
- __out nt_tty_vms_info * vmsinfo);
-
-
-typedef int32_t __stdcall ntapi_vms_client_config(
- __in void * hvms);
-
-
-typedef int32_t __stdcall ntapi_vms_point_attach(
- __in void * hvms,
- __in nt_vms_point_info * point_info);
-
-
-typedef int32_t __stdcall ntapi_vms_point_detach(
- __in void * hvms,
- __in nt_vms_ref_count_info * ref_cnt_info);
-
-
-typedef int32_t __stdcall ntapi_vms_point_get_handles(
- __in void * hvms,
- __in nt_vms_ref_count_info * ref_cnt_info);
-
-
-typedef int32_t __stdcall ntapi_vms_point_get_volinfo(
- __in void * hvms,
- __in nt_vms_point_info * point_info);
-
-
-typedef int32_t __stdcall ntapi_vms_ref_count_inc(
- __in void * hvms,
- __in nt_vms_ref_count_info * ref_cnt_info);
-
-
-typedef int32_t __stdcall ntapi_vms_ref_count_dec(
- __in void * hvms,
- __in nt_vms_ref_count_info * ref_cnt_info);
-
-
-typedef int32_t __stdcall ntapi_vms_table_query(
- __in void * hvms,
- __in nt_vms_daemon_info * vms_info);
-
-
-typedef int32_t __stdcall ntapi_vms_table_clone(
- __in void * hvms,
- __in nt_vms_daemon_info * vms_info);
-
-
-#endif
diff --git a/include/ntapi/ntapi.h b/include/ntapi/ntapi.h
index d122db5..ea4f4b9 100644
--- a/include/ntapi/ntapi.h
+++ b/include/ntapi/ntapi.h
@@ -42,7 +42,6 @@
#include "nt_daemon.h"
#include "nt_vfd.h"
#include "nt_tty.h"
-#include "nt_vmount.h"
#include "nt_hash.h"
#include "nt_debug.h"
@@ -571,19 +570,6 @@ typedef struct _ntapi_vtbl {
/* nt_statfs.h */
ntapi_tt_statfs * tt_statfs;
- /* nt_vmount.h */
- ntapi_vms_get_node_by_dev_name * vms_get_node_by_dev_name;
- ntapi_vms_get_node_by_end_component * vms_get_node_by_end_component;
- ntapi_vms_cache_alloc * vms_cache_alloc;
- ntapi_vms_cache_free * vms_cache_free;
- ntapi_vms_client_connect * vms_client_connect;
- ntapi_vms_client_disconnect * vms_client_disconnect;
- ntapi_vms_point_attach * vms_point_attach;
- ntapi_vms_point_get_handles * vms_point_get_handles;
- ntapi_vms_ref_count_inc * vms_ref_count_inc;
- ntapi_vms_ref_count_dec * vms_ref_count_dec;
- ntapi_vms_table_query * vms_table_query;
-
/* nt_debug.h */
ntapi_dbg_write * dbg_write;
ntapi_dbg_fn_call * dbg_fn_call;
diff --git a/project/common.mk b/project/common.mk
index 5854810..c0e9070 100644
--- a/project/common.mk
+++ b/project/common.mk
@@ -104,11 +104,3 @@ COMMON_SRCS = \
src/unicode/ntapi_uc_unicode_conversion_from_utf8.c \
src/unicode/ntapi_uc_unicode_validation.c \
src/vfd/ntapi_vfd_helper.c \
- src/vmount/ntapi_vms_cache.c \
- src/vmount/ntapi_vms_client_connect.c \
- src/vmount/ntapi_vms_client_disconnect.c \
- src/vmount/ntapi_vms_helper.c \
- src/vmount/ntapi_vms_point_attach.c \
- src/vmount/ntapi_vms_ref_count.c \
- src/vmount/ntapi_vms_table_query.c \
-
diff --git a/project/headers.mk b/project/headers.mk
index 2536c98..327e8e9 100644
--- a/project/headers.mk
+++ b/project/headers.mk
@@ -53,7 +53,6 @@ API_HEADERS = \
$(SOURCE_DIR)/include/$(PACKAGE)/./nt_unicode.h \
$(SOURCE_DIR)/include/$(PACKAGE)/./nt_uuid.h \
$(SOURCE_DIR)/include/$(PACKAGE)/./nt_vfd.h \
- $(SOURCE_DIR)/include/$(PACKAGE)/./nt_vmount.h \
$(SOURCE_DIR)/include/$(PACKAGE)/./ntapi.h \
API_HEADERS_BITS = \
diff --git a/project/tree.mk b/project/tree.mk
index ce03c8d..baabe2d 100644
--- a/project/tree.mk
+++ b/project/tree.mk
@@ -23,5 +23,4 @@ tree.tag:
mkdir -p src/tty
mkdir -p src/unicode
mkdir -p src/vfd
- mkdir -p src/vmount
touch tree.tag
diff --git a/src/internal/ntapi.c b/src/internal/ntapi.c
index fe928ac..e491bff 100644
--- a/src/internal/ntapi.c
+++ b/src/internal/ntapi.c
@@ -44,7 +44,6 @@
#include <ntapi/nt_statfs.h>
#include <ntapi/nt_daemon.h>
#include <ntapi/nt_tty.h>
-#include <ntapi/nt_vmount.h>
#include <ntapi/nt_hash.h>
#include <ntapi/nt_debug.h>
#include <ntapi/nt_atomic.h>
@@ -339,19 +338,6 @@ static int32_t __fastcall __ntapi_init_once(ntapi_vtbl ** pvtbl)
/* nt_statfs.h */
__ntapi->tt_statfs = __ntapi_tt_statfs;
- /* nt_vmount.h */
- __ntapi->vms_get_node_by_dev_name = __ntapi_vms_get_node_by_dev_name;
- __ntapi->vms_get_node_by_end_component = __ntapi_vms_get_node_by_end_component;
- __ntapi->vms_cache_alloc = __ntapi_vms_cache_alloc;
- __ntapi->vms_cache_free = __ntapi_vms_cache_free;
- __ntapi->vms_client_connect = __ntapi_vms_client_connect;
- __ntapi->vms_client_disconnect = __ntapi_vms_client_disconnect;
- __ntapi->vms_point_attach = __ntapi_vms_point_attach;
- __ntapi->vms_point_get_handles = __ntapi_vms_point_get_handles;
- __ntapi->vms_ref_count_inc = __ntapi_vms_ref_count_inc;
- __ntapi->vms_ref_count_dec = __ntapi_vms_ref_count_dec;
- __ntapi->vms_table_query = __ntapi_vms_table_query;
-
/* nt_debug.h */
#ifdef __DEBUG
__ntapi->dbg_write = __dbg_write;
diff --git a/src/internal/ntapi_fnapi.h b/src/internal/ntapi_fnapi.h
index 650839e..8715b7a 100644
--- a/src/internal/ntapi_fnapi.h
+++ b/src/internal/ntapi_fnapi.h
@@ -239,19 +239,6 @@ ntapi_tt_stat __ntapi_tt_stat;
/* nt_statfs.h */
ntapi_tt_statfs __ntapi_tt_statfs;
-/* nt_vmount.h */
-ntapi_vms_get_node_by_dev_name __ntapi_vms_get_node_by_dev_name;
-ntapi_vms_get_node_by_end_component __ntapi_vms_get_node_by_end_component;
-ntapi_vms_cache_alloc __ntapi_vms_cache_alloc;
-ntapi_vms_cache_free __ntapi_vms_cache_free;
-ntapi_vms_client_connect __ntapi_vms_client_connect;
-ntapi_vms_client_disconnect __ntapi_vms_client_disconnect;
-ntapi_vms_point_attach __ntapi_vms_point_attach;
-ntapi_vms_point_get_handles __ntapi_vms_point_get_handles;
-ntapi_vms_ref_count_inc __ntapi_vms_ref_count_inc;
-ntapi_vms_ref_count_dec __ntapi_vms_ref_count_dec;
-ntapi_vms_table_query __ntapi_vms_table_query;
-
/* nt_hashes.h */
ntapi_tt_populate_hashed_import_table __ntapi_tt_populate_hashed_import_table;
diff --git a/src/vmount/ntapi_vms_cache.c b/src/vmount/ntapi_vms_cache.c
deleted file mode 100644
index c97ff04..0000000
--- a/src/vmount/ntapi_vms_cache.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/********************************************************/
-/* ntapi: Native API core library */
-/* Copyright (C) 2013--2016 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
-/********************************************************/
-
-#include <psxtypes/psxtypes.h>
-#include <ntapi/nt_port.h>
-#include <ntapi/nt_vmount.h>
-#include <ntapi/ntapi.h>
-#include "ntapi_impl.h"
-
-
-typedef struct nt_vms_cache_interface {
- nt_vms_system * vms_sys;
- struct dalist_ex cache;
- size_t alloc_size;
- uintptr_t buffer[1];
-} nt_vms_cache_context;
-
-
-typedef struct _nt_vms_cache_record {
- void * hfile;
- uint32_t dev_name_hash;
- nt_large_integer index_number;
- intptr_t client_key;
- intptr_t server_key;
-} nt_vms_cache_record;
-
-
-int32_t __stdcall __ntapi_vms_cache_free(
- __in nt_vms_cache vms_cache)
-{
- int32_t status;
- void * region_addr;
- size_t region_size;
-
- /* validation */
- if (!vms_cache)
- return NT_STATUS_INVALID_PARAMETER;
-
- /* free memory */
- region_addr = vms_cache;
- region_size = vms_cache->alloc_size;
-
- status = __ntapi->zw_free_virtual_memory(
- NT_CURRENT_PROCESS_HANDLE,
- &region_addr,
- &region_size,
- NT_MEM_RELEASE);
-
- return status;
-}
-
-/* vms optional cache functions */
-nt_vms_cache __stdcall __ntapi_vms_cache_alloc(
- __in nt_vms_system * vms_sys,
- __in uint32_t flags __reserved,
- __in void * options __reserved,
- __out int32_t * status __optional)
-{
- int32_t _status;
- void * buffer;
- size_t buffer_size;
- nt_vms_cache_context * vms_cache;
-
- /* unused params */
- (void)flags;
- (void)options;
-
- /* status */
- if (!status) status = &_status;
-
- /* validation */
- if (!vms_sys) {
- *status = NT_STATUS_INVALID_PARAMETER;
- return (nt_vms_cache)0;
- }
-
- /* calculate size */
- buffer_size = sizeof(nt_vms_cache_context);
- buffer_size += vms_sys->vms_points_cap * (sizeof(nt_vms_cache_record) - sizeof(uintptr_t));
-
- /* allocate buffer */
- *status = __ntapi->zw_allocate_virtual_memory(
- NT_CURRENT_PROCESS_HANDLE,
- &buffer,
- 0,
- &buffer_size,
- NT_MEM_COMMIT,
- NT_PAGE_READWRITE);
-
- if (*status) return (nt_vms_cache)0;
-
- /* init vms cache */
- vms_cache = (nt_vms_cache_context *)buffer;
- vms_cache->vms_sys = vms_sys;
- vms_cache->alloc_size = buffer_size;
-
- /* init list */
- *status = dalist_init_ex(
- &vms_cache->cache,
- sizeof(nt_vms_cache_record),
- 0x1000,
- __ntapi->zw_allocate_virtual_memory,
- DALIST_MEMFN_NT_ALLOCATE_VIRTUAL_MEMORY);
-
- if (*status != DALIST_OK) {
- *status = NT_STATUS_UNSUCCESSFUL;
- __ntapi_vms_cache_free(vms_cache);
- return (nt_vms_cache)0;
- }
-
- /* set list buffer */
- buffer_size -= (size_t)&(((nt_vms_cache_context *)0)->buffer);
-
- *status = dalist_deposit_memory_block(
- &vms_cache->cache,
- &vms_cache->buffer,
- buffer_size);
-
- return vms_cache;
-}
-
-
-int32_t __stdcall __ntapi_vms_cache_record_append(
- __in nt_vms_cache cache,
- __in void * hfile,
- __in uint32_t dev_name_hash,
- __in nt_large_integer index_number,
- __in intptr_t client_key,
- __in intptr_t server_key)
-{
- int32_t status;
- struct dalist_node_ex * node;
- nt_vms_cache_record * cache_record;
-
- status = dalist_get_node_by_key(
- &cache->cache,
- &node,
- (uintptr_t)hfile,
- DALIST_NODE_TYPE_EXISTING,
- (uintptr_t *)0);
-
- if (status != DALIST_OK)
- status = NT_STATUS_INTERNAL_ERROR;
- else if (node)
- status = NT_STATUS_OBJECTID_EXISTS;
- else {
- status = dalist_get_free_node(&cache->cache,(void **)&node);
-
- if (status == DALIST_OK) {
- cache_record = (nt_vms_cache_record *)&node->dblock;
-
- __ntapi->tt_aligned_block_memset(
- node,
- 0,
- (uintptr_t)&((struct dalist_node_ex *)0)->dblock + sizeof(*cache_record));
-
- node->key = (uintptr_t)hfile;
-
- cache_record->hfile = hfile;
- cache_record->dev_name_hash = dev_name_hash;
- cache_record->index_number.quad = index_number.quad;
- cache_record->client_key = client_key;
- cache_record->server_key = server_key;
-
- status = dalist_insert_node_by_key(
- &cache->cache,
- node);
-
- if (status != DALIST_OK)
- dalist_deposit_free_node(
- &cache->cache,
- node);
- }
- }
-
- return status;
-}
-
-
-int32_t __stdcall __ntapi_vms_cache_record_remove(
- __in nt_vms_cache cache,
- __in void * hfile,
- __in uint32_t dev_name_hash,
- __in nt_large_integer index_number)
-{
- int32_t status;
- struct dalist_node_ex * node;
-
- (void)dev_name_hash;
- (void)index_number;
-
- status = dalist_get_node_by_key(
- &cache->cache,
- &node,
- (uintptr_t)hfile,
- DALIST_NODE_TYPE_EXISTING,
- (uintptr_t *)0);
-
- if (status != DALIST_OK)
- status = NT_STATUS_INTERNAL_ERROR;
- else if (node)
- status = NT_STATUS_INVALID_PARAMETER;
- else {
- status = dalist_discard_node(
- &cache->cache,
- node);
-
- if (status != DALIST_OK)
- status = NT_STATUS_INTERNAL_ERROR;
- }
-
- return status;
-}
diff --git a/src/vmount/ntapi_vms_client_connect.c b/src/vmount/ntapi_vms_client_connect.c
deleted file mode 100644
index 6477a1b..0000000
--- a/src/vmount/ntapi_vms_client_connect.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/********************************************************/
-/* ntapi: Native API core library */
-/* Copyright (C) 2013--2016 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
-/********************************************************/
-
-#include <psxtypes/psxtypes.h>
-#include <ntapi/nt_port.h>
-#include <ntapi/nt_tty.h>
-#include <ntapi/nt_vmount.h>
-#include <ntapi/ntapi.h>
-#include "ntapi_impl.h"
-
-
-static void __vms_port_name_from_server_info(
- __out nt_port_name * vms_port_name,
- __in nt_tty_vms_info * vmsinfo)
-{
- nt_port_attr port_attr;
-
- port_attr.type = NT_PORT_TYPE_VMOUNT;
- port_attr.subtype = NT_PORT_SUBTYPE_DEFAULT;
-
- __ntapi->tt_aligned_block_memcpy(
- (uintptr_t *)&port_attr.keys,
- (uintptr_t *)&vmsinfo->vms_keys,
- sizeof(nt_port_keys));
-
- __ntapi->tt_port_guid_from_type(
- &port_attr.guid,
- port_attr.type,
- port_attr.subtype);
-
- __ntapi->tt_port_name_from_attributes(
- vms_port_name,
- &port_attr);
-}
-
-
-int32_t __stdcall __ntapi_vms_client_connect(
- __out void ** hvms,
- __in nt_tty_vms_info * vmsinfo)
-{
- int32_t status;
- nt_port_name vms_port_name;
-
- nt_unicode_string name;
- nt_sqos sqos;
- nt_oa oa;
-
- /* vmount daemon port name */
- __vms_port_name_from_server_info(
- &vms_port_name,
- vmsinfo);
-
- /* port name init */
- name.buffer = (wchar16_t *)&vms_port_name;
- name.maxlen = 0;
- name.strlen = (uint16_t)(size_t)(&((nt_port_name *)0)->null_termination);
-
- /* init security structure */
- sqos.length = sizeof(sqos);
- sqos.impersonation_level = NT_SECURITY_IMPERSONATION;
- sqos.context_tracking_mode = NT_SECURITY_TRACKING_DYNAMIC;
- sqos.effective_only = 1;
-
- /* init the port's object attributes */
- oa.len = sizeof(oa);
- oa.root_dir = (void *)0;
- oa.obj_name = &name;
- oa.obj_attr = 0;
- oa.sec_desc = (nt_security_descriptor *)0;
- oa.sec_qos = &sqos;
-
- status = __ntapi->zw_connect_port(
- hvms,
- &name,
- &sqos,
- (nt_port_section_write *)0,
- (nt_port_section_read *)0,
- (uint32_t *)0,
- (void *)0,
- (uint32_t *)0);
-
- return status;
-}
diff --git a/src/vmount/ntapi_vms_client_disconnect.c b/src/vmount/ntapi_vms_client_disconnect.c
deleted file mode 100644
index c16ea6d..0000000
--- a/src/vmount/ntapi_vms_client_disconnect.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/********************************************************/
-/* ntapi: Native API core library */
-/* Copyright (C) 2013--2016 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
-/********************************************************/
-
-#include <psxtypes/psxtypes.h>
-#include <ntapi/nt_port.h>
-#include <ntapi/nt_vmount.h>
-#include <ntapi/ntapi.h>
-#include "ntapi_impl.h"
-
-
-int32_t __stdcall __ntapi_vms_client_disconnect(
- __in void * hvms)
-{
- nt_vms_daemon_msg msg;
-
- if (!hvms) return NT_STATUS_INVALID_HANDLE;
-
- /* msg */
- __ntapi->tt_aligned_block_memset(&msg,0,sizeof(msg));
-
- msg.header.msg_type = NT_LPC_NEW_MESSAGE;
- msg.header.data_size = sizeof(msg.data);
- msg.header.msg_size = sizeof(msg);
- msg.data.msginfo.opcode = NT_VMS_CLIENT_DISCONNECT;
-
- /* zw_request_wait_reply_port */
- __ntapi->zw_request_wait_reply_port(
- hvms,
- &msg,
- &msg);
-
- /* close client handle */
- return __ntapi->zw_close(hvms);
-}
diff --git a/src/vmount/ntapi_vms_helper.c b/src/vmount/ntapi_vms_helper.c
deleted file mode 100644
index 4d07bf0..0000000
--- a/src/vmount/ntapi_vms_helper.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/********************************************************/
-/* ntapi: Native API core library */
-/* Copyright (C) 2013--2016 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
-/********************************************************/
-
-#include <psxtypes/psxtypes.h>
-#include <ntapi/nt_port.h>
-#include <ntapi/nt_vmount.h>
-#include <ntapi/ntapi.h>
-#include "ntapi_impl.h"
-
-
-nt_vms_node * __stdcall __ntapi_vms_get_end_component_first_node(
- __in nt_vms_system * pvms_sys,
- __in uint32_t end_component_hash)
-{
- nt_vms_node * node;
-
- /* verify non-empty list and valid input */
- if (!pvms_sys->dev_name_head_node || !end_component_hash)
- return (nt_vms_node *)0;
-
- /* find first node by end component hash */
- node = (nt_vms_node *)((uintptr_t)pvms_sys + pvms_sys->end_component_head_node);
-
- while (node->next && (node->end_component_hash < end_component_hash))
- node = (nt_vms_node *)((uintptr_t)pvms_sys + node->next);
-
- if (node->end_component_hash == end_component_hash)
- return node;
- else
- return (nt_vms_node *)0;
-}
-
-
-static nt_vms_node * __stdcall __ntapi_vms_get_node(
- __in nt_vms_system * pvms_sys,
- __in uint32_t end_component_hash,
- __in uint32_t dev_name_hash,
- __in nt_large_integer index_number)
-{
- nt_vms_node * node;
-
- /* verify non-empty list */
- if (!pvms_sys->dev_name_head_node)
- return (nt_vms_node *)0;
-
- /* end_component_hash */
- if (end_component_hash) {
- node = (nt_vms_node *)((uintptr_t)pvms_sys + pvms_sys->end_component_head_node);
-
- while (node->next && (node->end_component_hash < end_component_hash))
- node = (nt_vms_node *)((uintptr_t)pvms_sys + node->next);
-
- if (node->end_component_hash != end_component_hash)
- return (nt_vms_node *)0;
- } else
- node = (nt_vms_node *)((uintptr_t)pvms_sys + pvms_sys->dev_name_head_node);
-
- /* find device nodes */
- while (node->next && (node->dev_name_hash < dev_name_hash))
- node = (nt_vms_node *)((uintptr_t)pvms_sys + node->next);
-
- if (node->dev_name_hash != dev_name_hash)
- return (nt_vms_node *)0;
-
- /* find mount-point nodes */
- while (node->next && (node->index_number.quad < index_number.quad))
- node = (nt_vms_node *)((uintptr_t)pvms_sys + node->next);
-
- if (node->index_number.quad != index_number.quad)
- return (nt_vms_node *)0;
-
- return node;
-}
-
-
-nt_vms_node * __stdcall __ntapi_vms_get_node_by_dev_name(
- __in nt_vms_system * pvms_sys,
- __in uint32_t dev_name_hash,
- __in nt_large_integer index_number)
-{
- return __ntapi_vms_get_node(
- pvms_sys,
- 0,
- dev_name_hash,
- index_number);
-}
-
-
-nt_vms_node * __stdcall __ntapi_vms_get_node_by_end_component(
- __in nt_vms_system * pvms_sys,
- __in uint32_t end_component_hash,
- __in uint32_t dev_name_hash,
- __in nt_large_integer index_number)
-{
- return __ntapi_vms_get_node(
- pvms_sys,
- end_component_hash,
- dev_name_hash,
- index_number);
-}
-
-
-nt_vms_point * __stdcall __ntapi_vms_get_top_of_stack_mount_point(
- __in nt_vms_system * pvms_sys,
- __in nt_vms_node * node)
-{
- nt_vms_point * point;
-
- point = (nt_vms_point *)((uintptr_t)pvms_sys + node->stack);
-
- while (point->next)
- point = (nt_vms_point *)((uintptr_t)pvms_sys + point->next);
-
- return point;
-}
diff --git a/src/vmount/ntapi_vms_point_attach.c b/src/vmount/ntapi_vms_point_attach.c
deleted file mode 100644
index 21ee0ce..0000000
--- a/src/vmount/ntapi_vms_point_attach.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/********************************************************/
-/* ntapi: Native API core library */
-/* Copyright (C) 2013--2016 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
-/********************************************************/
-
-#include <psxtypes/psxtypes.h>
-#include <ntapi/nt_port.h>
-#include <ntapi/nt_vmount.h>
-#include <ntapi/ntapi.h>
-#include "ntapi_impl.h"
-
-
-static int32_t __stdcall __ntapi_vms_point_attach_detach(
- __in void * hvms,
- __in nt_vms_point_info * point_info,
- __in int32_t vms_opcode)
-{
- int32_t status;
- nt_vms_daemon_msg msg;
-
- /* msg */
- __ntapi->tt_aligned_block_memset(&msg,0,sizeof(msg));
-
- msg.header.msg_type = NT_LPC_NEW_MESSAGE;
- msg.header.data_size = sizeof(msg.data);
- msg.header.msg_size = sizeof(msg);
- msg.data.msginfo.opcode = vms_opcode;
-
- /* copy point to msg */
- __ntapi->tt_aligned_block_memcpy(
- (uintptr_t *)&(msg.data.pointinfo),
- (uintptr_t *)point_info,
- sizeof(*point_info));
-
- /* zw_request_wait_reply_port */
- status = __ntapi->zw_request_wait_reply_port(hvms,&msg,&msg);
-
- /* return vms status */
- return status ? status : msg.data.msginfo.status;
-}
-
-
-int32_t __stdcall __ntapi_vms_point_attach(
- __in void * hvms,
- __in nt_vms_point_info * point_info)
-{
- return __ntapi_vms_point_attach_detach(
- hvms,
- point_info,
- NT_VMS_POINT_ATTACH);
-}
diff --git a/src/vmount/ntapi_vms_ref_count.c b/src/vmount/ntapi_vms_ref_count.c
deleted file mode 100644
index c61b2ea..0000000
--- a/src/vmount/ntapi_vms_ref_count.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/********************************************************/
-/* ntapi: Native API core library */
-/* Copyright (C) 2013--2016 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
-/********************************************************/
-
-#include <psxtypes/psxtypes.h>
-#include <ntapi/nt_port.h>
-#include <ntapi/nt_vmount.h>
-#include <ntapi/ntapi.h>
-#include "ntapi_impl.h"
-
-
-static int32_t __stdcall __ntapi_vms_ref_count_inc_dec(
- __in void * hvms,
- __in nt_vms_ref_count_info * ref_cnt_info,
- __in int32_t vms_opcode)
-{
- int32_t status;
- nt_vms_daemon_msg msg;
-
- /* msg */
- __ntapi->tt_aligned_block_memset(&msg,0,sizeof(msg));
-
- msg.header.msg_type = NT_LPC_NEW_MESSAGE;
- msg.header.data_size = sizeof(msg.data);
- msg.header.msg_size = sizeof(msg);
- msg.data.msginfo.opcode = vms_opcode;
-
- /* copy ref count info to msg */
- __ntapi->tt_aligned_block_memcpy(
- (uintptr_t *)&(msg.data.refcntinfo),
- (uintptr_t *)ref_cnt_info,
- sizeof(*ref_cnt_info));
-
- /* zw_request_wait_reply_port */
- status = __ntapi->zw_request_wait_reply_port(
- hvms,
- &msg,
- &msg);
-
- if (status) return status;
-
- /* return info */
- __ntapi->tt_aligned_block_memcpy(
- (uintptr_t *)ref_cnt_info,
- (uintptr_t *)&(msg.data.refcntinfo),
- sizeof(*ref_cnt_info));
-
- /* return vms status */
- return status ? status : msg.data.msginfo.status;
-}
-
-
-int32_t __stdcall __ntapi_vms_ref_count_inc(
- __in void * hvms,
- __in nt_vms_ref_count_info * ref_cnt_info)
-{
- return __ntapi_vms_ref_count_inc_dec(
- hvms,
- ref_cnt_info,
- NT_VMS_REF_COUNT_INC);
-}
-
-
-int32_t __stdcall __ntapi_vms_ref_count_dec(
- __in void * hvms,
- __in nt_vms_ref_count_info * ref_cnt_info)
-{
- return __ntapi_vms_ref_count_inc_dec(
- hvms,
- ref_cnt_info,
- NT_VMS_REF_COUNT_DEC);
-}
-
-
-int32_t __stdcall __ntapi_vms_point_detach(
- __in void * hvms,
- __in nt_vms_ref_count_info * ref_cnt_info)
-{
- return __ntapi_vms_ref_count_inc_dec(
- hvms,
- ref_cnt_info,
- NT_VMS_POINT_DETACH);
-}
-
-
-int32_t __stdcall __ntapi_vms_point_get_handles(
- __in void * hvms,
- __in nt_vms_ref_count_info * ref_cnt_info)
-{
- return __ntapi_vms_ref_count_inc_dec(
- hvms,
- ref_cnt_info,
- NT_VMS_POINT_GET_HANDLES);
-}
diff --git a/src/vmount/ntapi_vms_table_query.c b/src/vmount/ntapi_vms_table_query.c
deleted file mode 100644
index eb9358a..0000000
--- a/src/vmount/ntapi_vms_table_query.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/********************************************************/
-/* ntapi: Native API core library */
-/* Copyright (C) 2013--2016 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
-/********************************************************/
-
-#include <psxtypes/psxtypes.h>
-#include <ntapi/nt_port.h>
-#include <ntapi/nt_vmount.h>
-#include <ntapi/ntapi.h>
-#include "ntapi_impl.h"
-
-
-int32_t __stdcall __ntapi_vms_table_query(
- __in void * hvms,
- __in nt_vms_daemon_info * vms_info)
-{
- int32_t status;
- nt_vms_daemon_msg msg;
-
- /* msg */
- __ntapi->tt_aligned_block_memset(&msg,0,sizeof(msg));
-
- msg.header.msg_type = NT_LPC_NEW_MESSAGE;
- msg.header.data_size = sizeof(msg.data);
- msg.header.msg_size = sizeof(msg);
- msg.data.msginfo.opcode = NT_VMS_TABLE_QUERY;
-
- /* zw_request_wait_reply_port */
- status = __ntapi->zw_request_wait_reply_port(
- hvms,
- &msg,
- &msg);
-
- if (status) return status;
-
- /* return info */
- __ntapi->tt_aligned_block_memcpy(
- (uintptr_t *)vms_info,
- (uintptr_t *)&(msg.data.vmsinfo),
- sizeof(*vms_info));
-
- /* return vms status */
- return status ? status : msg.data.msginfo.status;
-}