File 2811-snmp-Add-callback-attribute.patch of Package erlang

From 7238e5e882492aea830750de8ad3cce1a820832b Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Mon, 9 Oct 2023 15:53:11 +0200
Subject: [PATCH] snmp: Add callback attribute

---
 lib/snmp/src/agent/snmpa_mib_data.erl | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/snmp/src/agent/snmpa_mib_data.erl b/lib/snmp/src/agent/snmpa_mib_data.erl
index fcbc0465c8..289ffea47a 100644
--- a/lib/snmp/src/agent/snmpa_mib_data.erl
+++ b/lib/snmp/src/agent/snmpa_mib_data.erl
@@ -50,12 +50,12 @@
 
 -callback sync(State :: term()) -> ok.
 
--callback load_mib(State :: term(), FileName :: string(), 
+-callback load_mib(State :: term(), FileName :: filename(),
 		   MeOverride :: boolean(), 
 		   TeOverride :: boolean()) -> 
     {ok, NewState :: term()} | {error, Reason :: already_loaded | term()}.
 
--callback unload_mib(State :: term(), FileName :: string(), 
+-callback unload_mib(State :: term(), FileName :: filename(),
 		   MeOverride :: boolean(), 
 		   TeOverride :: boolean()) -> 
     {ok, NewState :: term()} | {error, Reason :: not_loaded | term()}.
@@ -90,10 +90,10 @@
     {ok, Mib :: string()} | {error, Reason :: term()}.
 
 -callback which_mibs(State :: term()) -> 
-    [{MibName :: atom(), Filename :: string()}].
+    [{MibName :: atom(), Filename :: filename()}].
 
 -callback whereis_mib(State :: term(), MibName :: atom()) -> 
-    {ok, Filename :: string()} | {error, Reason :: term()}.
+    {ok, Filename :: filename()} | {error, Reason :: term()}.
 
 -callback info(State :: term()) -> list().
 
@@ -106,5 +106,12 @@
 		      State :: term()) -> 
     NewState :: term().
 
+%% Backwards-compatibility callback
+-callback unload_mib(State, Filename) -> {ok, NewState} | {error, Reason} when
+      State :: term(),
+      Filename :: filename(),
+      NewState :: term(),
+      Reason :: not_loaded | term().
 
+-optional_callbacks([unload_mib/2]).
 
-- 
2.35.3

openSUSE Build Service is sponsored by