File 2671-Remove-erl_interface-registry.patch of Package erlang
From f87288b0a2534843b53df174e3728e921c2efd60 Mon Sep 17 00:00:00 2001
From: Rickard Green <rickard@erlang.org>
Date: Tue, 15 Dec 2020 18:34:51 +0100
Subject: [PATCH] Remove erl_interface registry
---
lib/erl_interface/doc/src/Makefile | 3 +-
lib/erl_interface/doc/src/ei_users_guide.xml | 170 -----
lib/erl_interface/doc/src/notes.xml | 3 +-
lib/erl_interface/doc/src/ref_man.xml | 1 -
lib/erl_interface/doc/src/registry.xml | 642 ------------------
lib/erl_interface/include/ei.h | 176 +----
lib/erl_interface/src/Makefile.in | 41 +-
lib/erl_interface/src/README.internal | 7 -
lib/erl_interface/src/registry/hash.h | 48 --
lib/erl_interface/src/registry/hash_dohash.c | 46 --
lib/erl_interface/src/registry/hash_foreach.c | 45 --
lib/erl_interface/src/registry/hash_freetab.c | 59 --
lib/erl_interface/src/registry/hash_insert.c | 109 ---
lib/erl_interface/src/registry/hash_isprime.c | 58 --
lib/erl_interface/src/registry/hash_lookup.c | 43 --
lib/erl_interface/src/registry/hash_newtab.c | 53 --
lib/erl_interface/src/registry/hash_remove.c | 88 ---
lib/erl_interface/src/registry/hash_resize.c | 68 --
lib/erl_interface/src/registry/hash_rlookup.c | 44 --
lib/erl_interface/src/registry/reg.h | 47 --
lib/erl_interface/src/registry/reg_close.c | 69 --
lib/erl_interface/src/registry/reg_delete.c | 37 -
lib/erl_interface/src/registry/reg_dirty.c | 37 -
lib/erl_interface/src/registry/reg_dump.c | 321 ---------
lib/erl_interface/src/registry/reg_free.c | 48 --
lib/erl_interface/src/registry/reg_get.c | 91 ---
lib/erl_interface/src/registry/reg_getf.c | 36 -
lib/erl_interface/src/registry/reg_geti.c | 36 -
lib/erl_interface/src/registry/reg_getp.c | 40 --
lib/erl_interface/src/registry/reg_gets.c | 39 --
lib/erl_interface/src/registry/reg_make.c | 50 --
lib/erl_interface/src/registry/reg_open.c | 42 --
lib/erl_interface/src/registry/reg_purge.c | 77 ---
lib/erl_interface/src/registry/reg_resize.c | 37 -
lib/erl_interface/src/registry/reg_restore.c | 323 ---------
lib/erl_interface/src/registry/reg_set.c | 75 --
lib/erl_interface/src/registry/reg_setf.c | 62 --
lib/erl_interface/src/registry/reg_seti.c | 63 --
lib/erl_interface/src/registry/reg_setp.c | 63 --
lib/erl_interface/src/registry/reg_sets.c | 66 --
lib/erl_interface/src/registry/reg_stat.c | 42 --
lib/erl_interface/src/registry/reg_tabstat.c | 38 --
system/doc/general_info/deprecations_23.inc | 10 +-
system/doc/general_info/removed_24.inc | 8 +
.../general_info/scheduled_for_removal_24.inc | 12 -
45 files changed, 16 insertions(+), 3457 deletions(-)
delete mode 100644 lib/erl_interface/doc/src/registry.xml
delete mode 100644 lib/erl_interface/src/registry/hash.h
delete mode 100644 lib/erl_interface/src/registry/hash_dohash.c
delete mode 100644 lib/erl_interface/src/registry/hash_foreach.c
delete mode 100644 lib/erl_interface/src/registry/hash_freetab.c
delete mode 100644 lib/erl_interface/src/registry/hash_insert.c
delete mode 100644 lib/erl_interface/src/registry/hash_isprime.c
delete mode 100644 lib/erl_interface/src/registry/hash_lookup.c
delete mode 100644 lib/erl_interface/src/registry/hash_newtab.c
delete mode 100644 lib/erl_interface/src/registry/hash_remove.c
delete mode 100644 lib/erl_interface/src/registry/hash_resize.c
delete mode 100644 lib/erl_interface/src/registry/hash_rlookup.c
delete mode 100644 lib/erl_interface/src/registry/reg.h
delete mode 100644 lib/erl_interface/src/registry/reg_close.c
delete mode 100644 lib/erl_interface/src/registry/reg_delete.c
delete mode 100644 lib/erl_interface/src/registry/reg_dirty.c
delete mode 100644 lib/erl_interface/src/registry/reg_dump.c
delete mode 100644 lib/erl_interface/src/registry/reg_free.c
delete mode 100644 lib/erl_interface/src/registry/reg_get.c
delete mode 100644 lib/erl_interface/src/registry/reg_getf.c
delete mode 100644 lib/erl_interface/src/registry/reg_geti.c
delete mode 100644 lib/erl_interface/src/registry/reg_getp.c
delete mode 100644 lib/erl_interface/src/registry/reg_gets.c
delete mode 100644 lib/erl_interface/src/registry/reg_make.c
delete mode 100644 lib/erl_interface/src/registry/reg_open.c
delete mode 100644 lib/erl_interface/src/registry/reg_purge.c
delete mode 100644 lib/erl_interface/src/registry/reg_resize.c
delete mode 100644 lib/erl_interface/src/registry/reg_restore.c
delete mode 100644 lib/erl_interface/src/registry/reg_set.c
delete mode 100644 lib/erl_interface/src/registry/reg_setf.c
delete mode 100644 lib/erl_interface/src/registry/reg_seti.c
delete mode 100644 lib/erl_interface/src/registry/reg_setp.c
delete mode 100644 lib/erl_interface/src/registry/reg_sets.c
delete mode 100644 lib/erl_interface/src/registry/reg_stat.c
delete mode 100644 lib/erl_interface/src/registry/reg_tabstat.c
create mode 100644 system/doc/general_info/removed_24.inc
diff --git a/lib/erl_interface/doc/src/Makefile b/lib/erl_interface/doc/src/Makefile
index 73344b1a65..f709176508 100644
--- a/lib/erl_interface/doc/src/Makefile
+++ b/lib/erl_interface/doc/src/Makefile
@@ -39,8 +39,7 @@ RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN)
XML_REF1_FILES = erl_call_cmd.xml
XML_REF3_FILES = ei_global.xml \
ei.xml \
- ei_connect.xml \
- registry.xml
+ ei_connect.xml
BOOK_FILES = book.xml
XML_APPLICATION_FILES = ref_man.xml
diff --git a/lib/erl_interface/doc/src/ei_users_guide.xml b/lib/erl_interface/doc/src/ei_users_guide.xml
index 5dfaf556da..5c9452b516 100644
--- a/lib/erl_interface/doc/src/ei_users_guide.xml
+++ b/lib/erl_interface/doc/src/ei_users_guide.xml
@@ -70,7 +70,6 @@
<item>Sending and receiving Erlang messages</item>
<item>Remote procedure calls</item>
<item>Using global names</item>
- <item>Using the registry</item>
</list>
</section>
@@ -528,173 +527,4 @@ ei_global_register(fd,servicename,ei_self(ec)); ]]></code>
ei_global_unregister(&ec,fd,servicename); ]]></code>
</section>
- <section>
- <title>Using the Registry</title>
-
- <note><p>This functionality is deprecated as of OTP 23, and will be
- removed in OTP 24. Reasonably new <c>gcc</c> compilers will issue
- deprecation warnings. In order to disable these warnings, define the
- macro <c>EI_NO_DEPR_WARN</c>.</p></note>
-
- <p>This section describes the use of the registry, a simple mechanism
- for storing key-value pairs in a C-node, as well as backing them up or
- restoring them from an <c>Mnesia</c> table on an Erlang node. For more
- detailed information about the individual API functions, see the
- <seecref marker="registry"><c>registry</c></seecref> module.</p>
-
- <p>Keys are strings, that is, <c>NULL</c>-terminated arrays of characters, and
- values are arbitrary objects. Although integers and floating point numbers
- are treated specially by the registry, you can store strings or binary
- objects of any type as pointers.</p>
-
- <p>To start, open a registry:</p>
-
- <code type="none"><![CDATA[
-ei_reg *reg;
-
-reg = ei_reg_open(45); ]]></code>
-
- <p>The number <c>45</c> in the example indicates the approximate number of
- objects that you expect to store in the registry. Internally the
- registry uses hash tables with collision chaining, so there is no
- absolute upper limit on the number of objects that the registry can
- contain, but if performance or memory usage is important, then you
- are to choose a number accordingly. The registry can be resized later.</p>
-
- <p>You can open as many registries as you like (if memory permits).</p>
-
- <p>Objects are stored and retrieved through set and get functions.
- The following example shows how to store integers, floats, strings,
- and arbitrary binary objects:</p>
-
- <code type="none"><![CDATA[
-struct bonk *b = malloc(sizeof(*b));
-char *name = malloc(7);
-
-ei_reg_setival(reg,"age",29);
-ei_reg_setfval(reg,"height",1.85);
-
-strcpy(name,"Martin");
-ei_reg_setsval(reg,"name",name);
-
-b->l = 42;
-b->m = 12;
-ei_reg_setpval(reg,"jox",b,sizeof(*b)); ]]></code>
-
- <p>If you try to store an object in the registry and there is an
- existing object with the same key, the new value replaces the old
- one. This is done regardless of whether the new object and the old one
- have the same type, so you can, for example, replace a string with an
- integer. If the existing value is a string or binary, it is freed
- before the new value is assigned.</p>
-
- <p>Stored values are retrieved from the registry as follows:</p>
-
- <code type="none"><![CDATA[
-long i;
-double f;
-char *s;
-struct bonk *b;
-int size;
-
-i = ei_reg_getival(reg,"age");
-f = ei_reg_getfval(reg,"height");
-s = ei_reg_getsval(reg,"name");
-b = ei_reg_getpval(reg,"jox",&size); ]]></code>
-
- <p>In all the above examples, the object must exist and it must be of
- the right type for the specified operation. If you do not know the
- type of an object, you can ask:</p>
-
- <code type="none"><![CDATA[
-struct ei_reg_stat buf;
-
-ei_reg_stat(reg,"name",&buf); ]]></code>
-
- <p>Buf is initialized to contain object attributes.</p>
-
- <p>Objects can be removed from the registry:</p>
-
- <code type="none"><![CDATA[
-ei_reg_delete(reg,"name"); ]]></code>
-
- <p>When you are finished with a registry, close it to remove all the
- objects and free the memory back to the system:</p>
-
- <code type="none"><![CDATA[
-ei_reg_close(reg); ]]></code>
-
- <section>
- <title>Backing Up the Registry to Mnesia</title>
- <p>The contents of a registry can be backed up to
- <seeerl marker="mnesia:mnesia"><c>Mnesia</c></seeerl> on a "nearby" Erlang
- node. You must provide an open connection to the Erlang node
- (see <seecref marker="ei_connect"><c>ei_connect</c></seecref>).
- Also, <c>Mnesia</c> 3.0 or later must be running
- on the Erlang node before the backup is initiated:</p>
-
- <code type="none"><![CDATA[
-ei_reg_dump(fd, reg, "mtab", dumpflags); ]]></code>
-
- <p>This example back up the contents of the registry to the
- specified <c>Mnesia</c> table <c>"mtab"</c>.
- Once a registry has been backed
- up to <c>Mnesia</c> like this, more backups only affect
- objects that have been modified since the most recent backup, that is,
- objects that have been created, changed, or deleted. The backup
- operation is done as a single atomic transaction, so that either the
- entire backup is performed or none of it.</p>
-
- <p>Likewise, a registry can be restored from a <c>Mnesia</c> table:</p>
-
- <code type="none"><![CDATA[
-ei_reg_restore(fd, reg, "mtab"); ]]></code>
-
- <p>This reads the entire contents of <c>"mtab"</c> into the
- specified registry. After the restore, all the objects in the registry
- are marked as unmodified, so a later backup only affects
- objects that you have modified since the restore.</p>
-
- <p>Notice that if you restore to a non-empty registry, objects in the
- table overwrite objects in the registry with the same keys. Also,
- the <em>entire</em> contents of the registry is marked as unmodified
- after the restore, including any modified objects that were not
- overwritten by the restore operation. This may not be your
- intention.</p>
- </section>
-
- <section>
- <title>Storing Strings and Binaries</title>
- <p>When string or binary objects are stored in the registry it is
- important that some simple guidelines are followed.</p>
-
- <p>Most importantly, the object must have been created with a single call
- to <c>malloc()</c> (or similar), so that it can later be
- removed by a single call to <c>free()</c>.
- Objects are freed by the registry
- when it is closed, or when you assign a new value to an object that
- previously contained a string or binary.</p>
-
- <p>Notice that if you store binary objects that are context-dependent
- (for example, containing pointers or open file descriptors),
- they lose their meaning if they are backed up to a <c>Mnesia</c> table
- and later restored in a different context.</p>
-
- <p>When you retrieve a stored string or binary value from the registry,
- the registry maintains a pointer to the object and you are passed a
- copy of that pointer. You should never free an object retrieved in
- this manner because when the registry later attempts to free it, a
- runtime error occurs that likely causes the C-node to crash.</p>
-
- <p>You are free to modify the contents of an object retrieved this way.
- However, when you do so, the registry is not aware of your changes,
- possibly causing it to be missed the next time you make an
- <c>Mnesia</c> backup of the registry contents. This can be avoided if
- you mark the object as dirty after any such changes with
- <seecref marker="registry#ei_reg_markdirty">
- <c>ei_reg_markdirty</c></seecref>, or pass appropriate flags to
- <seecref marker="registry#ei_reg_dump">
- <c>ei_reg_dump</c></seecref>.</p>
- </section>
- </section>
</chapter>
diff --git a/lib/erl_interface/doc/src/notes.xml b/lib/erl_interface/doc/src/notes.xml
index fde35537ba..3a7c64b98b 100644
--- a/lib/erl_interface/doc/src/notes.xml
+++ b/lib/erl_interface/doc/src/notes.xml
@@ -270,8 +270,7 @@
Own Id: OTP-16624</p>
</item>
<item>
- <p>The <c>erl_interface</c> <seecref
- marker="erl_interface:registry"><c>registry</c></seecref>
+ <p>The <c>erl_interface</c> <c>registry</c>
functionality is deprecated as of OTP 23, and will be
removed in OTP 24. Reasonably new <c>gcc</c> compilers
will issue deprecation warnings when using this
diff --git a/lib/erl_interface/doc/src/ref_man.xml b/lib/erl_interface/doc/src/ref_man.xml
index 064a83a4ba..a0d75128a3 100644
--- a/lib/erl_interface/doc/src/ref_man.xml
+++ b/lib/erl_interface/doc/src/ref_man.xml
@@ -32,7 +32,6 @@
</description>
<xi:include href="ei.xml"/>
<xi:include href="ei_connect.xml"/>
- <xi:include href="registry.xml"/>
<xi:include href="ei_global.xml"/>
<xi:include href="erl_call_cmd.xml"/>
</application>
diff --git a/lib/erl_interface/doc/src/registry.xml b/lib/erl_interface/doc/src/registry.xml
deleted file mode 100644
index 92858516d9..0000000000
--- a/lib/erl_interface/doc/src/registry.xml
+++ /dev/null
@@ -1,642 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE cref SYSTEM "cref.dtd">
-
-<cref>
- <header>
- <copyright>
- <year>1998</year><year>2020</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>registry</title>
- <prepared>Gordon Beaton</prepared>
- <responsible>Gordon Beaton</responsible>
- <docno></docno>
- <approved>Gordon Beaton</approved>
- <checked>Gordon Beaton</checked>
- <date>1998-07-07</date>
- <rev>A</rev>
- <file>registry.xml</file>
- </header>
- <lib>registry</lib>
- <libsummary>Store and back up key-value pairs.</libsummary>
- <description>
- <note><p>This functionality is deprecated as of OTP 23, and will be
- removed in OTP 24. Reasonably new <c>gcc</c> compilers will issue
- deprecation warnings. In order to disable these warnings, define the
- macro <c>EI_NO_DEPR_WARN</c>.</p></note>
-
- <p>This module provides support for storing key-value
- pairs in a table known as a registry, backing up registries to
- <seeerl marker="mnesia:mnesia">Mnesia</seeerl>
- in an atomic manner, and later restoring the contents of a
- registry from <c>Mnesia</c>.</p>
- </description>
-
- <funcs>
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_close(reg)</nametext></name>
- <fsummary>Close a registry.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- </type>
- <desc>
- <p>A registry that has previously been created with
- <c>ei_reg_open()</c> is closed, and all the objects it
- contains are freed.</p>
- <p><c>reg</c> is the registry to close.</p>
- <p>Returns <c>0</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_delete(reg,key)</nametext></name>
- <fsummary>Delete an object from the registry.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- </type>
- <desc>
- <p>Deletes an object from the registry. The object is not
- removed from the registry, it is only marked for later
- removal so that on later backups to <c>Mnesia</c>, the
- corresponding object can be removed from the <c>Mnesia</c> table as
- well. If another object is later created with the same key, the
- object will be reused. </p>
- <p>The object is removed from the registry after a call to
- <c>ei_reg_dump()</c> or <c>ei_reg_purge()</c>.
- </p>
- <list type="bulleted">
- <item><c>reg</c> is the registry containing
- <c>key</c>.</item>
- <item><c>key</c> is the object to remove.</item>
- </list>
- <p>Returns <c>0</c> on success, otherwise <c>-1</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_dump(fd,reg,mntab,flags)</nametext></name>
- <fsummary>Back up a registry to Mnesia.</fsummary>
- <type>
- <v>int fd;</v>
- <v>ei_reg *reg;</v>
- <v>const char *mntab;</v>
- <v>int flags;</v>
- </type>
- <desc>
- <p>Dumps the contents of a registry to a <c>Mnesia</c> table in an
- atomic manner, that is, either all data or no data is updated.
- If any errors are encountered while backing up
- the data, the entire operation is aborted.</p>
- <list type="bulleted">
- <item><c>fd</c> is an open connection to Erlang.
- <c>Mnesia</c> 3.0 or later must be running on the Erlang node.
- </item>
- <item><c>reg</c> is the registry to back up.</item>
- <item><c>mntab</c> is the name of the <c>Mnesia</c> table
- where the backed up data is to be placed. If the table does not
- exist, it is created automatically using configurable defaults.
- For information about configuring this behavior, see
- <seeerl marker="mnesia:mnesia"><c>Mnesia</c></seeerl>.</item>
- </list>
- <p>If <c>flags</c> is <c>0</c>, the backup includes only
- those objects that have been created, modified, or deleted since the
- last backup or restore (that is, an incremental backup). After the
- backup, any objects that were marked dirty are now clean, and any
- objects that had been marked for deletion are deleted.</p>
- <p>Alternatively, setting flags to <c>EI_FORCE</c> causes a full
- backup to be done, and <c>EI_NOPURGE</c> causes the deleted objects
- to be left in the registry afterwards. These can be bitwise OR'ed
- together if both behaviors are desired. If <c>EI_NOPURGE</c> was
- specified, <c>ei_reg_purge()</c> can be used to
- explicitly remove the deleted items from the registry later.</p>
- <p>Returns <c>0</c> on success, otherwise <c>-1</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>double</ret><nametext>ei_reg_getfval(reg,key)</nametext></name>
- <fsummary>Get a floating point object.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- </type>
- <desc>
- <p>Gets the value associated with <c>key</c> in the
- registry. The value must be a floating point type.</p>
- <list type="bulleted">
- <item><c>reg</c> is the registry where the object will be
- looked up.</item>
- <item><c>key</c> is the name of the object to look up.
- </item>
- </list>
- <p>On success, the function returns the value associated with
- <c>key</c>.
- If the object is not found or if it is not a floating point
- object, <c>-1.0</c> is returned. To avoid problems with in-band error
- reporting (that is, if you cannot distinguish between <c>-1.0</c> and
- a valid result), use the more general function
- <c>ei_reg_getval()</c> instead.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_getival(reg,key)</nametext></name>
- <fsummary>Get an integer object.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- </type>
- <desc>
- <p>Gets the value associated with <c>key</c> in the
- registry. The value must be an integer.</p>
- <list type="bulleted">
- <item><c>reg</c> is the registry where the object will be
- looked up.</item>
- <item><c>key</c> is the name of the object to look up.
- </item>
- </list>
- <p>On success, the function returns the value associated with
- <c>key</c>.
- If the object is not found or if it is not an integer
- object, <c>-1</c> is returned. To avoid problems with in-band error
- reporting (that is, if you cannot distinguish between <c>-1</c> and a
- valid result), use the more general function
- <c>ei_reg_getval()</c> instead.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>const void *</ret><nametext>ei_reg_getpval(reg,key,size)</nametext></name>
- <fsummary>Get a binary object.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- <v>int size;</v>
- </type>
- <desc>
- <p>Gets the value associated with <c>key</c> in the
- registry. The value must be a binary (pointer) type.</p>
- <list type="bulleted">
- <item><c>reg</c> is the registry where the object will be
- looked up.</item>
- <item><c>key</c> is the name of the object to look up.
- </item>
- <item><c>size</c> is initialized to contain the length in
- bytes of the object, if it is found.</item>
- </list>
- <p>On success, the function returns the value associated with
- <c>key</c> and indicates its length in
- <c>size</c>.
- If the object is not found or if it is not a binary object,
- <c>NULL</c> is returned. To avoid problems with in-band error
- reporting (that is, if you cannot distinguish between <c>NULL</c> and
- a valid result), use the more general function
- <c>ei_reg_getval()</c> instead.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>const char *</ret><nametext>ei_reg_getsval(reg,key)</nametext></name>
- <fsummary>Get a string object.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- </type>
- <desc>
- <p>Gets the value associated with <c>key</c> in the
- registry. The value must be a string.</p>
- <list type="bulleted">
- <item><c>reg</c> is the registry where the object will be
- looked up.</item>
- <item><c>key</c> is the name of the object to look up.
- </item>
- </list>
- <p>On success, the function returns the value associated with
- <c>key</c>. If the object is not found or if it is not a
- string, <c>NULL</c> is returned. To avoid problems with in-band error
- reporting (that is, if you cannot distinguish between <c>NULL</c> and
- a valid result), use the more general function
- <c>ei_reg_getval()</c> instead.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_getval(reg,key,flags,v,...)</nametext></name>
- <fsummary>Get any object.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- <v>int flags;</v>
- <v>void *v (see below)</v>
- </type>
- <desc>
- <p>A general function for retrieving any kind of
- object from the registry.</p>
- <list type="bulleted">
- <item>
- <p><c>reg</c> is the registry where the object will be
- looked up.</p>
- </item>
- <item>
- <p><c>key</c> is the name of the object to look up.</p>
- </item>
- <item>
- <p><c>flags</c> indicates the type of object that you
- are looking for. If <c>flags</c> is <c>0</c>, any
- kind of object is returned.
- If <c>flags</c> is <c>EI_INT</c>, <c>EI_FLT</c>,
- <c>EI_STR</c>, or <c>EI_BIN</c>, then only values of
- that kind are returned.</p>
- <p>The buffer pointed to by <c>v</c>
- must be large enough to hold the return data, that is, it must be
- a pointer to one of <c>int</c>,
- <c>double</c>, <c>char*</c>, or
- <c>void*</c>, respectively.</p>
- <p>If <c>flags</c> is <c>EI_BIN</c>, a fifth argument
- <c>int *size</c> is required, so that the size of the
- object can be returned.</p>
- </item>
- </list>
- <p>On success, <c>v</c> (and <c>size</c> if the
- object is binary) is initialized with the value associated
- with <c>key</c>, and the function returns <c>EI_INT</c>,
- <c>EI_FLT</c>, <c>EI_STR</c>, or <c>EI_BIN</c>, indicating the type
- of object. On failure, <c>-1</c> is returned and the
- arguments are not updated.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_markdirty(reg,key)</nametext></name>
- <fsummary>Mark an object as dirty.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- </type>
- <desc>
- <p>Marks a registry object as dirty. This ensures that
- it is included in the next backup to <c>Mnesia</c>. Normally this
- operation is not necessary, as all of the normal registry
- 'set' functions do this automatically. However, if you have
- retrieved the value of a string or binary object from the
- registry and modified the contents, then the change is
- invisible to the registry and the object is assumed to be
- unmodified. This function allows you to make such modifications
- and then let the registry know about them.</p>
- <list type="bulleted">
- <item><c>reg</c> is the registry containing the object.
- </item>
- <item><c>key</c> is the name of the object to mark.
- </item>
- </list>
- <p>Returns <c>0</c> on success, otherwise <c>-1</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>ei_reg *</ret><nametext>ei_reg_open(size)</nametext></name>
- <fsummary>Create and open a registry.</fsummary>
- <type>
- <v>int size;</v>
- </type>
- <desc>
- <p>Opens (creates) a registry, which initially is empty. To
- close the registry later, use <c>ei_reg_close()</c>.</p>
- <p><c>size</c> is the approximate number of objects you
- intend to store in the registry. As the registry uses a hash table
- with collision chaining, no absolute upper limit exists on the
- number of objects that can be stored in it. However, for reasons
- of efficiency, it is a good idea to choose a number that is
- appropriate for your needs. To change the size later, use
- <c>ei_reg_resize()</c>. Notice that the number
- you provide is increased to the nearest larger prime number.</p>
- <p>Returns an empty registry on success, otherwise <c>NULL</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_purge(reg)</nametext></name>
- <fsummary>Remove deleted objects.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- </type>
- <desc>
- <p>Removes all objects marked for deletion. When objects
- are deleted with <c>ei_reg_delete()</c> they are not
- removed from the registry, only marked for later removal.
- On a later backup to <c>Mnesia</c>, the
- objects can also be removed from the <c>Mnesia</c> table. If you are
- not backing up to <c>Mnesia</c>, you may wish to remove the objects
- manually with this function.</p>
- <p><c>reg</c> is a registry containing objects marked for
- deletion.</p>
- <p>Returns <c>0</c> on success, otherwise <c>-1</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_resize(reg,newsize)</nametext></name>
- <fsummary>Resize a registry.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>int newsize;</v>
- </type>
- <desc>
- <p>Changes the size of a registry.</p>
- <p><c>newsize</c> is the new size to make the registry. The
- number is increased to the nearest larger prime number.</p>
- <p>On success, the registry is resized, all contents
- rehashed, and <c>0</c> is returned. On failure, the
- registry is left unchanged and <c>-1</c> is returned.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_restore(fd,reg,mntab)</nametext></name>
- <fsummary>Restore a registry from Mnesia.</fsummary>
- <type>
- <v>int fd;</v>
- <v>ei_reg *reg;</v>
- <v>const char *mntab;</v>
- </type>
- <desc>
- <p>The contents of a <c>Mnesia</c> table are read into the registry.</p>
- <list type="bulleted">
- <item><c>fd</c> is an open connection to Erlang.
- <c>Mnesia</c> 3.0 or later must be running on the Erlang node.
- </item>
- <item><c>reg</c> is the registry where the data is to be
- placed.</item>
- <item><c>mntab</c> is the name of the <c>Mnesia</c> table
- to read data from.</item>
- </list>
- <p>Notice that only tables of a certain format can be
- restored, that is, those that have been created and backed up to
- with <c>ei_reg_dump()</c>. If the registry was not empty
- before the operation, the contents of the table are added to the
- contents of the registry. If the table contains objects with the
- same keys as those already in the registry, the registry objects
- are overwritten with the new values. If the registry
- contains objects that were not in the table, they are
- unchanged by this operation.</p>
- <p>After the restore operation, the entire contents of the
- registry is marked as unmodified. Notice that this includes any
- objects that were modified before the restore and not
- overwritten by the restore.</p>
- <p>Returns <c>0</c> on success, otherwise <c>-1</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_setfval(reg,key,f)</nametext></name>
- <fsummary>Assign a floating point object.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- <v>double f;</v>
- </type>
- <desc>
- <p>Creates a key-value pair with the specified <c>key</c>
- and floating point value <c>f</c>. If an object already
- exists with the same <c>key</c>, the new value replaces
- the old one. If the previous value was a binary or string, it is
- freed with <c>free()</c>.</p>
- <list type="bulleted">
- <item><c>reg</c> is the registry where the object is to be
- placed.</item>
- <item><c>key</c> is the object name.</item>
- <item><c>f</c> is the floating point value to assign.
- </item>
- </list>
- <p>Returns <c>0</c> on success, otherwise <c>-1</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_setival(reg,key,i)</nametext></name>
- <fsummary>Assign an integer object.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- <v>int i;</v>
- </type>
- <desc>
- <p>Creates a key-value pair with the specified <c>key</c>
- and integer value <c>i</c>. If an object already exists
- with the same <c>key</c>, the new value replaces the old
- one. If the previous value was a binary or string, it is freed with
- <c>free()</c>.</p>
- <list type="bulleted">
- <item><c>reg</c> is the registry where the object is to be
- placed.</item>
- <item><c>key</c> is the object name.</item>
- <item><c>i</c> is the integer value to assign.</item>
- </list>
- <p>Returns <c>0</c> on success, otherwise <c>-1</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_setpval(reg,key,p,size)</nametext></name>
- <fsummary>Assign a binary object.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- <v>const void *p;</v>
- <v>int size;</v>
- </type>
- <desc>
- <p>Creates a key-value pair with the specified <c>key</c>
- whose "value" is the binary object pointed to by <c>p</c>.
- If an object already exists with the same <c>key</c>,
- the new value replaces the old one. If the previous value was a
- binary or string, it is freed with <c>free()</c>.</p>
- <list type="bulleted">
- <item><c>reg</c> is the registry where the object is to be
- placed.</item>
- <item><c>key</c> is the object name.</item>
- <item><c>p</c> is a pointer to the binary object. The
- object itself must have been created through a single call to
- <c>malloc()</c> or a similar function, so that the
- registry can later delete it if necessary by calling
- <c>free()</c>.</item>
- <item><c>size</c> is the length in bytes of the binary
- object.</item>
- </list>
- <p>Returns <c>0</c> on success, otherwise <c>-1</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_setsval(reg,key,s)</nametext></name>
- <fsummary>Assign a string object.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- <v>const char *s;</v>
- </type>
- <desc>
- <p>Creates a key-value pair with the specified <c>key</c>
- whose "value" is the specified string <c>s</c>. If an
- object already exists with the same <c>key</c>, the new
- value replaces the old one. If the previous value was a binary or
- string, it is freed with <c>free()</c>.</p>
- <list type="bulleted">
- <item><c>reg</c> is the registry where the object is to be
- placed.</item>
- <item><c>key</c> is the object name.</item>
- <item><c>s</c> is the string to assign. The string itself
- must have been created through a single call to
- <c>malloc()</c> or similar a function,
- so that the registry can later delete it if
- necessary by calling <c>free()</c>.</item>
- </list>
- <p>Returns <c>0</c> on success, otherwise <c>-1</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_setval(reg,key,flags,v,...)</nametext></name>
- <fsummary>Assign a value to any object type.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- <v>int flags;</v>
- <v>v (see below)</v>
- </type>
- <desc>
- <p>Creates a key-value pair with the specified <c>key</c>
- whose value is specified by <c>v</c>. If an object already
- exists with the same <c>key</c>, the new value replaces
- the old one. If the previous value was a binary or string, it is freed
- with <c>free()</c>.</p>
- <list type="bulleted">
- <item>
- <p><c>reg</c> is the registry where the object is to be
- placed.</p>
- </item>
- <item>
- <p><c>key</c> is the object name.</p>
- </item>
- <item>
- <p><c>flags</c> indicates the type of the object
- specified by <c>v</c>. Flags must be one of
- <c>EI_INT</c>, <c>EI_FLT</c>, <c>EI_STR</c>, and <c>EI_BIN</c>,
- indicating whether
- <c>v</c> is <c>int</c>,
- <c>double</c>, <c>char*</c>, or
- <c>void*</c>.</p>
- <p>If <c>flags</c> is <c>EI_BIN</c>, a fifth argument
- <c>size</c> is required, indicating the size
- in bytes of the object pointed to by <c>v</c>.</p>
- </item>
- </list>
- <p>If you wish to store an arbitrary pointer in the registry,
- specify a <c>size</c> of <c>0</c>. In this case, the
- object itself is not transferred by an
- <c>ei_reg_dump()</c> operation, only the pointer
- value.</p>
- <p>Returns <c>0</c> on success, otherwise <c>-1</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_stat(reg,key,obuf)</nametext></name>
- <fsummary>Get object information.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>const char *key;</v>
- <v>struct ei_reg_stat *obuf;</v>
- </type>
- <desc>
- <p>Returns information about an object.</p>
- <list type="bulleted">
- <item><c>reg</c> is the registry containing the object.
- </item>
- <item><c>key</c> is the object name.</item>
- <item><c>obuf</c> is a pointer to an
- <c>ei_reg_stat</c> structure, defined as follows:</item>
- </list>
- <code type="none"><![CDATA[
-struct ei_reg_stat {
- int attr;
- int size;
-};
- ]]></code>
- <p>In <c>attr</c> the attributes of the object are stored
- as the logical <em>OR</em> of its type (one of <c>EI_INT</c>,
- <c>EI_FLT</c>, <c>EI_BIN</c>, and <c>EI_STR</c>),
- whether it is marked for deletion (<c>EI_DELET</c>), and whether it
- has been modified since the last backup to <c>Mnesia</c>
- (<c>EI_DIRTY</c>).</p>
- <p>Field <c>size</c> indicates the size in bytes required
- to store <c>EI_STR</c> (including the terminating <c>0</c>) and
- <c>EI_BIN</c> objects, or <c>0</c> for <c>EI_INT</c> and
- <c>EI_FLT</c>.</p>
- <p>Returns <c>0</c> and initializes <c>obuf</c> on success,
- otherwise <c>-1</c>.</p>
- </desc>
- </func>
-
- <func>
- <name since=""><ret>int</ret><nametext>ei_reg_tabstat(reg,obuf)</nametext></name>
- <fsummary>Get registry information.</fsummary>
- <type>
- <v>ei_reg *reg;</v>
- <v>struct ei_reg_tabstat *obuf;</v>
- </type>
- <desc>
- <p>Returns information about a registry. Using information
- returned by this function, you can see whether the size of the
- registry is suitable for the amount of data it contains.</p>
- <list type="bulleted">
- <item><c>reg</c> is the registry to return information
- about.</item>
- <item><c>obuf</c> is a pointer to an
- <c>ei_reg_tabstat</c> structure, defined as follows:
- </item>
- </list>
- <code type="none"><![CDATA[
-struct ei_reg_tabstat {
- int size;
- int nelem;
- int npos;
- int collisions;
-};
- ]]></code>
- <p>Field <c>size</c> indicates the number of hash positions
- in the registry. This is the number you provided when you
- created or last resized the registry, rounded up to the nearest
- prime number.</p>
- <list type="bulleted">
- <item><c>nelem</c> indicates the number of elements stored
- in the registry. It includes objects that are deleted but not
- purged.</item>
- <item><c>npos</c> indicates the number of unique positions
- that are occupied in the registry.</item>
- <item><c>collisions</c> indicates how many elements are
- sharing positions in the registry.</item>
- </list>
- <p>On success, <c>0</c> is returned and
- <c>obuf</c> is initialized to contain table statistics,
- otherwise <c>-1</c> is returned.</p>
- </desc>
- </func>
- </funcs>
-</cref>
diff --git a/lib/erl_interface/include/ei.h b/lib/erl_interface/include/ei.h
index f3a1926c36..f1b6112960 100644
--- a/lib/erl_interface/include/ei.h
+++ b/lib/erl_interface/include/ei.h
@@ -616,186 +616,12 @@ int ei_cmp_refs(erlang_ref *a, erlang_ref *b);
int ei_cmp_pids(erlang_pid *a, erlang_pid *b);
int ei_cmp_ports(erlang_port *a, erlang_port *b);
-/***************************************************************************
- *
- * Hash types needed by registry types
- *
- ***************************************************************************/
-
-#define EI_SMALLKEY 32
-
-typedef struct bucket_s {
- int rawhash;
- const char *key;
- char keybuf[EI_SMALLKEY];
- const void *value;
- struct bucket_s *next;
-} ei_bucket;
-
-/* users of the package declare variables as pointers to this. */
-typedef struct {
- ei_bucket **tab;
- int (*hash)(const char *); /* hash function for this table */
- int size; /* size of table */
- int nelem; /* nr elements */
- int npos; /* nr occupied positions */
- ei_bucket *freelist; /* reuseable freed buckets */
-} ei_hash;
-
-
-/***************************************************************************
- *
- * Registry defines, types, functions
- *
- ***************************************************************************/
-
-/* -------------------------------------------------------------------- */
-/* XXXXXXXXXXX */
-/* -------------------------------------------------------------------- */
-
-/* registry object attributes */
-#define EI_DIRTY 0x01 /* dirty bit (object value differs from backup) */
-#define EI_DELET 0x02 /* object is deleted */
-#define EI_INT 0x10 /* object is an integer */
-#define EI_FLT 0x20 /* object is a float */
-#define EI_STR 0x40 /* object is a string */
-#define EI_BIN 0x80 /* object is a binary, i.e. pointer to arbitrary type */
-
-
/* -------------------------------------------------------------------- */
-/* XXXXXXXXXXX */
+/* Initialize erl_interface */
/* -------------------------------------------------------------------- */
-typedef struct ei_reg_inode {
- int attr;
- int size;
- union {
- long i;
- double f;
- char *s;
- void *p;
- } val;
- struct ei_reg_inode *next;
-} ei_reg_obj;
-
-typedef struct {
- ei_reg_obj *freelist;
- ei_hash *tab;
-} ei_reg;
-
-struct ei_reg_stat {
- int attr; /* object attributes (see above) */
- int size; /* size in bytes (for STR and BIN) 0 for others */
-};
-
-struct ei_reg_tabstat {
- int size; /* size of table */
- int nelem; /* number of stored elements */
- int npos; /* number of occupied positions */
- int collisions; /* number of positions with more than one element */
-};
-
-
int ei_init(void);
-/* -------------------------------------------------------------------- */
-/* XXXXXXXXXXX */
-/* -------------------------------------------------------------------- */
-
-/* FIXME move comments to source */
-
-/* open / close registry. On open, a descriptor is returned that must
- * be specified in all subsequent calls to registry functions. You can
- * open as many registries as you like.
- */
-ei_reg *ei_reg_open(int size) EI_DEPRECATED_ATTR;
-int ei_reg_resize(ei_reg *oldreg, int newsize) EI_DEPRECATED_ATTR;
-int ei_reg_close(ei_reg *reg) EI_DEPRECATED_ATTR;
-
-/* set values... these routines assign values to keys. If the key
- * exists, the previous value is discarded and the new one replaces
- * it.
- *
- * BIN objects require an additional argument indicating the size in
- * bytes of the stored object. This will be used when the object is
- * backed up, since it will need to be copied at that time. Remember
- * also that pointers are process-space specific and it is not
- * meaningful to back them up for later recall. If you are storing
- * binary objects for backup, make sure that they are self-contained
- * (without references to other objects).
- *
- * On success the function returns 0, otherwise a value
- * indicating the reason for failure will be returned.
- */
-int ei_reg_setival(ei_reg *reg, const char *key, long i) EI_DEPRECATED_ATTR;
-int ei_reg_setfval(ei_reg *reg, const char *key, double f) EI_DEPRECATED_ATTR;
-int ei_reg_setsval(ei_reg *reg, const char *key, const char *s) EI_DEPRECATED_ATTR;
-int ei_reg_setpval(ei_reg *reg, const char *key, const void *p, int size) EI_DEPRECATED_ATTR;
-
-/* general set function (specifiy type via flags)
- * optional arguments are as for equivalent type-specific function,
- * i.e.:
- * ei_reg_setval(fd, path, EI_INT, int i);
- * ei_reg_setval(fd, path, EI_FLT, float f);
- * ei_reg_setval(fd, path, EI_STR, const char *s);
- * ei_reg_setval(fd, path, EI_BIN, const void *p, int size);
- */
-int ei_reg_setval(ei_reg *reg, const char *key, int flags, ...) EI_DEPRECATED_ATTR;
-
-/* get value of specific type object */
-/* warning: it may be difficult to detect errors when using these
- * functions, since the error values are returned "in band"
- */
-long ei_reg_getival(ei_reg *reg, const char *key) EI_DEPRECATED_ATTR;
-double ei_reg_getfval(ei_reg *reg, const char *key) EI_DEPRECATED_ATTR;
-const char *ei_reg_getsval(ei_reg *reg, const char *key) EI_DEPRECATED_ATTR;
-const void *ei_reg_getpval(ei_reg *reg, const char *key, int *size) EI_DEPRECATED_ATTR;
-
-/* get value of any type object (must specify)
- * Retrieve a value from an object. The type of value expected and a
- * pointer to a large enough buffer must be provided. flags must be
- * set to the appropriate type (see type constants above) and the
- * object type must match. If (flags == 0) the pointer is *assumed* to
- * be of the correct type for the object. In any case, the actual
- * object type is always returned on success.
- *
- * The argument following flags must be one of int*, double*, const
- * char** and const void**.
- *
- * for BIN objects an int* is needed to return the size of the object, i.e.
- * int ei_reg_getval(ei_reg *reg, const char *path, int flags, void **p, int *size);
- */
-int ei_reg_getval(ei_reg *reg, const char *key, int flags, ...) EI_DEPRECATED_ATTR;
-
-/* mark the object as dirty. Normally this operation will not be
- * necessary, as it is done automatically by all of the above 'set'
- * functions. However, if you modify the contents of an object pointed
- * to by a STR or BIN object, then the registry will not be aware of
- * the change. As a result, the object may be missed on a subsequent
- * backup operation. Use this function to set the dirty bit on the
- * object.
- */
-int ei_reg_markdirty(ei_reg *reg, const char *key) EI_DEPRECATED_ATTR;
-
-/* remove objects. The value, if any, is discarded. For STR and BIN
- * objects, the object itself is removed using free(). */
-int ei_reg_delete(ei_reg *reg, const char *key) EI_DEPRECATED_ATTR;
-
-/* get information about an object */
-int ei_reg_stat(ei_reg *reg, const char *key, struct ei_reg_stat *obuf) EI_DEPRECATED_ATTR;
-
-/* get information about table */
-int ei_reg_tabstat(ei_reg *reg, struct ei_reg_tabstat *obuf) EI_DEPRECATED_ATTR;
-
-/* dump to / restore from backup */
-/* fd is open descriptor to Erlang, mntab is Mnesia table name */
-/* flags here: */
-#define EI_FORCE 0x1 /* dump all records (not just dirty ones) */
-#define EI_NOPURGE 0x2 /* don't purge deleted records */
-int ei_reg_dump(int fd, ei_reg *reg, const char *mntab, int flags) EI_DEPRECATED_ATTR;
-int ei_reg_restore(int fd, ei_reg *reg, const char *mntab) EI_DEPRECATED_ATTR;
-int ei_reg_purge(ei_reg *reg) EI_DEPRECATED_ATTR;
-
/* -------------------------------------------------------------------- */
/* The ei_global functions */
/* -------------------------------------------------------------------- */
diff --git a/lib/erl_interface/src/Makefile.in b/lib/erl_interface/src/Makefile.in
index de82f4ad51..061fd05a1d 100644
--- a/lib/erl_interface/src/Makefile.in
+++ b/lib/erl_interface/src/Makefile.in
@@ -96,7 +96,7 @@ AR_FLAGS=rcv
endif
INCFLAGS = -I. -I../include -Iconnect -Iencode -Idecode -Imisc -Iepmd \
- -Iregistry -I$(TARGET)
+ -I$(TARGET)
ifeq ($(USING_VC),yes)
WARNFLAGS = -Wall
@@ -133,7 +133,7 @@ BINDIR = $(ERL_TOP)/lib/erl_interface/bin/$(TARGET)
# -Wno-char-subscripts
# -Wshadow
-vpath %.c connect:encode:decode:misc:epmd:global:registry
+vpath %.c connect:encode:decode:misc:epmd:global
###########################################################################
# List targets
@@ -289,7 +289,6 @@ EISOURCES = \
$(ENCODESRC) \
$(EPMDSRC) \
$(MISCSRC) \
- $(REGISTRYSRC) \
$(GLOBALSOURCES)
CONNECTSRC = \
@@ -376,40 +375,6 @@ MISCSRC = \
misc/ei_init.c \
misc/ei_cmp_nc.c
-REGISTRYSRC = \
- registry/hash_dohash.c \
- registry/hash_foreach.c \
- registry/hash_freetab.c \
- registry/hash_insert.c \
- registry/hash_isprime.c \
- registry/hash_lookup.c \
- registry/hash_newtab.c \
- registry/hash_remove.c \
- registry/hash_resize.c \
- registry/hash_rlookup.c \
- registry/reg_close.c \
- registry/reg_delete.c \
- registry/reg_dirty.c \
- registry/reg_dump.c \
- registry/reg_free.c \
- registry/reg_get.c \
- registry/reg_getf.c \
- registry/reg_geti.c \
- registry/reg_getp.c \
- registry/reg_gets.c \
- registry/reg_make.c \
- registry/reg_open.c \
- registry/reg_purge.c \
- registry/reg_resize.c \
- registry/reg_restore.c \
- registry/reg_set.c \
- registry/reg_setf.c \
- registry/reg_seti.c \
- registry/reg_setp.c \
- registry/reg_sets.c \
- registry/reg_stat.c \
- registry/reg_tabstat.c
-
GLOBALSOURCES = \
global/global_names.c \
global/global_register.c \
@@ -716,7 +681,6 @@ release: opt
$(INSTALL_DIR) "$(RELSYSDIR)/src/global"
$(INSTALL_DIR) "$(RELSYSDIR)/src/misc"
$(INSTALL_DIR) "$(RELSYSDIR)/src/prog"
- $(INSTALL_DIR) "$(RELSYSDIR)/src/registry"
$(INSTALL_DIR) "$(RELEASE_PATH)/usr/include"
$(INSTALL_DIR) "$(RELEASE_PATH)/usr/lib"
$(INSTALL_DATA) $(APP_TARGET) "$(RELSYSDIR)/ebin/$(APP_FILE)"
@@ -732,7 +696,6 @@ release: opt
$(INSTALL_DATA) encode/*.[ch] "$(RELSYSDIR)/src/encode"
$(INSTALL_DATA) epmd/*.[ch] "$(RELSYSDIR)/src/epmd"
$(INSTALL_DATA) misc/*.[ch] "$(RELSYSDIR)/src/misc"
- $(INSTALL_DATA) registry/*.[ch] "$(RELSYSDIR)/src/registry"
$(INSTALL_DATA) global/*.[ch] "$(RELSYSDIR)/src/global"
$(INSTALL_DATA) prog/*.[ch] "$(RELSYSDIR)/src/prog"
diff --git a/lib/erl_interface/src/README.internal b/lib/erl_interface/src/README.internal
index 42c45b46a9..51be1159d3 100644
--- a/lib/erl_interface/src/README.internal
+++ b/lib/erl_interface/src/README.internal
@@ -60,10 +60,6 @@ From time to time do a
Handle communication with epmd
- * src/registry/
-
- Key/value database with optional mnesia back up
-
* src/misc/
The rest of the library
@@ -140,9 +136,6 @@ The base for the config.h.in file was created with 'autoheader'.
Writing source
******************************************************************************
-C files in "registry" are considered users of 'ei' and should not
-include "eidef.h" or "config.h", only "ei.h".
-
C files in "prog" could include "config.h" directly.
Other C files should include "eidef.h" as the first line of
diff --git a/lib/erl_interface/src/registry/hash.h b/lib/erl_interface/src/registry/hash.h
deleted file mode 100644
index 7fcaced319..0000000000
--- a/lib/erl_interface/src/registry/hash.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#ifndef _HASH_H
-#define _HASH_H
-
-#include <stdio.h>
-
-#include "ei.h" /* We need our types there */
-
-#define ei_hash_size(tab) ((tab)->size)
-#define ei_hash_count(tab) ((tab)->count)
-
-#define ALIGN_QUAD 0x7
-#define ei_align(size) while (((unsigned)size) & ALIGN_QUAD) (size)++
-
-int ei_isprime(int n);
-int ei_dohash(const char *key);
-void *ei_hash_lookup(ei_hash *tab, const char *key);
-const char *ei_hash_rlookup(ei_hash *tab, const void *value);
-int ei_hash_foreach(ei_hash *tab, int (*f)(const char *key, const void *value));
-void *ei_hash_insert(ei_hash *tab, const char *key, const void *value);
-void *ei_hash_remove(ei_hash *tab, const char *key);
-ei_hash *ei_hash_newtab(int tabsize);
-ei_hash *ei_hash_resize(ei_hash *oldtab, int newsize);
-int ei_hash_freetab(ei_hash *tab, void (*f)(void *));
-void ei_hash_stats(ei_hash *tab, FILE *out);
-void ei_hash_bfree(ei_hash *tab, ei_bucket *b);
-
-#endif /* _HASH_H */
diff --git a/lib/erl_interface/src/registry/hash_dohash.c b/lib/erl_interface/src/registry/hash_dohash.c
deleted file mode 100644
index 6f859cef2e..0000000000
--- a/lib/erl_interface/src/registry/hash_dohash.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include "hash.h"
-
-/* This is hashpjw, from the dragon book */
-/* Note that this function is only used as a default hash function.
- * All calls are made through the hash pointer in the tab structure.
- * The only place this function is explicitly referenced is in
- * hash_newtab(); Users can use hash_setfunc() to change the hash function.
- */
-int ei_dohash(const char *key)
-{
- const char *s;
- unsigned h = 0;
- unsigned g;
-
- for (s=key; *s; s++) {
- h = (h << 4) + *s;
- if ((g = (h & 0xf0000000))) { /* assumes 32-bit int */
- h = h^(g >> 24);
- h = h^g;
- }
- }
- return h;
-}
-
-
diff --git a/lib/erl_interface/src/registry/hash_foreach.c b/lib/erl_interface/src/registry/hash_foreach.c
deleted file mode 100644
index b58df27e8e..0000000000
--- a/lib/erl_interface/src/registry/hash_foreach.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include "hash.h"
-
-/* perform f(key,value) on each key-value pair in the table.
- * hash_foreach() will traverse the table until the end is reached or
- * until f() returns a non-zero value, whichever comes first. The
- * return value from f() will be returned to the caller, or 0 if the
- * entire table was traversed.
- */
-int ei_hash_foreach(ei_hash *tab, int (*f)(const char *key, const void *value))
-{
- ei_bucket *b;
- int i;
- int r;
-
- for (i=0; i<tab->size; i++) {
- b=tab->tab[i];
- while (b) {
- if (f && (r=f(b->key,b->value))) return r;
- b = b->next;
- }
- }
- return 0;
-}
-
diff --git a/lib/erl_interface/src/registry/hash_freetab.c b/lib/erl_interface/src/registry/hash_freetab.c
deleted file mode 100644
index 0a2c0dcfe6..0000000000
--- a/lib/erl_interface/src/registry/hash_freetab.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "hash.h"
-
-/* remove all the key-values from a table. The
- * values are removed with
- * the user-provided function f.
- */
-int ei_hash_freetab(ei_hash *tab, void (*f)(void *))
-{
- ei_bucket *b, *next;
- int i;
-
- for (i=0; i<tab->size; i++) {
- b=tab->tab[i];
- while (b) {
- next = b->next;
-
- if (f) f((void *)b->value);
-
- /* no point in saving these buckets on freelist */
- free(b);
- b = next;
- }
- }
-
- /* remove the freelist */
- b = tab->freelist;
- while (b) {
- next = b->next;
- free(b);
- b = next;
- }
-
- /* remove the table */
- free(tab);
-
- return 0;
-}
diff --git a/lib/erl_interface/src/registry/hash_insert.c b/lib/erl_interface/src/registry/hash_insert.c
deleted file mode 100644
index 0002cb64df..0000000000
--- a/lib/erl_interface/src/registry/hash_insert.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include <string.h>
-#include "hash.h"
-
-/* this function returns a bucket - from the freelist if one was found
- * there, or from malloc(). Only "small" buckets, i.e. those whose
- * keys are short enough to be stored in the bucket itself, are saved
- * on the freelist.
- */
-static ei_bucket *ei_hash_bmalloc(ei_hash *tab)
-{
- ei_bucket *new;
-
- if (tab->freelist) {
- new = tab->freelist;
- tab->freelist = new->next;
- /* fprintf(stderr,"getting bucket from freelist\n"); */
- }
- else {
- new = malloc(sizeof(*new));
- /* fprintf(stderr,"allocating new (small) bucket\n"); */
- }
-
- return new;
-}
-
-/* insert a new key-value pair. The old value (if any) is returned. If
- * the malloc fails the function returns NULL. This is potentially a
- * problem since the function returns the same thing when malloc fails
- * as when a item is inserted that did not previously exist in the
- * table. */
-void *ei_hash_insert(ei_hash *tab, const char *key, const void *value)
-{
- const void *oldval=NULL;
- ei_bucket *b=NULL;
- int h, rh;
-
- rh = tab->hash(key);
- h = rh % tab->size;
-
- b=tab->tab[h];
- while (b) {
- if ((rh == b->rawhash) && (!strcmp(key,b->key)))
- break;
- b=b->next;
- }
-
- if (b) {
- /* replace existing value, return old value */
- oldval = b->value;
- b->value = value;
- }
- else {
- int keylen = strlen(key);
-
- /* this element is new */
- if (keylen < EI_SMALLKEY) {
- /* short keys stored directly in bucket */
- /* try to get bucket from freelist */
- if ((b = ei_hash_bmalloc(tab)) == NULL) return NULL;
- b->key = b->keybuf;
- }
- else {
- /* for longer keys we allocate space */
- int keypos=sizeof(*b);
-
- ei_align(keypos);
- if ((b = malloc(keypos+keylen+1)) == NULL) return NULL;
- b->key = (char *)b + keypos;
- /* fprintf(stderr,"allocating new (large) bucket\n"); */
- }
-
- /* fill in the blanks */
- b->rawhash = rh;
- strcpy((char *)b->key,key);
- b->value = value;
-
- /* some statistiscs */
- if (!tab->tab[h]) tab->npos++;
- tab->nelem++;
-
- /* link in the new element */
- b->next = tab->tab[h];
- tab->tab[h] = b;
- }
- return (void *)oldval;
-}
-
diff --git a/lib/erl_interface/src/registry/hash_isprime.c b/lib/erl_interface/src/registry/hash_isprime.c
deleted file mode 100644
index 58166c6957..0000000000
--- a/lib/erl_interface/src/registry/hash_isprime.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include "hash.h"
-
-/* this is a general prime factoring function
- * we get one prime factor each time we call it
- * we only use it here to determine if n is prime,
- * by checking if factor(n) == n .
- */
-static int factor(int n)
-{
- /* FIXME problem for threaded?! */
- static int a[] = { 0, 4, 1, 2, 0, 2 };
- static int m = 0;
- static int d = 0;
-
- if (n) {
- m = n;
- d = 2;
- }
-
- while ((d*d) <= m) {
- if (!(m%d)) {
- m /= d;
- return d;
- }
- d += a[d%6];
- }
- n = m;
- m = 0;
-
- return n;
-}
-
-/* true if n prime */
-int ei_isprime(int n)
-{
- return (n == factor(n));
-}
diff --git a/lib/erl_interface/src/registry/hash_lookup.c b/lib/erl_interface/src/registry/hash_lookup.c
deleted file mode 100644
index 31c30179df..0000000000
--- a/lib/erl_interface/src/registry/hash_lookup.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include <string.h>
-#include "hash.h"
-
-void *ei_hash_lookup(ei_hash *tab, const char *key)
-{
- int h, rh;
- ei_bucket *b=NULL;
-
- rh = tab->hash(key);
- h = rh % tab->size;
-
- b=tab->tab[h];
- while (b) {
- if ((rh == b->rawhash) && (!strcmp(key,b->key)))
- return (void *)b->value;
- b=b->next;
- }
- return NULL;
-}
-
-
diff --git a/lib/erl_interface/src/registry/hash_newtab.c b/lib/erl_interface/src/registry/hash_newtab.c
deleted file mode 100644
index 4baa5a7b41..0000000000
--- a/lib/erl_interface/src/registry/hash_newtab.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include <string.h>
-#include "hash.h"
-
-ei_hash *ei_hash_newtab(int tabsize)
-{
- ei_hash *tab=NULL;
- int bucketpos=sizeof(*tab);
-
- /* make sure size is odd, then increase until prime */
- tabsize |= 0x1;
- while (!ei_isprime(tabsize)) tabsize +=2;
-
- /* we will only do one malloc, so "sizeof(*tab)"
- * must be adjusted to align tab->tab properly
- */
- ei_align(bucketpos);
-
- /* single malloc, then fill in all fields */
- if ((tab = malloc(bucketpos + (tabsize * (sizeof(*(tab->tab))))))) {
- tab->tab = (ei_bucket **)((char *)tab + bucketpos);
- memset(tab->tab,0,tabsize*sizeof(*(tab->tab)));
- tab->hash = ei_dohash;
- tab->size = tabsize;
- tab->npos = 0;
- tab->nelem = 0;
- tab->freelist = NULL;
- }
-
- return tab;
-}
-
diff --git a/lib/erl_interface/src/registry/hash_remove.c b/lib/erl_interface/src/registry/hash_remove.c
deleted file mode 100644
index 080f15889e..0000000000
--- a/lib/erl_interface/src/registry/hash_remove.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include <string.h>
-#include "hash.h"
-
-/* free a hash bucket. If the bucket contained a long key (more that
- * EI_SMALLKEY) the bucket is thrown away (really freed). If the
- * bucket contained a short key, then it can be saved on the freelist
- * for later use. Buckets with short keys have (key == keybuf).
- */
-void ei_hash_bfree(ei_hash *tab, ei_bucket *b)
-{
- if (!b) return;
-
- /* we throw away buckets with long keys (i.e. non-standard buckets) */
- if (b->key != b->keybuf) {
- /* fprintf(stderr,"freeing bucket with long key (%s)\n",b->key); */
- free(b);
- }
-
- else {
- /* others we save on (tab-local) freelist */
- /* fprintf(stderr,"saving bucket with short key (%s)\n",b->key); */
- b->next = tab->freelist;
- tab->freelist = b;
- }
-
- return;
-}
-
-void *ei_hash_remove(ei_hash *tab, const char *key)
-{
- ei_bucket *b=NULL, *tmp=NULL;
- const void *oldval=NULL;
- int h, rh;
-
- rh = tab->hash(key);
- h = rh % tab->size;
-
- /* is it in the first position? */
- if ((b=tab->tab[h])) {
- if ((rh == b->rawhash) && (!strcmp(key,b->key))) {
- tab->tab[h] = b->next;
- oldval = b->value;
- ei_hash_bfree(tab,b);
-
- tab->nelem--;
- if (!tab->tab[h]) tab->npos--;
- }
- else {
- /* is it later in the chain? */
- while (b->next) {
- if ((rh == b->next->rawhash) && (!strcmp(key,b->next->key))) {
- tmp = b->next;
- b->next = tmp->next;
- oldval = tmp->value;
- ei_hash_bfree(tab,tmp);
-
- tab->nelem--;
- break;
- }
- b=b->next;
- }
- }
- }
- return (void *)oldval;
-}
-
diff --git a/lib/erl_interface/src/registry/hash_resize.c b/lib/erl_interface/src/registry/hash_resize.c
deleted file mode 100644
index 031d8bfbf6..0000000000
--- a/lib/erl_interface/src/registry/hash_resize.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "hash.h"
-
-/* move the elements from oldtab to a new table newsize. The old table
- * is freed and the caller should discard the pointer. On failure
- * (i.e. if malloc fails) return the old table and do nothing.
-*/
-ei_hash *ei_hash_resize(ei_hash *oldtab, int newsize)
-{
- ei_hash *newtab=NULL;
- ei_bucket *b, *next;
- int i,h;
-
- /* make sure size is odd, then increase until prime */
- newsize |= 0x1;
- while (!ei_isprime(newsize)) newsize +=2;
-
- if (newsize == oldtab->size) return oldtab;
-
- /* make a new table */
- if (!(newtab = ei_hash_newtab(newsize))) return oldtab;
- newtab->hash = oldtab->hash;
-
- /* move the buckets, rehashing */
- /* note that this will reverse the order of any chains */
- for (i=0; i<oldtab->size; i++) {
- b=oldtab->tab[i];
- while (b) {
- next = b->next;
- h = b->rawhash % newtab->size;
- b->next=newtab->tab[h];
- if (!newtab->tab[h]) newtab->npos++;
- newtab->tab[h]=b;
- b = next;
- }
- }
- /* the new table has the same number of elements as the old one */
- newtab->nelem = oldtab->nelem;
-
- /* the new table takes over the freelist from the old one */
- newtab->freelist = oldtab->freelist;
-
- /* now it's safe to remove the old table */
- free(oldtab);
-
- return newtab;
-}
diff --git a/lib/erl_interface/src/registry/hash_rlookup.c b/lib/erl_interface/src/registry/hash_rlookup.c
deleted file mode 100644
index b0a948673a..0000000000
--- a/lib/erl_interface/src/registry/hash_rlookup.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "hash.h"
-
-/* this function does a reverse lookup and returns the first key whose
- * value matches value. This operation may be lengthy! Also, there is
- * no guarantee that the *values* are unique in the hash table, so the
- * returned key might not be the one you expect.
- */
-const char *ei_hash_rlookup(ei_hash *tab, const void *value)
-{
- ei_bucket *b;
- int i;
-
- for (i=0; i<tab->size; i++) {
- b=tab->tab[i];
- while (b) {
- if (b->value == value) return b->key;
- b = b->next;
- }
- }
- return NULL;
-}
-
diff --git a/lib/erl_interface/src/registry/reg.h b/lib/erl_interface/src/registry/reg.h
deleted file mode 100644
index 261e36ac06..0000000000
--- a/lib/erl_interface/src/registry/reg.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#ifndef _REG_H
-#define _REG_H
-
-#include "ei.h" /* Our public defines, types and declarations */
-#include "hash.h"
-
-#define EI_MNESIA_MODULE "mnesia_registry"
-
-#define EI_MNESIA_DUMP "start_dump"
-#define EI_MNESIA_WRITE "write"
-#define EI_MNESIA_DELETE "delete"
-#define EI_MNESIA_COMMIT "commit"
-
-#define EI_MNESIA_RESTORE "start_restore"
-#define EI_MNESIA_SEND "send_records"
-#define EI_MNESIA_RECV "restore"
-#define EI_MNESIA_SIZE "size"
-
-#define EI_REG_TYPEMASK 0xf8 /* all but lowest bits */
-#define ei_reg_typeof(r) (r->attr & EI_REG_TYPEMASK)
-
-ei_reg_obj *ei_reg_make(ei_reg *reg, int attr);
-
-void ei_reg_free(ei_reg *reg, ei_reg_obj *obj);
-
-#endif /* _REG_H */
diff --git a/lib/erl_interface/src/registry/reg_close.c b/lib/erl_interface/src/registry/reg_close.c
deleted file mode 100644
index c1475383e1..0000000000
--- a/lib/erl_interface/src/registry/reg_close.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "reg.h"
-
-/* really remove an object (help function to hash_freetab) */
-static void obj_free(void *p)
-{
- ei_reg_obj *obj = p;
-
- if (obj) {
- switch (ei_reg_typeof(obj)) {
- case EI_STR:
- free(obj->val.s);
- break;
-
- case EI_BIN:
- free(obj->val.p);
- break;
- }
-
- /* really remove the inode (don't use freelist here) */
- free(obj);
- }
- return;
-}
-
-/* close an open registry */
-int ei_reg_close(ei_reg *reg)
-{
- ei_reg_obj *obj, *next;
-
- if (!reg) return -1; /* return EI_BADARG; */
-
- /* remove hash_table */
- ei_hash_freetab(reg->tab,obj_free);
-
- /* remove freelist */
- obj = reg->freelist;
- while (obj) {
- next = obj->next;
- free(obj);
- obj = next;
- }
-
- /* remove registry */
- free(reg);
-
- return 0;
-}
diff --git a/lib/erl_interface/src/registry/reg_delete.c b/lib/erl_interface/src/registry/reg_delete.c
deleted file mode 100644
index 8882f611bc..0000000000
--- a/lib/erl_interface/src/registry/reg_delete.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include "reg.h"
-
-int ei_reg_delete(ei_reg *reg, const char *key)
-{
- ei_hash *tab;
- ei_reg_obj *obj;
-
- if (!key || !reg) return -1; /* return EI_BADARG; */
- tab = reg->tab;
- if (!(obj = ei_hash_lookup(tab,key))) return -1; /* return EI_NOTFOUND; */
-
- /* just mark the object deleted */
- obj->attr |= (EI_DELET | EI_DIRTY);
-
- return 0;
-}
diff --git a/lib/erl_interface/src/registry/reg_dirty.c b/lib/erl_interface/src/registry/reg_dirty.c
deleted file mode 100644
index 00f19482c2..0000000000
--- a/lib/erl_interface/src/registry/reg_dirty.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include "reg.h"
-
-int ei_reg_markdirty(ei_reg *reg, const char *key)
-{
- ei_hash *tab;
- ei_reg_obj *obj;
-
- if (!key || !reg) return -1; /* EI_BADARG; */
- tab = reg->tab;
- if (!(obj = ei_hash_lookup(tab,key))) return -1; /* return EI_NOTFOUND; */
-
- /* just mark the object dirty */
- obj->attr |= EI_DIRTY;
-
- return 0;
-}
diff --git a/lib/erl_interface/src/registry/reg_dump.c b/lib/erl_interface/src/registry/reg_dump.c
deleted file mode 100644
index f90fd4d4b6..0000000000
--- a/lib/erl_interface/src/registry/reg_dump.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2020. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include <string.h>
-#include "eidef.h"
-#include "eiext.h"
-#include "reg.h"
-#include "eisend.h"
-#include "eirecv.h"
-#include "ei_connect_int.h"
-
-static int mn_start_dump(int fd, const erlang_pid *self,
- erlang_pid *mnesia, const char *mntab)
-{
- char buf[EISMALLBUF];
- char *bufp = buf;
- char tmpbuf[64];
- int index = 0;
- erlang_msg msg;
- int type;
- int arity;
- int version;
- int msglen;
- int i;
- int needlink;
- int needpid;
-
- /* set up rpc arguments */
- /* { PidFrom, { call, Mod, Fun, Args, user }} */
- ei_encode_version(buf,&index);
- ei_encode_tuple_header(buf,&index,2);
- ei_encode_pid(buf,&index,self); /* PidFrom */
- ei_encode_tuple_header(buf,&index,5);
- ei_encode_atom(buf,&index,"call"); /* call */
- ei_encode_atom(buf,&index,EI_MNESIA_MODULE); /* Mod */
- ei_encode_atom(buf,&index,EI_MNESIA_DUMP); /* Fun */
- ei_encode_list_header(buf,&index,2); /* Args: [ table, self() ] */
- ei_encode_atom(buf,&index,mntab);
- ei_encode_pid(buf,&index,self);
- ei_encode_empty_list(buf,&index);
- ei_encode_atom(buf,&index,"user"); /* user */
-
- /* make the rpc call */
- if (ei_send_reg_encoded(fd,self,"rex",buf,index)) return -1;
-
- /* get the reply: expect link and pid (not sure which will come first though) */
- needlink = needpid = 1;
- while (needlink || needpid) {
- /* get message */
- while (1) {
- index = EISMALLBUF;
- if (!(i = ei_recv_internal(fd,&bufp,&index,&msg,&msglen,1,0))) continue;
- else break;
- }
-
- switch (i) {
- case ERL_LINK:
- /* got link */
- if (!needlink) return -1;
- needlink = 0;
- break;
-
- case ERL_SEND:
- /* got message - does it contain a pid? */
- if (!needpid) return -1;
- else {
- /* expecting { rex, <pid> } */
- index = 0;
- if (ei_decode_version(buf,&index,&version)
- || ei_decode_tuple_header(buf,&index,&arity)
- || (arity != 2)
- || ei_decode_atom(buf,&index,tmpbuf)
- || strcmp(tmpbuf,"rex")
- || ei_get_type(buf,&index,&type,&arity)
- || (type != ERL_PID_EXT))
- return -1; /* bad response from other side */
-
- if (ei_decode_pid(buf,&index,mnesia)) return -1;
-
- /* got pid */
- needpid = 0;
- }
- break;
-
- default:
- return -1; /* wasn't link or pid */
- }
- }
- return 0;
-}
-
-static int mn_send_commit(int fd, erlang_pid *mnesia, erlang_pid *self)
-{
- char buf[EISMALLBUF];
- char *bufp=buf;
- char string[256];
- int index = 0;
- int version,arity;
- int msglen;
- erlang_msg msg;
- int i;
-
- /* set up commit message { commit, self() } */
- ei_encode_version(buf,&index);
- ei_encode_tuple_header(buf,&index,2);
- ei_encode_atom(buf,&index,EI_MNESIA_COMMIT);
- ei_encode_pid(buf,&index,self);
-
- /* send it */
- if (ei_send_encoded(fd,mnesia,buf,index)) return -1;
-
- /* get reply */
- while (1) {
- index = EISMALLBUF;
- if (!(i=ei_recv_internal(fd,&bufp,&index,&msg,&msglen,1,0))) continue;
- else if (i < 0) return -1;
- else break;
- }
-
- if (i == ERL_SEND) {
- index = 0;
- if (ei_decode_version(buf,&index,&version)
- || ei_decode_tuple_header(buf,&index,&arity)
- || ei_decode_atom(buf,&index,string))
- return -1;
-
- if (!strcmp(string,"ok")) return 0;
- }
- /* wrong message type */
- return -1;
-}
-
-static int mn_send_delete(int fd, erlang_pid *mnesia, const char *key)
-{
- char sbuf[EISMALLBUF];
- char *dbuf = NULL;
- char *msgbuf;
- int index = 0;
- int len = strlen(key) + 32; /* 32 is a slight overestimate */
-
- if (len > EISMALLBUF)
- if (!(dbuf = malloc(len)))
- return -1;
- msgbuf = (dbuf ? dbuf : sbuf);
-
- /* set up delete message { delete, Key } */
- ei_encode_version(msgbuf,&index);
- ei_encode_tuple_header(msgbuf,&index,2);
- ei_encode_atom(msgbuf,&index,EI_MNESIA_DELETE);
- ei_encode_string(msgbuf,&index,key);
-
- /* send it */
- if (ei_send_encoded(fd,mnesia,msgbuf,index)) {
- if (dbuf) free(dbuf);
- return -1;
- }
-
- if (dbuf) free(dbuf);
- return 0;
-}
-
-static int mn_send_write(int fd, erlang_pid *mnesia, const char *key, ei_reg_obj *obj)
-{
- char sbuf[EISMALLBUF];
- char *dbuf = NULL;
- char *msgbuf;
- int index = 0;
- int keylen = strlen(key) + 1;
- int len = 32 + keylen + obj->size;
-
- if (len > EISMALLBUF)
- if (!(dbuf = malloc(len)))
- return -1;
- msgbuf = (dbuf ? dbuf : sbuf);
-
- ei_encode_version(msgbuf,&index);
- ei_encode_tuple_header(msgbuf,&index,6);
- ei_encode_atom(msgbuf,&index,EI_MNESIA_WRITE);
- ei_encode_string(msgbuf,&index,key);
- ei_encode_long(msgbuf,&index,keylen);
- ei_encode_long(msgbuf,&index,obj->attr);
- ei_encode_long(msgbuf,&index,obj->size);
-
- switch (ei_reg_typeof(obj)) {
- case EI_INT:
- ei_encode_long(msgbuf,&index,obj->val.i);
- break;
- case EI_FLT:
- ei_encode_double(msgbuf,&index,obj->val.f);
- break;
- case EI_STR:
- if (obj->size > 0) ei_encode_string(msgbuf,&index,obj->val.s);
- else ei_encode_long(msgbuf,&index, 0); /* just the NULL pointer */
- break;
- case EI_BIN:
- if (obj->size > 0) ei_encode_binary(msgbuf,&index,obj->val.p,obj->size);
- else ei_encode_long(msgbuf,&index, obj->val.i); /* just the pointer */
- break;
- default:
- if (dbuf) free(dbuf);
- return -1;
- }
-
- /* send it */
- if (ei_send_encoded(fd,mnesia,msgbuf,index)) {
- if (dbuf) free(dbuf);
- return -1;
- }
-
- if (dbuf) free(dbuf);
- return 0;
-}
-
-static int mn_get_unlink(int fd)
-{
- erlang_msg msg;
- char buf[EISMALLBUF];
- char *bufp=buf;
- int index;
- int msglen;
-
- /* wait for unlink or exit */
- while (1) {
- index = EISMALLBUF;
- switch (ei_recv_internal(fd,&bufp,&index,&msg,&msglen,1,0)) {
- case 0: continue;
- case ERL_UNLINK: return 0;
- default: return -1;
- }
- }
- return 0;
-}
-
-/* dump to backup */
-/* fd is open connection to erlang node */
-int ei_reg_dump(int fd, ei_reg *reg, const char *mntab, int flags)
-{
- ei_hash *tab;
- erlang_pid *self;
- erlang_pid mnesia;
- ei_bucket *b;
- ei_reg_obj *obj;
- const char *key;
- ei_cnode *ec;
- int i;
-
- if (!reg || !mntab) return -1; /* return EI_BADARG; */
- tab = reg->tab;
-
- /* make a self pid */
-
- if ((ec = ei_fd_to_cnode(fd)) == NULL) {
- return -1;
- }
-
- self = ei_self(ec);
-
- if (mn_start_dump(fd,self,&mnesia,mntab)) return -1;
-
- /* traverse the table, passing objects to mnesia */
- for (i=0; i<tab->size; i++) {
- b=tab->tab[i];
- while (b) {
- obj = (ei_reg_obj*)(b->value); /* cast to eliminate 'const' warning */
- key = b->key;
-
- if ((flags & EI_FORCE) || (obj->attr & EI_DIRTY)) {
- if (obj->attr & EI_DELET) {
- if (mn_send_delete(fd,&mnesia,key)) {
- ei_send_exit(fd,self,&mnesia,"delete failed");
- return -1;
- }
- }
- else {
- if (mn_send_write(fd,&mnesia,key,obj)) {
- ei_send_exit(fd,self,&mnesia,"update failed");
- return -1;
- }
- }
- }
- b = b->next;
- }
- }
-
- /* end the transaction */
- if (mn_send_commit(fd,&mnesia,self)) {
- ei_send_exit(fd,self,&mnesia,"commit failed");
- return -1;
- }
-
- /* wait for unlink */
- if (mn_get_unlink(fd)) return -1;
-
- /* this point only reached if all went ok so far... */
-
- /* now remove all deleted objects, unless the caller asked us not to */
- if (!(flags & EI_NOPURGE)) ei_reg_purge(reg);
-
- /* success */
- return 0;
-
-}
diff --git a/lib/erl_interface/src/registry/reg_free.c b/lib/erl_interface/src/registry/reg_free.c
deleted file mode 100644
index d835520e76..0000000000
--- a/lib/erl_interface/src/registry/reg_free.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "reg.h"
-
-/* free a registry object (inode) on the freelist. The "value"
- * contained by the object is removed.
- */
-void ei_reg_free(ei_reg *reg, ei_reg_obj *obj)
-{
- /* free the value part */
- switch (ei_reg_typeof(obj)) {
- case EI_STR:
- free(obj->val.s);
- break;
-
- case EI_BIN:
- free(obj->val.p);
- break;
- }
-
- /* fprintf(stderr,"%s:%d: saving %p on freelist\n",__FILE__,__LINE__,obj);*/
-
- /* save the rest on the freelist */
- obj->next = reg->freelist;
- reg->freelist = obj;
-
- return;
-}
diff --git a/lib/erl_interface/src/registry/reg_get.c b/lib/erl_interface/src/registry/reg_get.c
deleted file mode 100644
index 73975f6a91..0000000000
--- a/lib/erl_interface/src/registry/reg_get.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdarg.h>
-#include "reg.h"
-
-/* this is the general "get" function. Values are copied into a buffer
- * provided by the caller, and the return value indicates success or
- * failure. This function can get all types except directorys. The user
- * must specify the type of data he is expecting, or 0 if he doesn't
- * care. On success, the data type is returned. If the requested data
- * type does not match the data found, EI_TYPE is returned.
- */
-int ei_reg_getval(ei_reg *reg, const char *key, int flags, ...)
-{
- ei_hash *tab;
- ei_reg_obj *obj=NULL;
- va_list ap;
- int rval;
- int objtype;
-
- if (!key || !reg) return -1; /* return EI_BADARG; */
- tab = reg->tab;
- if (!(obj=ei_hash_lookup(tab,key))) return -1; /* return EI_NOTFOUND; */
- if (obj->attr & EI_DELET) return -1; /* return EI_NOTFOUND; */
-
- /* if type was specified then it must match object */
- objtype = ei_reg_typeof(obj);
- if (flags && (flags != objtype)) return -1; /* return EI_TYPE; */
-
- va_start(ap,flags);
-
- switch ((rval = objtype)) {
- case EI_INT: {
- long *ip;
-
- if (!(ip = va_arg(ap,long*))) rval = -1; /* EI_BADARG; */
- else *ip = obj->val.i;
- break;
- }
- case EI_FLT: {
- double *fp;
-
- if (!(fp = va_arg(ap,double*))) rval = -1; /* EI_BADARG; */
- else *fp = obj->val.f;
- break;
- }
- case EI_STR: {
- char **sp;
-
- if (!(sp = va_arg(ap,char**))) rval = -1; /* EI_BADARG; */
- else *sp = obj->val.s;
- break;
- }
- case EI_BIN: {
- void **pp;
- int *size;
-
- if (!(pp = va_arg(ap,void**))) rval = -1; /* EI_BADARG; */
- else *pp = obj->val.p;
- if ((size=va_arg(ap,int*))) *size=obj->size;
- break;
- }
- default:
- /* can't (should never) happen */
- rval = -1;
- /* rval = EI_UNKNOWN; */
- }
-
- /* clean up & return */
- va_end(ap);
- return rval;
-}
diff --git a/lib/erl_interface/src/registry/reg_getf.c b/lib/erl_interface/src/registry/reg_getf.c
deleted file mode 100644
index 35956c3d79..0000000000
--- a/lib/erl_interface/src/registry/reg_getf.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include "reg.h"
-
-double ei_reg_getfval(ei_reg *reg, const char *key)
-{
- ei_hash *tab;
- ei_reg_obj *obj=NULL;
-
- if (!key || !reg) return -1; /* return (double)EI_BADARG; */
- tab = reg->tab;
- if (!(obj=ei_hash_lookup(tab,key))) return -1; /* return EI_NOTFOUND; */
- if (obj->attr & EI_DELET) return -1; /* return EI_NOTFOUND; */
- if (ei_reg_typeof(obj) != EI_FLT) return -1; /* return (double)EI_TYPE; */
-
- return obj->val.f;
-}
diff --git a/lib/erl_interface/src/registry/reg_geti.c b/lib/erl_interface/src/registry/reg_geti.c
deleted file mode 100644
index 09709fdf3d..0000000000
--- a/lib/erl_interface/src/registry/reg_geti.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include "reg.h"
-
-long ei_reg_getival(ei_reg *reg, const char *key)
-{
- ei_hash *tab;
- ei_reg_obj *obj=NULL;
-
- if (!key || !reg) return -1; /* return EI_BADARG; */
- tab = reg->tab;
- if (!(obj=ei_hash_lookup(tab,key))) return -1; /* return EI_NOTFOUND; */
- if (obj->attr & EI_DELET) return -1; /* return EI_NOTFOUND; */
- if (ei_reg_typeof(obj) != EI_INT) return -1; /* return EI_TYPE; */
-
- return obj->val.i;
-}
diff --git a/lib/erl_interface/src/registry/reg_getp.c b/lib/erl_interface/src/registry/reg_getp.c
deleted file mode 100644
index faff00bcb0..0000000000
--- a/lib/erl_interface/src/registry/reg_getp.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "reg.h"
-
-const void *ei_reg_getpval(ei_reg *reg, const char *key, int *size)
-{
- ei_hash *tab;
- ei_reg_obj *obj;
-
- if (!key || !reg) return NULL;
- tab = reg->tab;
-
- if ((!(obj=ei_hash_lookup(tab,key))) || /* return (const void *)EI_NOTFOUND; */
- (obj->attr & EI_DELET) || /* return (const void *)EI_NOTFOUND; */
- (ei_reg_typeof(obj) != EI_BIN)) /* return (const void *)EI_TYPE; */
- return NULL;
-
- if (size) *size=obj->size;
- return obj->val.p;
-}
diff --git a/lib/erl_interface/src/registry/reg_gets.c b/lib/erl_interface/src/registry/reg_gets.c
deleted file mode 100644
index 27fd83ac03..0000000000
--- a/lib/erl_interface/src/registry/reg_gets.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "reg.h"
-
-const char *ei_reg_getsval(ei_reg *reg, const char *key)
-{
- ei_hash *tab;
- ei_reg_obj *obj=NULL;
-
- if (!key || !reg) return NULL; /* return (const char *)EI_BADARG; */
- tab = reg->tab;
-
- if ((!(obj=ei_hash_lookup(tab,key))) || /* return (const char *)EI_NOTFOUND; */
- (obj->attr & EI_DELET) || /* return (const char *)EI_NOTFOUND; */
- (ei_reg_typeof(obj) != EI_STR)) /* return (const char *)EI_TYPE; */
- return NULL;
-
- return obj->val.s;
-}
diff --git a/lib/erl_interface/src/registry/reg_make.c b/lib/erl_interface/src/registry/reg_make.c
deleted file mode 100644
index ed77a740b6..0000000000
--- a/lib/erl_interface/src/registry/reg_make.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "reg.h"
-
-
-/* make a new ei_reg_obj object. If the freelist for this registry is
- * not empty, an object will be returned from there. Otherwise one
- * will be created with malloc().
- */
-ei_reg_obj *ei_reg_make(ei_reg *reg, int attr)
-{
- ei_reg_obj *new=NULL;
-
- if (reg->freelist) {
- new = reg->freelist;
- reg->freelist = new->next;
- /* fprintf(stderr,"%s:%d: found %p on freelist\n",__FILE__,__LINE__,new); */
- }
- else {
- new = malloc(sizeof(*new));
- /* fprintf(stderr,"%s:%d: allocated %p\n",__FILE__,__LINE__,new); */
- }
-
- if (new) {
- new->attr=attr | EI_DIRTY;
- new->size=0;
- new->next = NULL;
- }
- return new;
-}
diff --git a/lib/erl_interface/src/registry/reg_open.c b/lib/erl_interface/src/registry/reg_open.c
deleted file mode 100644
index 73c2140145..0000000000
--- a/lib/erl_interface/src/registry/reg_open.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "reg.h"
-
-/* open a registry */
-ei_reg *ei_reg_open(int size)
-{
- ei_reg *new;
-
- if (size <= 0) return NULL;
-
- if (!(new = malloc(sizeof(*new)))) return NULL;
-
- new->freelist = NULL;
-
- if (!(new->tab = ei_hash_newtab(size))) {
- free(new);
- return NULL;
- }
-
- return new;
-}
diff --git a/lib/erl_interface/src/registry/reg_purge.c b/lib/erl_interface/src/registry/reg_purge.c
deleted file mode 100644
index 08483e32f5..0000000000
--- a/lib/erl_interface/src/registry/reg_purge.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "reg.h"
-
-static ei_bucket *do_purge(ei_reg *reg, int i)
-{
- ei_hash *tab = reg->tab;
- ei_bucket *head = tab->tab[i];
- ei_bucket *this, *next;
- ei_reg_obj *obj;
-
- /* first position special case */
- while ((this=head)) {
- obj = (ei_reg_obj*)(this->value); /* cast to eliminate 'const' warning */
- if (obj->attr & EI_DELET) {
- head = this->next;
- ei_reg_free(reg,obj); /* free obj to freelist */
- ei_hash_bfree(tab,this); /* free bucket to freelist */
- tab->nelem--;
- }
- else break;
- }
-
- /* check remaining positions */
- this = head;
- while (this && this->next) {
- next = this->next;
- obj = (ei_reg_obj*)(next->value); /* cast to eliminate 'const' warning */
- if (obj->attr & EI_DELET) {
- this->next = next->next;
- ei_reg_free(reg,obj); /* free object to freelist */
- ei_hash_bfree(tab,next); /* free bucket to freelist */
- tab->nelem--;
- }
- else this = this->next;
- }
-
- return head;
-}
-
-int ei_reg_purge(ei_reg *reg)
-{
- ei_hash *tab;
- int i;
-
- if (!reg) return -1;
- tab = reg->tab;
-
- for (i=0;i<tab->size;i++) {
- if ((tab->tab[i])) {
- tab->tab[i] = do_purge(reg,i);
- if (!tab->tab[i]) tab->npos--;
- }
- }
-
- return 0;
-}
diff --git a/lib/erl_interface/src/registry/reg_resize.c b/lib/erl_interface/src/registry/reg_resize.c
deleted file mode 100644
index b451a28348..0000000000
--- a/lib/erl_interface/src/registry/reg_resize.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include "reg.h"
-
-/* resize a registry - return the new size or -1 on error */
-int ei_reg_resize(ei_reg *reg, int newsize)
-{
- ei_hash *newtab=NULL;
-
- if (!reg) return -1;
- if (newsize <= 0) return -1;
-
- if ((newtab=ei_hash_resize(reg->tab,newsize))) {
- reg->tab = newtab;
- }
-
- return reg->tab->size;
-}
diff --git a/lib/erl_interface/src/registry/reg_restore.c b/lib/erl_interface/src/registry/reg_restore.c
deleted file mode 100644
index 030bab19b9..0000000000
--- a/lib/erl_interface/src/registry/reg_restore.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include <string.h>
-#include "eidef.h"
-#include "eiext.h"
-#include "reg.h"
-#include "eisend.h"
-#include "eirecv.h"
-#include "ei_connect_int.h"
-
-static int mn_start_restore(int fd, const erlang_pid *self, erlang_pid *mnesia, const char *mntab, long *count, long *maxkey,long *maxobj)
-{
- char buf[EISMALLBUF];
- char *bufp=buf;
- char tmpbuf[64];
- int index = 0;
- erlang_msg msg;
- int arity;
- int version;
- int i;
- int needlink;
- int needmsg;
- int msglen;
-
- /* set up rpc arguments */
- /* { PidFrom, { call, Mod, Fun, Args, user }} */
- ei_encode_version(buf,&index);
- ei_encode_tuple_header(buf,&index,2);
- ei_encode_pid(buf,&index,self); /* PidFrom */
- ei_encode_tuple_header(buf,&index,5);
- ei_encode_atom(buf,&index,"call"); /* call */
- ei_encode_atom(buf,&index,EI_MNESIA_MODULE); /* Mod */
- ei_encode_atom(buf,&index,EI_MNESIA_RESTORE); /* Fun */
- ei_encode_list_header(buf,&index,2); /* Args: [ table, self() ] */
- ei_encode_atom(buf,&index,mntab);
- ei_encode_pid(buf,&index,self);
- ei_encode_empty_list(buf,&index);
- ei_encode_atom(buf,&index,"user"); /* user */
-
- /* make the rpc call */
- if (ei_send_reg_encoded(fd,self,"rex",buf,index)) return -1;
-
- /* get the reply: expect link and message (not sure which will come first though) */
- needlink = needmsg = 1;
- while (needlink || needmsg) {
- /* get message */
- index = EISMALLBUF;
- while (!(i = ei_recv_internal(fd,&bufp,&index,&msg,&msglen,1,0))) index = EISMALLBUF;
-
- switch (i) {
- case ERL_LINK:
- /* got link */
- if (!needlink) return -1;
- needlink = 0;
- break;
-
- case ERL_SEND:
- /* got message - is it the right one? */
- if (!needmsg) return -1;
- else {
- /* expecting { rex, { size, Pid, Count, MaxKey, MaxObj }} */
- index = 0;
- if (ei_decode_version(buf,&index,&version)
- || ei_decode_tuple_header(buf,&index,&arity)
- || (arity != 2)
- || ei_decode_atom(buf,&index,tmpbuf)
- || strcmp(tmpbuf,"rex")
- || ei_decode_tuple_header(buf,&index,&arity)
- || (arity != 5)
- || ei_decode_atom(buf,&index,tmpbuf)
- || strcmp(tmpbuf,EI_MNESIA_SIZE)
- || ei_decode_pid(buf,&index,mnesia)
- || ei_decode_long(buf,&index,count)
- || ei_decode_long(buf,&index,maxkey)
- || ei_decode_long(buf,&index,maxobj))
- return -1; /* bad response from other side */
-
- /* got msg */
- needmsg = 0;
- }
- break;
-
- default:
- return -1; /* wasn't link or pid */
- }
- }
- return 0;
-}
-
-static int mn_unlink(int fd)
-{
- erlang_msg msg;
- char buf[EISMALLBUF];
- char *bufp=buf;
- int index;
- int msglen;
-
- /* wait for unlink or exit */
- while (1) {
- index = EISMALLBUF;
- switch (ei_recv_internal(fd,&bufp,&index,&msg,&msglen,1,0)) {
- case 0: continue;
- case ERL_UNLINK: return 0;
- default: return -1;
- }
- }
- return 0;
-}
-
-/* decode an object and insert it into the table */
-static int mn_decode_insert(ei_reg *reg, const char *msgbuf, int *index, char *key)
-{
- long keylen;
- long objlen;
- long objtype;
- void *objbuf = NULL;
- long i;
- double f;
-
- if (ei_decode_long(msgbuf,index,&keylen)
- || ei_decode_long(msgbuf,index,&objlen)
- || ei_decode_long(msgbuf,index,&objtype))
- return -1;
-
-
- /* decode key */
- if (ei_decode_string(msgbuf,index,key)) {
- if (objbuf) free(objbuf);
- return -1;
- }
-
- /* finally! decode object and insert in table */
- /* don't forget to fix attributes (dirty bit for example) */
-
- /* FIXME: added cast but 64 bit trouble I think */
- switch ((int)objtype & EI_REG_TYPEMASK) {
- case EI_INT:
- if (ei_decode_long(msgbuf,index,&i)) return -1;
- ei_reg_setival(reg,key,i);
- break;
-
- case EI_FLT:
- if (ei_decode_double(msgbuf,index,&f)) return -1;
- ei_reg_setfval(reg,key,f);
- break;
-
- case EI_STR:
- objbuf = NULL;
- if (objlen > 0) {
- if (!(objbuf = malloc(objlen))) return -1;
- if (ei_decode_string(msgbuf,index,objbuf)) {
- free(objbuf);
- return -1;
- }
- ei_reg_setsval(reg,key,objbuf);
- }
- else {
- /* just a pointer to nothing */
- if (ei_decode_long(msgbuf,index,&i)) return -1;
- ei_reg_setsval(reg,key,NULL);
- }
- break;
-
- case EI_BIN:
- objbuf = NULL;
- if (objlen > 0) {
- if (!(objbuf = malloc(objlen))) return -1;
- if (ei_decode_binary(msgbuf,index,objbuf,&i)) {
- free(objbuf);
- return -1;
- }
- /* assert(i == objlen) */
- ei_reg_setpval(reg,key,objbuf,objlen);
- }
- else {
- /* just a pointer to nothing */
- if (ei_decode_long(msgbuf,index,&i)) return -1;
- ei_reg_setpval(reg,key,(void *)i,0);
- }
- break;
-
- default:
- /* unknown type */
- if (objbuf) free(objbuf);
- return -1;
- } /* switch */
-
- return 0;
-}
-
-/* help function passed to hash_foreach, to clear dirty bits */
-/* use after successful restore */
-static int clean_obj(const char *key, const void *p)
-{
- ei_reg_obj *obj = (ei_reg_obj *)p;
-
- if (obj) obj->attr &= ~EI_DIRTY;
-
- return 0;
-}
-
-int ei_reg_restore(int fd, ei_reg *reg, const char *mntab)
-{
- int i,j;
- char tag[32];
- char sbuf[EISMALLBUF];
- char *dbuf = NULL;
- char *msgbuf = NULL;
- char *keybuf = NULL;
- erlang_pid *self;
- erlang_pid mnesia = {"",0,0,0};
- erlang_msg msg;
- int index = 0;
- int len = 0;
- int msglen;
- int version = 0;
- int arity = 0;
- long count = 0;
- long maxkey = 0;
- long maxobj = 0;
- ei_cnode *ec;
-
- if (!reg || !mntab) return -1; /* return EI_BADARG; */
-
- /* make a self pid */
-
- if ((ec = ei_fd_to_cnode(fd)) == NULL) {
- return -1;
- }
-
- self = ei_self(ec);
-
-
- if (mn_start_restore(fd,self,&mnesia,mntab,&count,&maxkey,&maxobj)) {
- /* send exit *only* if we have pid */
- if (mnesia.node[0]) ei_send_exit(fd,self,&mnesia,"bad response from rpc start");
- return -1;
- }
-
- if (count <= 0) {
- ei_send_exit(fd,self,&mnesia,"nothing to do");
- return 0;
- }
-
- /* make sure receive buffer can handle largest expected message */
- len = maxkey + maxobj + 512;
- if (len > EISMALLBUF)
- if (!(dbuf = malloc(len))) {
- ei_send_exit(fd,self,&mnesia,"cannot allocate space for incoming data");
- return -1;
- }
- msgbuf = (dbuf ? dbuf : sbuf);
-
- /* allocate space for largest key */
- if (!(keybuf = malloc(maxkey+1))) goto restore_failure;
-
- /* get this ball rolling */
- index = 0;
- ei_encode_version(msgbuf,&index);
- ei_encode_tuple_header(msgbuf,&index,2);
- ei_encode_atom(msgbuf,&index,"send_records");
- ei_encode_pid(msgbuf,&index,self);
- if (ei_send_encoded(fd,&mnesia,msgbuf,index)) goto restore_failure;
-
- /* read as much as possible, until count or EXIT */
- for (i=0; i<count; i++) {
- index = len;
- while ((j = ei_recv_internal(fd,&msgbuf,&index,&msg,&msglen,1,0)) == 0) index = len;
- if (j<0) goto restore_failure;
-
- /* decode the first part of the message */
- index = 0;
- if ((msg.msgtype != ERL_SEND)
- || ei_decode_version(msgbuf,&index,&version)
- || ei_decode_tuple_header(msgbuf,&index,&arity)
- || (arity != 6)
- || ei_decode_atom(msgbuf,&index,tag)
- || strcmp(tag,EI_MNESIA_RECV))
- goto restore_failure;
-
- /* decode the rest of the message and insert data into table */
- if (mn_decode_insert(reg,msgbuf,&index,keybuf)) goto restore_failure;
- }
-
- if (keybuf) free(keybuf);
- if (dbuf) free(dbuf);
-
- /* wait for unlink */
- if (mn_unlink(fd)) return -1;
-
- /* clear all the dirty bits */
- ei_hash_foreach(reg->tab,clean_obj);
-
- /* success */
- return 0;
-
-restore_failure:
- ei_send_exit(fd,self,&mnesia,"restore failure");
- if (keybuf) free(keybuf);
- if (dbuf) free(dbuf);
- return -1;
-}
-
diff --git a/lib/erl_interface/src/registry/reg_set.c b/lib/erl_interface/src/registry/reg_set.c
deleted file mode 100644
index 3846df1cb5..0000000000
--- a/lib/erl_interface/src/registry/reg_set.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdarg.h>
-#include "reg.h"
-
-int ei_reg_setval(ei_reg *reg, const char *key, int flags, ...)
-{
- va_list ap;
- int rval = 0;
-
- if (!key || !reg) return -1; /* return EI_BADARG; */
-
- va_start(ap,flags);
-
- switch (flags & EI_REG_TYPEMASK) {
- case EI_INT: {
- long i;
-
- i = va_arg(ap,long);
- rval = ei_reg_setival(reg,key,i);
- break;
- }
- case EI_FLT: {
- double f;
-
- f = va_arg(ap,double);
- rval = ei_reg_setfval(reg,key,f);
- break;
- }
- case EI_STR: {
- char *s;
-
- s = va_arg(ap,char*);
- rval = ei_reg_setsval(reg,key,s);
- break;
- }
- case EI_BIN: {
- void *p;
- int len;
-
- p = va_arg(ap,void*);
- len = va_arg(ap,int);
- rval = ei_reg_setpval(reg,key,p,len);
- break;
- }
-
- default:
- rval = -1;
- /* rval = EI_BADARG; */
- }
-
- /* clean up & return */
- va_end(ap);
- return rval;
-}
-
diff --git a/lib/erl_interface/src/registry/reg_setf.c b/lib/erl_interface/src/registry/reg_setf.c
deleted file mode 100644
index e0879cb3d5..0000000000
--- a/lib/erl_interface/src/registry/reg_setf.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "reg.h"
-
-int ei_reg_setfval(ei_reg *reg, const char *key, double f)
-{
- ei_hash *tab;
- ei_reg_obj *obj=NULL;
-
- if (!key || !reg) return -1; /* return EI_BADARG; */
- tab = reg->tab;
-
- if ((obj=ei_hash_lookup(tab,key))) {
- /* object with same name already exists */
- switch (ei_reg_typeof(obj)) {
- case EI_INT:
- break;
- case EI_FLT:
- break;
- case EI_STR:
- if (obj->size > 0) free(obj->val.s);
- break;
- case EI_BIN:
- if (obj->size > 0) free(obj->val.p);
- break;
- default:
- return -1;
- /* return EI_UNKNOWN; */
- }
- }
- else {
- /* object is new */
- if (!(obj=ei_reg_make(reg,EI_FLT))) return -1; /* return EI_NOMEM; */
- ei_hash_insert(tab,key,obj);
- }
-
- obj->attr = EI_FLT | EI_DIRTY;
- obj->val.f=f;
- obj->size = 0;
-
- return 0;
-}
diff --git a/lib/erl_interface/src/registry/reg_seti.c b/lib/erl_interface/src/registry/reg_seti.c
deleted file mode 100644
index 507ed9907e..0000000000
--- a/lib/erl_interface/src/registry/reg_seti.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "reg.h"
-
-/* set and get values */
-int ei_reg_setival(ei_reg *reg, const char *key, long i)
-{
- ei_hash *tab;
- ei_reg_obj *obj=NULL;
-
- if (!key || !reg) return -1; /* return EI_BADARG; */
- tab = reg->tab;
-
- if ((obj=ei_hash_lookup(tab,key))) {
- /* object with same name already exists */
- switch (ei_reg_typeof(obj)) {
- case EI_INT:
- break;
- case EI_FLT:
- break;
- case EI_STR:
- if (obj->size > 0) free(obj->val.s);
- break;
- case EI_BIN:
- if (obj->size > 0) free(obj->val.p);
- break;
- default:
- return -1;
- /* return EI_UNKNOWN; */
- }
- }
- else {
- /* object is new */
- if (!(obj=ei_reg_make(reg,EI_INT))) return -1; /* return EI_NOMEM; */
- ei_hash_insert(tab,key,obj);
- }
-
- obj->attr = EI_INT | EI_DIRTY;
- obj->val.i=i;
- obj->size = 0;
-
- return 0;
-}
diff --git a/lib/erl_interface/src/registry/reg_setp.c b/lib/erl_interface/src/registry/reg_setp.c
deleted file mode 100644
index 1dd158778a..0000000000
--- a/lib/erl_interface/src/registry/reg_setp.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include "reg.h"
-
-int ei_reg_setpval(ei_reg *reg, const char *key, const void *p, int size)
-{
- ei_hash *tab;
- ei_reg_obj *obj=NULL;
-
- if (size < 0) return -1;
- if (!key || !reg) return -1; /* return EI_BADARG; */
- tab = reg->tab;
-
- if ((obj=ei_hash_lookup(tab,key))) {
- /* object with same name already exists */
- switch (ei_reg_typeof(obj)) {
- case EI_INT:
- break;
- case EI_FLT:
- break;
- case EI_STR:
- if (obj->size > 0) free(obj->val.s);
- break;
- case EI_BIN:
- if (obj->size > 0) free(obj->val.p);
- break;
- default:
- return -1;
- /* return EI_UNKNOWN; */
- }
- }
- else {
- /* object is new */
- if (!(obj=ei_reg_make(reg,EI_BIN))) return -1; /* return EI_NOMEM; */
- ei_hash_insert(tab,key,obj);
- }
-
- obj->attr = EI_BIN | EI_DIRTY;
- obj->val.p=(void *)p;
- obj->size=size;
-
- return 0;
-}
diff --git a/lib/erl_interface/src/registry/reg_sets.c b/lib/erl_interface/src/registry/reg_sets.c
deleted file mode 100644
index d281d732b7..0000000000
--- a/lib/erl_interface/src/registry/reg_sets.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include <stdlib.h>
-#include <string.h>
-#include "reg.h"
-
-int ei_reg_setsval(ei_reg *reg, const char *key, const char *s)
-{
- ei_hash *tab;
- ei_reg_obj *obj=NULL;
- int len = 0;
-
-
- if (!key || !reg) return -1; /* return EI_BADARG; */
- tab = reg->tab;
- if (s) len = strlen(s) +1;
-
- if ((obj=ei_hash_lookup(tab,key))) {
- /* object with same name already exists */
- switch (ei_reg_typeof(obj)) {
- case EI_INT:
- break;
- case EI_FLT:
- break;
- case EI_STR:
- if (obj->size > 0) free(obj->val.s);
- break;
- case EI_BIN:
- if (obj->size > 0) free(obj->val.p);
- break;
- default:
- return -1;
- /* return EI_UNKNOWN; */
- }
- }
- else {
- /* object is new */
- if (!(obj=ei_reg_make(reg,EI_STR))) return -1; /* return EI_NOMEM; */
- ei_hash_insert(tab,key,obj);
- }
-
- obj->attr = EI_STR | EI_DIRTY;
- obj->val.s=(char *)s;
- obj->size = len;
-
- return 0;
-}
diff --git a/lib/erl_interface/src/registry/reg_stat.c b/lib/erl_interface/src/registry/reg_stat.c
deleted file mode 100644
index e946199f4a..0000000000
--- a/lib/erl_interface/src/registry/reg_stat.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include "reg.h"
-
-/* Get object attributes.
- * This function returns a COPY of the ei_reg_obj
- * struct for an object.
- */
-int ei_reg_stat(ei_reg *reg, const char *key, struct ei_reg_stat *obuf)
-{
- ei_hash *tab;
- ei_reg_obj *obj;
-
- if (!key || !obuf || !reg) return -1; /* return EI_BADARG; */
- tab = reg->tab;
-
- if (!(obj=ei_hash_lookup(tab,key))) return -1; /* return EI_NOTFOUND; */
-
- obuf->attr = obj->attr;
- obuf->size = obj->size;
-
- return 0;
-}
diff --git a/lib/erl_interface/src/registry/reg_tabstat.c b/lib/erl_interface/src/registry/reg_tabstat.c
deleted file mode 100644
index 1a3e654090..0000000000
--- a/lib/erl_interface/src/registry/reg_tabstat.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
-
- */
-#include "reg.h"
-
-/* get table information */
-int ei_reg_tabstat(ei_reg *reg, struct ei_reg_tabstat *obuf)
-{
- ei_hash *tab;
-
- if (!reg || !obuf) return -1; /* return EI_BADARG; */
- tab = reg->tab;
-
- obuf->npos = tab-> npos;
- obuf->size = tab->size;
- obuf->nelem = tab->nelem;
- obuf->collisions = tab->nelem - tab->npos;
-
- return 0;
-}
diff --git a/system/doc/general_info/deprecations_23.inc b/system/doc/general_info/deprecations_23.inc
index d71bc4ba69..0d968a537f 100644
--- a/system/doc/general_info/deprecations_23.inc
+++ b/system/doc/general_info/deprecations_23.inc
@@ -43,12 +43,8 @@
<section>
<title>erl_interface registry</title>
<p>
- As of OTP 23, the
- <seecref marker="erl_interface:registry"><c>registry</c></seecref>
- functionality part of
- <seeapp marker="erl_interface:index"><c>erl_interface</c></seeapp>
- has been deprecated and it has also been
- <seeguide marker="scheduled_for_removal#otp-24">scheduled for removal</seeguide>
- in OTP 24.
+ As of OTP 23, the <c>registry</c> functionality part of
+ <c>erl_interface</c> has been deprecated and it has also been
+ removed in OTP 24.
</p>
</section>
diff --git a/system/doc/general_info/removed_24.inc b/system/doc/general_info/removed_24.inc
new file mode 100644
index 0000000000..b5f2eb364f
--- /dev/null
+++ b/system/doc/general_info/removed_24.inc
@@ -0,0 +1,8 @@
+ <section>
+ <title>erl_interface registry</title>
+ <p>
+ The <c>registry</c> functionality part of <c>erl_interface</c> was as of
+ <seeguide marker="deprecations#otp-23">OTP 23 deprecated</seeguide>
+ and was removed in OTP 24.
+ </p>
+ </section>
diff --git a/system/doc/general_info/scheduled_for_removal_24.inc b/system/doc/general_info/scheduled_for_removal_24.inc
index 3f21e325b7..fd602325ae 100644
--- a/system/doc/general_info/scheduled_for_removal_24.inc
+++ b/system/doc/general_info/scheduled_for_removal_24.inc
@@ -30,15 +30,3 @@
encoded in Latin-1 but without a <c>%% coding: latin-1</c> comment at the
beginning of the file.</p>
</section>
- <section>
- <title>erl_interface registry</title>
- <p>
- The
- <seecref marker="erl_interface:registry"><c>registry</c></seecref>
- functionality part of
- <seeapp marker="erl_interface:index"><c>erl_interface</c></seeapp>
- is as of
- <seeguide marker="deprecations#otp-23">OTP 23 deprecated</seeguide>
- and will be removed in OTP 24.
- </p>
- </section>
--
2.26.2