ソースを参照

Function load_tm_api added

There are many modules that need to access the API of tm module and they all
have to go through the same step of commands to bind the API exported by
the tm module. It makes more sense to create one function which does it all
and make that function available to all other modules using tm.

Signed-off-by: Jan Janak <[email protected]>
Jan Janak 16 年 前
コミット
bb21bd2e46
1 ファイル変更19 行追加0 行削除
  1. 19 0
      modules/tm/tm_load.h

+ 19 - 0
modules/tm/tm_load.h

@@ -140,4 +140,23 @@ typedef int(*load_tm_f)( struct tm_binds *tmb );
 int load_tm( struct tm_binds *tmb);
 
 
+static inline int load_tm_api(struct tm_binds* tmb)
+{
+	load_tm_f load_tm;
+
+	/* import the TM auto-loading function */
+	load_tm = (load_tm_f)find_export("load_tm", NO_SCRIPT, 0);
+	
+	if (load_tm == NULL) {
+		LOG(L_ERR, "Cannot import load_tm function from tm module\n");
+		return -1;
+	}
+	
+	/* let the auto-loading function load all TM stuff */
+	if (load_tm(tmb) == -1) {
+		return -1;
+	}
+	return 0;
+}
+
 #endif