summaryrefslogtreecommitdiff
path: root/tools/abi-checker/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/abi-checker/src')
-rw-r--r--tools/abi-checker/src/Makefile31
-rwxr-xr-xtools/abi-checker/src/abi-module-checker43
-rwxr-xr-xtools/abi-checker/src/abi-module-dumper51
-rwxr-xr-xtools/abi-checker/src/abi-module-kernels-list45
-rwxr-xr-xtools/abi-checker/src/build_api_kernel_checker.sh38
-rw-r--r--tools/abi-checker/src/kernel_abi_checker.c834
-rw-r--r--tools/abi-checker/src/kernel_abi_checker.h62
-rw-r--r--tools/abi-checker/src/kernel_abi_checker_elf.c172
8 files changed, 0 insertions, 1276 deletions
diff --git a/tools/abi-checker/src/Makefile b/tools/abi-checker/src/Makefile
deleted file mode 100644
index b020bc698f4..00000000000
--- a/tools/abi-checker/src/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-PROGRAM = abi-checker
-GCC = gcc
-LDD = gcc
-
-CFLAGS = $(shell pkg-config --cflags glib-2.0 libelf) -I.
-
-LDFLAGS = $(shell pkg-config --libs glib-2.0 libelf)
-
-SRC = kernel_abi_checker.c kernel_abi_checker_elf.c
-
-HEADER = kernel_abi_checker.h
-
-DEST_DIR = /usr/local/bin
-
-OBJECTS = kernel_abi_checker.o kernel_abi_checker_elf.o
-
-all : $(PROGRAM)
-
-.c.o : $(HEADER)
- $(GCC) -c $(CFLAGS) $< -o $@
-
-$(PROGRAM) : $(OBJECTS)
- $(LDD) $(OBJECTS) -o $@ $(LDFLAGS)
-
-install :
- mkdir -p $(DEST_DIR)
- cp $(PROGRAM) $(DEST_DIR)
-
-clean :
- rm -f $(PROGRAM)
- rm -f $(OBJECTS)
diff --git a/tools/abi-checker/src/abi-module-checker b/tools/abi-checker/src/abi-module-checker
deleted file mode 100755
index 2666fbd9dc9..00000000000
--- a/tools/abi-checker/src/abi-module-checker
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-
-echo ""
-echo "Module ABI/API checker"
-echo ""
-echo ""
-
-if [ "${#}" != "1" ]
-then
- echo ""
- echo "ERROR: "
- echo " Usage: ${0} _module_abi_fingerprint_"
- echo ""
- exit 1
-fi
-
-kerne_abi_file="/boot/abi/current"
-
-if [ ! -f "${1}" -o ! -f "${kerne_abi_file}" ]
-then
- echo ""
- echo "ERROR: Please check \"${1}\", \"${kerne_abi_file}\" files"
- echo ""
- exit 1
-fi
-
-ABI_TOOL_LOCATION="/usr/local/bin"
-ABI_TOOL_NAME="abi-checker"
-ABI_TOOL="${ABI_TOOL_LOCATION}/${ABI_TOOL_NAME}"
-
-if [ -x "${ABI_TOOL}" ]
-then
- CMD="${ABI_TOOL}"
-elif [ -x "./${ABI_TOOL_NAME}" ]
-then
- CMD="./${ABI_TOOL_NAME}"
-else
- CMD="${ABI_TOOL_NAME}"
-fi
-
-"${CMD}" "test-module" "${kerne_abi_file}" "${1}"
-
-exit ${?}
diff --git a/tools/abi-checker/src/abi-module-dumper b/tools/abi-checker/src/abi-module-dumper
deleted file mode 100755
index 3af55fb8b15..00000000000
--- a/tools/abi-checker/src/abi-module-dumper
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-
-echo ""
-echo "Module ABI/API fingerprint file generation"
-echo ""
-echo ""
-
-if [ "${#}" != "2" ]
-then
- echo ""
- echo "ERROR: "
- echo " Usage: ${0} _module_ko_file_ _output_file_"
- echo ""
- exit 1
-fi
-
-kerne_abi_file="/boot/abi/current"
-
-if [ ! -f "${kerne_abi_file}" ]
-then
- echo ""
- echo "ERROR: Please check ${kerne_abi_file} file"
- echo " Check if linux-kernel-uImage package is installed in development environment."
- echo ""
- exit 1
-fi
-
-if [ ! -f "${1}" ]
-then
- echo "ERROR: Please check input file ${1}"
- echo ""
- exit 1
-fi
-
-ABI_TOOL_LOCATION="/usr/local/bin"
-ABI_TOOL_NAME="abi-checker"
-ABI_TOOL="${ABI_TOOL_LOCATION}/${ABI_TOOL_NAME}"
-
-if [ -x "${ABI_TOOL}" ]
-then
- CMD="${ABI_TOOL}"
-elif [ -x "./${ABI_TOOL_NAME}" ]
-then
- CMD="./${ABI_TOOL_NAME}"
-else
- CMD="${ABI_TOOL_NAME}"
-fi
-
-"${CMD}" "dump-module" "${kerne_abi_file}" "${1}" "${2}"
-
-exit ${?}
diff --git a/tools/abi-checker/src/abi-module-kernels-list b/tools/abi-checker/src/abi-module-kernels-list
deleted file mode 100755
index e07f523bd0a..00000000000
--- a/tools/abi-checker/src/abi-module-kernels-list
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-
-echo ""
-echo "List all comatible kernels."
-echo ""
-
-if [ "${#}" != 1 ]
-then
- echo ""
- echo "ERROR: "
- echo " Usage: ${0} _module_fingerprint_"
- echo ""
- exit 1
-fi
-
-ABI_TOOL_LOCATION="/usr/local/bin"
-ABI_TOOL_NAME="abi-checker"
-ABI_TOOL="${ABI_TOOL_LOCATION}/${ABI_TOOL_NAME}"
-
-if [ -x "${ABI_TOOL}" ]
-then
- CMD="${ABI_TOOL}"
-elif [ -x "./${ABI_TOOL_NAME}" ]
-then
- CMD="./${ABI_TOOL_NAME}"
-else
- CMD="${ABI_TOOL_NAME}"
-fi
-
-#
-# Check all historical abi kernel files
-#
-for file in /boot/abi/abi_*
-do
- filename=`basename ${file}`
- version=`echo ${filename} | awk -F _ '{ print $2 }'`
- abi=`echo ${filename} | awk -F _ '{ print $3 }'`
-
- "${CMD}" "test-module" "${file}" "${1}" 2> /dev/null > /dev/null
- if [ "${?}" = "0" ]
- then
- echo " Kernel:${version}, ABI/API:${abi} .... compatible"
- fi
-done
-
diff --git a/tools/abi-checker/src/build_api_kernel_checker.sh b/tools/abi-checker/src/build_api_kernel_checker.sh
deleted file mode 100755
index 52693f8a5ff..00000000000
--- a/tools/abi-checker/src/build_api_kernel_checker.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-# Find abi_version file
-ksymver=`find ../../.. -name "Module.symvers"`
-
-ABI_TOOL_LOCATION="/usr/local/bin"
-ABI_TOOL_NAME="abi-checker"
-ABI_TOOL="${ABI_TOOL_LOCATION}/${ABI_TOOL_NAME}"
-
-if [ -x "${ABI_TOOL}" ]
-then
- CMD="${ABI_TOOL}"
-elif [ -x "./${ABI_TOOL_NAME}" ]
-then
- CMD="./${ABI_TOOL_NAME}"
-else
- CMD="${ABI_TOOL_NAME}"
-fi
-
-# compare abi fingerprint file with kernel abi file
-"${CMD}" test-kernel "${ksymver}" "../data/abi_${1}_${2}"
-rc="${?}"
-
-# Test result
-if [ ${rc} != "0" ]
-then
- echo ""
- echo "----------------------------------------------------------------------------------------------------------------------------"
- echo ""
- echo "The kernel ABI/API has changed. Please update kernel version and add a new tools/abi-checker/data/abi_VERSION_ABIVER file "
- echo "(example tools/abi-checker/data/abi_${1}_${2} )."
- echo "The kernel sources build will abort."
- echo ""
- echo ""
- exit 1
-fi
-
-exit 0
diff --git a/tools/abi-checker/src/kernel_abi_checker.c b/tools/abi-checker/src/kernel_abi_checker.c
deleted file mode 100644
index da396e135b3..00000000000
--- a/tools/abi-checker/src/kernel_abi_checker.c
+++ /dev/null
@@ -1,834 +0,0 @@
-/*
- * Build command
- *
- * gcc `pkg-config --cflags glib-2.0` kernel_abi_checker.c kernel_abi_checker_elf.c -lglib-2.0 -lelf
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <glib.h>
-
-#include "kernel_abi_checker.h"
-
-/*
- * Functions write single record into ouptu symver file
- */
-int writeKernelSymbolsFile( FILE *ptr, char *symbolNameCrc, char *symbolName, char *symbolModule, char *flag )
-{
- return fprintf( ptr, "%s\t%s\t%s\t%s\n", symbolNameCrc, symbolName, symbolModule, flag );
-}
-
-/*
- * Function open *symver file
- */
-FILE *getFile( char *fileName )
-{
- FILE *fPtr = fopen( fileName, "r" );
-
- if( fPtr == (FILE *)NULL )
- {
- PRINT_ERROR( "Canniot open : %s\n", fileName );
- return (FILE *)NULL;
- }
-
- return fPtr;
-}
-
-FILE *getOutputFile( char *fileName )
-{
- FILE *fPtr = fopen( fileName, "w" );
-
- if( fPtr == (FILE *)NULL )
- {
- PRINT_ERROR( "Canniot open : %s\n", fileName );
- return (FILE *)NULL;
- }
-
- return fPtr;
-}
-
-void releaseFile( FILE *fptr )
-{
- if( fptr != (FILE *)NULL )
- fclose( fptr );
-}
-
-void freeHashElement( gpointer data )
-{
- free( (void *)data );
-}
-
-/*
- * Function creates hash table
- */
-GHashTable *createHashTable( void )
-{
- return g_hash_table_new_full( g_str_hash, g_str_equal, NULL, freeHashElement );
-}
-
-/*
- * Function destroy hash table
- */
-void destroyHashTable( GHashTable *tab )
-{
- if( tab != (GHashTable *)NULL )
- g_hash_table_destroy( tab );
-}
-
-/*
- * Function read i mput file.
- * Function return single KernelSymbol structure.
- *
- * Return (KernelSymbol *)-1 - if errora
- (KernelSymbol *)NULL - eof
- *
- */
-
-KernelSymbol *readFileLine( FILE *fptr )
-{
- KernelSymbol *symbolPtr = (KernelSymbol *)NULL;
- char inputLine[_LINE_LENGTH_ + 1];
- char *crcPtr;
- char *symNamePtr;
- char *moduleNamePtr;
- char *flag;
- char *ptr;
- int len;
- int i;
-
- memset( inputLine, 0, sizeof( inputLine ) );
- ptr = fgets( inputLine, _LINE_LENGTH_, fptr );
- if( ptr == (char *) NULL )
- return (KernelSymbol *)NULL;
-
- i = 0;
-
- /* CRC */
- crcPtr = inputLine + i;
- for( ;inputLine[i] != '\0' && inputLine[i] != '\t' && i < _LINE_LENGTH_; i ++ );
-
- if( i >= _LINE_LENGTH_ )
- {
- PRINT_ERROR( "Incorect input record format : \"%s\"\n", inputLine );
- return (KernelSymbol *)-1;
- }
- inputLine[i] = '\0';
- i++;
-
- /* Symbol name */
- symNamePtr = inputLine + i;
-
- for( ;inputLine[i] != '\0' && inputLine[i] != '\t' && i < _LINE_LENGTH_; i ++ );
- if( i >= _LINE_LENGTH_ )
- {
- PRINT_ERROR( "Incorect input record format : \"%s\"\n", inputLine );
- return (KernelSymbol *)-1;
- }
- inputLine[i] = '\0';
- i ++;
-
- /* Module name */
- moduleNamePtr = inputLine + i;
-
-
- for( ;inputLine[i] != '\0' && inputLine[i] != '\t' && i < _LINE_LENGTH_; i ++ );
- if( i >= _LINE_LENGTH_ )
- {
- PRINT_ERROR( "Incorect input record format : \"%s\"\n", inputLine );
- return (KernelSymbol *)-1;
- }
- inputLine[i] = '\0';
- i ++;
-
- /* Flag */
- flag = inputLine + i;
-
-
- len = strlen( flag );
- flag[len == 0 ? 0 : len -1] = '\0';
-
- /* Allocate new KernelSymbol */
- symbolPtr = (KernelSymbol *)malloc( sizeof( KernelSymbol ) );
- if( symbolPtr == (KernelSymbol *)NULL )
- return (KernelSymbol *)-1;
-
- for( i = 0; moduleNamePtr[i] != '\0' && moduleNamePtr[i] != '\n'; i ++ );
- moduleNamePtr[i] = '\0';
-
- /* Polulate output structure */
- strncpy( symbolPtr -> symbolName, symNamePtr, KERNEL_SYMBOL_NAME_LENGTH );
- strncpy( symbolPtr -> symbolNameCrc, crcPtr, KERNEL_SYMBOL_NAME_CRC );
- strncpy( symbolPtr -> symbolModule, moduleNamePtr, KERNEL_SYMBOL_MODULE );
- strncpy( symbolPtr -> flag, flag, KERNEL_SYMBOL_FLAG );
- symbolPtr -> status = KERNEL_SYMBOL_STATUS_NO_TESTED;
-
- /* Return KernModule structure */
- return symbolPtr;
-}
-
-/*
- * Function adds single kernel symbol into hashtable.
- * Functions assumes that hash table is correctlly allocated.
- *
- * Returns:
- * -1 - duplicated key
- * 0 - success
- */
-
-int addKernelSymboltoHashBase( void *s, char *key, GHashTable *tab )
-{
- void *testSym;
-
- /* Check duplicates */
- testSym = (void *)g_hash_table_lookup( tab, key );
- if( testSym != (void *)NULL )
- return -1;
-
- /* Add new symbol into hash table */
- g_hash_table_insert( tab, key, s );
- return 0;
-}
-
-int addKernelSymboltoHash( KernelSymbol *s, GHashTable *tab )
-{
- return addKernelSymboltoHashBase( (void *)s, s -> symbolName, tab );
-}
-
-int readFile( FILE *fptr, GHashTable *tab )
-{
- KernelSymbol *sym = (KernelSymbol *)NULL;
- while( 1 == 1 )
- {
- sym = readFileLine( fptr );
- if( sym == (KernelSymbol *)NULL )
- {
- /* Koniec pliku */
- break;
- }
-
- if( sym == (KernelSymbol *)-1 )
- {
- /* Error */
- return -1;
- }
-
- if( addKernelSymboltoHash( sym, tab ) < 0 )
- {
- /* Error - duplicated value */
- return -1;
- }
- }
-
- /* Success */
- return 0;
-}
-
-GHashTable *procesInputFile( char *name )
-{
- GHashTable *hashTable = (GHashTable *)NULL;
- FILE *fptr = (FILE *)NULL;
-
- /* Open input file */
- fptr = getFile( name );
- if( fptr == (FILE *)NULL )
- return (GHashTable *)NULL;
-
- /* Create hash table for current symver */
- hashTable = createHashTable();
- if( hashTable == (GHashTable *)NULL )
- {
- PRINT_ERROR( "Error creating hash table \n" );
- releaseFile( fptr );
- return (GHashTable *)NULL;
- }
-
- /* Read and create current hash table */
- if( readFile( fptr, hashTable ) != 0 )
- {
- PRINT_ERROR( "Error reading %s\n", name );
- destroyHashTable( hashTable );
- releaseFile( fptr );
- return (GHashTable *)NULL;
- }
-
- /* Close input file */
- releaseFile( fptr );
-
- return hashTable;
-}
-
-typedef struct _foreachHashData_
-{
- KernelSymbolStatistics *stat;
- GHashTable *curr;
- GHashTable *new;
-} _foreachHashData_;
-
-void calculateStatistics_1( gpointer key_, gpointer value_, gpointer user_data_ )
-{
- KernelSymbol *value = (KernelSymbol *)value_;
- _foreachHashData_ *user_data = (_foreachHashData_ *)user_data_;
- KernelSymbol *newSym;
-
- /* Update current hash table symbols count */
- user_data -> stat -> symver_current_count ++;
-
- /* Search for symbol in new hash table */
- newSym = (KernelSymbol *)g_hash_table_lookup( user_data -> new, key_ );
-
- if( newSym == (KernelSymbol *)NULL )
- {
- /* Symbol was removed */
-
- /* Set status */
- value -> status = KERNEL_SYMBOL_STATUS_REMOVED;
-
- user_data -> stat -> removed_symbols_count ++;
- return;
- }
-
- newSym -> status = KERNEL_SYMBOL_STATUS_VIEWED;
-
- if( strcmp( value -> symbolNameCrc, newSym -> symbolNameCrc ) == 0 )
- {
- user_data -> stat -> no_changed_symbols_count ++;
- value -> status = KERNEL_SYMBOL_STATUS_NO_CHANGES;
- }
- else
- {
- user_data -> stat -> changed_symbols_count ++;
- value -> status = KERNEL_SYMBOL_STATUS_CHANGED;
- }
-}
-
-void calculateStatistics_2( gpointer key_, gpointer value_, gpointer user_data_ )
-{
- KernelSymbol *value = (KernelSymbol *)value_;
- _foreachHashData_ *user_data = (_foreachHashData_ *)user_data_;
-
- /* Update current hash table symbols count */
- user_data -> stat -> symver_new_count ++;
-
- if( value -> status == KERNEL_SYMBOL_STATUS_NO_TESTED )
- {
- user_data -> stat -> new_symbols_count ++;
- value -> status = KERNEL_SYMBOL_STATUS_NEW;
- }
-}
-
-void collectStatistics( GHashTable *curr, GHashTable *new, KernelSymbolStatistics *statistics )
-{
- _foreachHashData_ foreachdata;
-
- /* Init foreach data */
- memset( (void *)statistics, 0, sizeof( KernelSymbolStatistics ) );
- foreachdata.stat = statistics;
- foreachdata.curr = curr;
- foreachdata.new = new;
-
- /* Scan current hash table */
- g_hash_table_foreach( curr, calculateStatistics_1, (gpointer)&foreachdata );
-
- /* Scan new hash table */
- g_hash_table_foreach( new, calculateStatistics_2, (gpointer)&foreachdata );
-}
-
-void reportSymbolsDetails( gpointer key_, gpointer value_, gpointer user_data_ )
-{
- KernelSymbol *value = (KernelSymbol *)value_;
-
- switch( *((int *)user_data_) )
- {
- case 0 : /* New */
- if( value -> status == KERNEL_SYMBOL_STATUS_NEW )
- PRINT_INFO_RAW( "\t| NEW | %40s | %10s | %s\n", value -> symbolName, value -> symbolNameCrc, value -> symbolModule );
- break;
-
- case 1 : /* Changed */
- if( value -> status == KERNEL_SYMBOL_STATUS_CHANGED )
- PRINT_INFO_RAW( "\t| CHANGED | %40s | %10s | %s\n", value -> symbolName, value -> symbolNameCrc, value -> symbolModule );
- break;
-
- case 2 : /* Removed */
- if( value -> status == KERNEL_SYMBOL_STATUS_REMOVED )
- PRINT_INFO_RAW( "\t| REMOVED | %40s | %10s | %s\n", value -> symbolName, value -> symbolNameCrc, value -> symbolModule );
- break;
- }
-}
-//[CHANGED] cfg80211_send_rx_assoc 0x80e54114 vmlinux
-
-void listChangedSymbols( GHashTable *curr, GHashTable *new, KernelSymbolStatistics *statistics )
-{
- int mode = 0;
- int printFooter = 0;
-
- if( statistics -> new_symbols_count == 0 && statistics -> changed_symbols_count == 0 && statistics -> removed_symbols_count == 0 )
- return;
-
- PRINT_INFO_RAW( "\n" );
-
- PRINT_INFO_RAW( "\tNew symbols in kernel\n" );
- PRINT_INFO_RAW( "\t+---------+------------------------------------------+------------+--------------------------------\n" );
- PRINT_INFO_RAW( "\t| Change | Linux kernel symbol name | CRC | Module name \n" );
- PRINT_INFO_RAW( "\t+---------+------------------------------------------+------------+--------------------------------\n" );
-
- if( statistics -> new_symbols_count != 0 && new != (GHashTable *)NULL )
- {
- mode = 0;
- g_hash_table_foreach( new, reportSymbolsDetails, (gpointer)&mode );
- printFooter = 1;
- }
-
- if( statistics -> changed_symbols_count != 0 && curr != (GHashTable *)NULL )
- {
- if( statistics -> new_symbols_count != 0 )
- PRINT_INFO_RAW( "\t+---------+------------------------------------------+------------+--------------------------------\n" );
-
- mode = 1;
- g_hash_table_foreach( curr, reportSymbolsDetails, (gpointer)&mode );
- printFooter = 1;
- }
-
- if( statistics -> removed_symbols_count != 0 && curr != (GHashTable *)NULL )
- {
- if( statistics -> new_symbols_count != 0 || statistics -> changed_symbols_count != 0 )
- PRINT_INFO_RAW( "\t+---------+------------------------------------------+------------+--------------------------------\n" );
-
- mode = 2;
- g_hash_table_foreach( curr, reportSymbolsDetails, (gpointer)&mode );
- printFooter = 1;
- }
-
- if( printFooter == 1 )
- PRINT_INFO_RAW( "\t+---------+------------------------------------------+------------+--------------------------------\n" );
-}
-
-void reportsStatistics( GHashTable *curr, GHashTable *new, KernelSymbolStatistics *statistics )
-{
- listChangedSymbols( curr, new, statistics );
-
- PRINT_INFO_RAW( "\n" );
- PRINT_INFO_RAW( "\tKernel symbols version statistics \n" );
- PRINT_INFO_RAW( "\t-------------------------------------------------\n" );
- PRINT_INFO_RAW( "\tSymbols in actual kernel/module . %d\n", statistics -> symver_current_count );
- if( new != (GHashTable *)NULL )
- PRINT_INFO_RAW( "\tSymbols in new kernel/module .... %d\n", statistics -> symver_new_count );
- PRINT_INFO_RAW( "\tNew symbols ..................... %d\n", statistics -> new_symbols_count );
- PRINT_INFO_RAW( "\tRemoved symbols ................. %d\n", statistics -> removed_symbols_count );
- PRINT_INFO_RAW( "\tChanged symbols ................. %d\n", statistics -> changed_symbols_count );
- PRINT_INFO_RAW( "\tUnchanged symbols ............... %d\n", statistics -> no_changed_symbols_count );
- PRINT_INFO_RAW( "\n" );
-}
-
-void printUsage( char *progName, int type )
-{
- switch( type )
- {
- case 0 :
- PRINT_INFO_RAW( "\tUsage: %s test-kernel in_symver_file_1 in_symver_file_2\n", progName );
- break;
-
- case 1 :
- PRINT_INFO_RAW( "\tUsage: %s build-list in_module_symbols_file in_kernel_symver_file outt_module_symver_file\n", progName );
- break;
-
- case 2 :
- PRINT_INFO_RAW( "\tUsage: %s dump-module kernel_symver_file ko_module_file output_module_symver_file\n", progName );
- break;
-
- case 4 :
- PRINT_INFO_RAW( "\tUsage: %s test-module kernel_symver_file ko_module_file \n", progName );
- break;
-
- default :
- PRINT_INFO_RAW( "\tUsage: %s test|build-list file1 file2 [output_file] \n", progName );
- break;
- }
-}
-
-/*
- * Function parses input parameters and return.
- * Return:
- * -1 - error
- * 0 - test mode - the program will compare two symver files
- * 1 - build mode - for given module sybmbols file and kernel symver creates files
- * with list kernel symbols used by the module.
- */
-int parsInputParameters( int argc, char **argv, char **f1, char **f2, char **f3 )
-{
- char *toolName = argv[0];
-
- if( argc < 2 )
- {
- printUsage( toolName, -1 );
- return -1;
- }
-
- if( strcmp( argv[1], "test-kernel" ) == 0 )
- {
- /* Test mode */
- if( argc < 4 )
- {
- printUsage( toolName, 0 );
- return -1;
- }
- *f1 = argv[2];
- *f2 = argv[3];
- *f3 = (char *)NULL;
-
- return 0;
-
- }
- else
- if( strcmp( argv[1], "build-list" ) == 0 )
- {
- /* Build mode */
- if( argc < 5 )
- {
- printUsage( toolName, 1 );
- return -1;
- }
- *f1 = argv[2];
- *f2 = argv[3];
- *f3 = argv[4];
-
- return 1;
- }
- else
- if( strcmp( argv[1], "dump-module" ) == 0 )
- {
- /* Build mode */
- if( argc < 5 )
- {
- printUsage( toolName, 2 );
- return -1;
- }
- *f1 = argv[2];
- *f2 = argv[3];
- *f3 = argv[4];
-
- return 2;
- }
- else
- if( strcmp( argv[1], "usage" ) == 0 )
- {
- return 3;
- }
- else
- if( strcmp( argv[1], "test-module" ) == 0 )
- {
- /* Test mode */
- if( argc < 4 )
- {
- printUsage( toolName, 4 );
- return -1;
- }
- *f1 = argv[2];
- *f2 = argv[3];
- *f3 = (char *)NULL;
-
- return 4;
- }
-
-
- printUsage( toolName, -1 );
- return -1;
-}
-
-int testKernel( char *f1, char *f2 )
-{
- GHashTable *curr_hashTable = (GHashTable *)NULL;
- GHashTable *new_hashTable = (GHashTable *)NULL;
- KernelSymbolStatistics statistics;
-
- /*
- * ----------------------------------------------
- * Read current symver file
- * ----------------------------------------------
- */
- curr_hashTable = procesInputFile( f1 );
- if( curr_hashTable == (GHashTable *)NULL )
- {
- PRINT_ERROR( "Error read input \"%s\" file.\n", f1 );
- return 1;
- }
-
- /*
- * ----------------------------------------------
- * Read new symver file
- * ----------------------------------------------
- */
- new_hashTable = procesInputFile( f2 );
- if( new_hashTable == (GHashTable *)NULL )
- {
- destroyHashTable( curr_hashTable );
- PRINT_ERROR( "Error read input \"%s\" file.\n", f2 );
- return 1;
- }
-
- /*
- * ----------------------------------------------
- * Compute statistics
- * ----------------------------------------------
- */
- collectStatistics( curr_hashTable, new_hashTable, &statistics );
-
- /*
- * ---------------------------------------------
- * Report changes
- * ---------------------------------------------
- */
- reportsStatistics( curr_hashTable, new_hashTable, &statistics );
-
- /*
- * --------------------------------------------
- * Free hash tables
- * --------------------------------------------
- */
- destroyHashTable( curr_hashTable );
- destroyHashTable( new_hashTable );
-
- if( statistics.changed_symbols_count != 0 || statistics.removed_symbols_count != 0 || statistics.new_symbols_count != 0 )
- return 2;
-
- return 0;
-}
-
-void collectStatisticsModule( GHashTable *curr, GHashTable *module, KernelSymbolStatistics *statistics )
-{
- _foreachHashData_ foreachdata;
-
- /* Init foreach data */
- memset( (void *)statistics, 0, sizeof( KernelSymbolStatistics ) );
- foreachdata.stat = statistics;
- foreachdata.curr = module;
- foreachdata.new = curr;
-
- /* Scan current hash table */
- g_hash_table_foreach( module, calculateStatistics_1, (gpointer)&foreachdata );
-}
-
-
-int testModule( char *f1, char *f2 )
-{
- GHashTable *curr_hashTable = (GHashTable *)NULL;
- GHashTable *module_hashTable = (GHashTable *)NULL;
- KernelSymbolStatistics statistics;
-
- /*
- * ----------------------------------------------
- * Read current symver file
- * ----------------------------------------------
- */
- curr_hashTable = procesInputFile( f1 );
- if( curr_hashTable == (GHashTable *)NULL )
- {
- PRINT_ERROR( "Error read input \"%s\" file.\n", f1 );
- return 1;
- }
-
- /*
- * ----------------------------------------------
- * Read module symbols
- * ----------------------------------------------
- */
- module_hashTable = procesInputFile( f2 );
- if( module_hashTable == (GHashTable *)NULL )
- {
- destroyHashTable( curr_hashTable );
- PRINT_ERROR( "Error read input \"%s\" file.\n", f2 );
- return 1;
- }
-
- /*
- * ----------------------------------------------
- * Compute statistics
- * ----------------------------------------------
- */
- collectStatisticsModule( curr_hashTable, module_hashTable, &statistics );
-
- /*
- * ---------------------------------------------
- * Report changes
- * ---------------------------------------------
- */
- reportsStatistics( module_hashTable, (GHashTable *)NULL, &statistics );
-
- /*
- * --------------------------------------------
- * Free hash tables
- * --------------------------------------------
- */
- destroyHashTable( curr_hashTable );
- destroyHashTable( module_hashTable );
-
- if( statistics.changed_symbols_count != 0 || statistics.removed_symbols_count != 0 )
- return 2;
-
- return 0;
-}
-
-int buildListMode( char *f1, char *f2, char *f3 )
-{
- GHashTable *curr_hashTable = (GHashTable *)NULL;
- char inputLine[_LINE_LENGTH_ + 1];
- FILE *symListFptr = (FILE *)NULL;
- FILE *outFptr = (FILE *)NULL;
- KernelSymbol *kSym;
- int size;
-
- /*
- * ----------------------------------------------
- * Read current symver file
- * ----------------------------------------------
- */
- curr_hashTable = procesInputFile( f1 );
- if( curr_hashTable == (GHashTable *)NULL )
- {
- PRINT_ERROR( "Error read input \"%s\" file.\n", f1 );
- return 1;
- }
-
- /*
- * Open files
- */
- outFptr = getOutputFile( f3 );
- symListFptr = getFile( f2 );
-
- if( symListFptr == (FILE *)NULL || outFptr == (FILE *)NULL )
- {
- destroyHashTable( curr_hashTable );
- releaseFile( symListFptr );
- releaseFile( outFptr );
- PRINT_ERROR( "Error open files : \"%s\", \"%s\".\n", f2, f3 );
- return 1;
- }
-
- while( fgets( inputLine, _LINE_LENGTH_, symListFptr ) )
- {
- size = strlen( inputLine );
- inputLine[size == 0 ? 0 :size - 1] = '\0';
-
- /* Search for symbol in new hash table */
- kSym = (KernelSymbol *)g_hash_table_lookup( curr_hashTable, inputLine );
-
- if( kSym != (KernelSymbol *)NULL )
- writeKernelSymbolsFile( outFptr, kSym -> symbolNameCrc, kSym -> symbolName, kSym -> symbolModule, kSym -> flag );
- }
-
- destroyHashTable( curr_hashTable );
- releaseFile( symListFptr );
- releaseFile( outFptr );
-
- return 0;
-}
-
-int callDumpModuleSymbols( char *f1, char *f2, char *f3 )
-{
- GHashTable *curr_hashTable = (GHashTable *)NULL;
- GHashTable *module_hashTable = (GHashTable *)NULL;
-
- /*
- * ----------------------------------------------
- * Read current symver file
- * ----------------------------------------------
- */
- curr_hashTable = procesInputFile( f1 );
- if( curr_hashTable == (GHashTable *)NULL )
- {
- PRINT_ERROR( "Error read input \"%s\" file.\n", f1 );
- return 1;
- }
-
- /*
- * ----------------------------------------------
- * Read kernel module *.ko file
- * ----------------------------------------------
- */
- module_hashTable = readEfl( f2 );
- if( module_hashTable == (GHashTable *)NULL )
- {
- PRINT_ERROR( "Error read input \"%s\" file.\n", f2 );
- destroyHashTable( curr_hashTable );
- return 1;
- }
-
- /*
- * Dump module symbols into output file
- */
- if( dumpModuleSymbols( f3, module_hashTable, curr_hashTable ) < 0 )
- {
- PRINT_ERROR( "Error creating dump file \"%s\"\n", f3 );
- destroyHashTable( curr_hashTable );
- return 1;
- }
-
- /*
- * Free hash tables
- */
- destroyHashTable( module_hashTable );
- destroyHashTable( curr_hashTable );
-
- return 0;
-}
-
-int printUsageInfo( char *f1 )
-{
- PRINT_INFO_RAW( "\n" );
- PRINT_INFO_RAW( "\tProgram usage\n" );
- PRINT_INFO_RAW( "\t-----------------------------------------------\n" );
- PRINT_INFO_RAW( "\n" );
- printUsage( f1, 0 );
- printUsage( f1, 1 );
- printUsage( f1, 2 );
-
- return 0;
-}
-
-int main(int argc, char** argv)
-{
- char *f1 = (char *)NULL;
- char *f2 = (char *)NULL;
- char *f3 = (char *)NULL;
- int rc = -1;
-
- int mode = parsInputParameters( argc, argv, &f1, &f2, &f3 );
-
- switch( mode )
- {
- case 0 :
- rc = testKernel( f1, f2 );
- break;
-
- case 1 :
- rc = buildListMode( f1, f2, f3 );
- break;
-
- case 2 :
- rc = callDumpModuleSymbols( f1, f2, f3 );
- break;
-
- case 3 :
- rc = printUsageInfo( argv[0] );
- break;
-
- case 4 :
- rc = testModule( f1, f2 );
- break;
- }
-
- PRINT_INFO_RAW( "\n" );
-
- if( rc == 2 )
- PRINT_INFO_RAW( "\tChanges !!!\n" );
- else
- if( rc == 1 )
- PRINT_INFO_RAW( "\tError !!!\n" );
- else
- PRINT_INFO_RAW( "\tDone\n" );
-
- PRINT_INFO_RAW( "\n" );
-
- return ( rc != 0 ) ? 1 : 0;
-}
diff --git a/tools/abi-checker/src/kernel_abi_checker.h b/tools/abi-checker/src/kernel_abi_checker.h
deleted file mode 100644
index 8df231ee0e7..00000000000
--- a/tools/abi-checker/src/kernel_abi_checker.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef _kernel_abi_checker_h_
-#define _kernel_abi_checker_h_
-
-#include <stdio.h>
-#include <glib.h>
-
-/*
- * Definitions
- */
-#define KERNEL_SYMBOL_NAME_LENGTH 64
-#define KERNEL_SYMBOL_NAME_CRC 32
-#define KERNEL_SYMBOL_MODULE 256
-#define KERNEL_SYMBOL_FLAG 256
-
-#define KERNEL_SYMBOL_STATUS_NO_TESTED 0
-#define KERNEL_SYMBOL_STATUS_NO_CHANGES 1
-#define KERNEL_SYMBOL_STATUS_NEW 2
-#define KERNEL_SYMBOL_STATUS_REMOVED 3
-#define KERNEL_SYMBOL_STATUS_CHANGED 4
-#define KERNEL_SYMBOL_STATUS_VIEWED 5
-
-#define _LINE_LENGTH_ 4096
-
-/*
- * Data types
- */
-typedef struct KernelSymbol
-{
- char symbolName[KERNEL_SYMBOL_NAME_LENGTH + 1];
- char symbolNameCrc[KERNEL_SYMBOL_NAME_CRC + 1];
- char symbolModule[KERNEL_SYMBOL_MODULE + 1];
- char flag[KERNEL_SYMBOL_FLAG + 1];
- int status;
-
-} KernelSymbol;
-
-typedef struct KernelSymbolStatistics
-{
- int symver_current_count;
- int symver_new_count;
-
- int new_symbols_count;
- int removed_symbols_count;
- int changed_symbols_count;
- int no_changed_symbols_count;
-
-} KernelSymbolStatistics;
-
-extern int writeKernelSymbolsFile( FILE *, char *, char *, char *, char * );
-extern int addKernelSymboltoHashBase( void *, char *, GHashTable * );
-extern int dumpModuleSymbols( char *, GHashTable *, GHashTable * );
-extern void destroyHashTable( GHashTable * );
-extern GHashTable *createHashTable( void );
-extern FILE *getOutputFile( char * );
-extern void releaseFile( FILE * );
-GHashTable *readEfl( char * );
-
-#define PRINT_ERROR(...) do { fprintf( stderr, "ERROR : " ); fprintf( stderr, __VA_ARGS__ ); } while( 0 )
-#define PRINT_INFO_RAW(...) do { fprintf( stdout, __VA_ARGS__ ); } while( 0 )
-#define PRINT_INFO(...) do { fprintf( stderr, "INFO : " ); fprintf( stdout, __VA_ARGS__ ); } while( 0 )
-
-#endif
diff --git a/tools/abi-checker/src/kernel_abi_checker_elf.c b/tools/abi-checker/src/kernel_abi_checker_elf.c
deleted file mode 100644
index 6f4f28cd9a6..00000000000
--- a/tools/abi-checker/src/kernel_abi_checker_elf.c
+++ /dev/null
@@ -1,172 +0,0 @@
-#include "kernel_abi_checker.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <libelf.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <gelf.h>
-
-GHashTable *readEfl( char *file )
-{
- GHashTable *outputHashTable = (GHashTable *)NULL;
- Elf_Data *edata = (Elf_Data *)NULL;
- Elf_Scn *scn = (Elf_Scn *)NULL;
- char *base_ptr = (char *)NULL;
- char *sname = (char *)NULL;
- Elf *elf = (Elf *)NULL;
- struct stat elf_stats;
- int symbol_count;
- GElf_Shdr shdr;
- GElf_Sym sym;
- int size;
- int fd;
- int i;
-
- fd = open( file, O_RDONLY );
- if( fd < 0 )
- {
- PRINT_ERROR( "Cannot open efl file : %s\n", file );
- return (GHashTable *)NULL;
- }
-
- if( ( fstat( fd, &elf_stats ) ) )
- {
- PRINT_ERROR( "Cannot stat efl file : %s\n", file );
- close(fd );
- return (GHashTable *)NULL;
- }
-
- base_ptr = (char *) malloc( elf_stats.st_size );
- if( base_ptr == (char *)NULL )
- {
- PRINT_ERROR( "Memory allocation error.\n" );
- close( fd );
- return (GHashTable *)NULL;
- }
-
- if( ( read( fd, base_ptr, elf_stats.st_size ) ) < elf_stats.st_size )
- {
- PRINT_ERROR( "Cannot read input efl file : %s\n", file );
- free( base_ptr );
- close( fd );
- return (GHashTable *)NULL;
- }
- free( base_ptr );
-
- /* Create output hash table */
- outputHashTable = createHashTable();
- if( outputHashTable == (GHashTable *)NULL )
- {
- PRINT_ERROR( "Memory allocation for hash table error : %s\n", file );
- free( base_ptr );
- close( fd );
- return (GHashTable *)NULL;
- }
-
- if( elf_version( EV_CURRENT ) == EV_NONE )
- fprintf( stderr, "WARNING Elf Library is out of date!\n" );
-
- // Iterate through section headers again this time well stop when we find symbols
- elf = elf_begin( fd, ELF_C_READ, NULL );
-
- while( ( scn = elf_nextscn( elf, scn ) ) != (Elf_Scn *)NULL )
- {
- gelf_getshdr( scn, &shdr );
-
- // When we find a section header marked SHT_SYMTAB stop and get symbols
- if(shdr.sh_type == SHT_SYMTAB)
- {
- // edata points to our symbol table
- edata = elf_getdata(scn, edata);
-
- symbol_count = shdr.sh_size / shdr.sh_entsize;
-
- for( i = 0; i < symbol_count; i++ )
- {
- /* Get symbol */
- gelf_getsym( edata, i, &sym );
-
- /* Get symbol name length */
- size = strlen( elf_strptr( elf, shdr.sh_link, sym.st_name ) );
- if( size != 0 )
- {
- /* allocate memory for symbol name */
- sname = (char *)malloc( sizeof( char ) * ( size + 1 ) );
- if( sname == (char *)NULL )
- {
- PRINT_ERROR( "Memory allocation for hash table error : %s\n", file );
- destroyHashTable( outputHashTable );
- close( fd );
- return (GHashTable *)NULL;
- }
-
- strcpy( sname, elf_strptr( elf, shdr.sh_link, sym.st_name ) );
-
- // Add symbol to hash
- if( addKernelSymboltoHashBase( (void *)sname, sname, outputHashTable ) < 0 )
- {
- // If duplicated key free memory
- free( sname );
- }
-
- }
- }
- }
- }
-
- /* Close file */
- close( fd );
-
- /* Return hash table */
- return outputHashTable;
-}
-
-/*
- * Private user data definition.
- */
-
-typedef struct _efl_user_data_
-{
- GHashTable *kernelHash;
- FILE *outFilePtr;
-} _efl_user_data_;
-
-
-void dumpModuleSymbolsIteration( gpointer key_, gpointer value_, gpointer user_data_ )
-{
- char *key = (char *)key_;
- _efl_user_data_ *user_data = (_efl_user_data_ *)user_data_;
- KernelSymbol *ptr = (KernelSymbol *)NULL;
-
- ptr = (KernelSymbol *)g_hash_table_lookup( user_data -> kernelHash, key );
- if( ptr != (void *)NULL )
- writeKernelSymbolsFile( user_data -> outFilePtr, ptr -> symbolNameCrc, ptr -> symbolName, ptr -> symbolModule, ptr -> flag );
-}
-
-/*
- * Function dumps into output files kernel symbols that
- * are use in the module
- */
-int dumpModuleSymbols( char *outoutFile, GHashTable *moduleSymbols, GHashTable *kernelSymbols )
-{
- FILE *outputFilePtr = getOutputFile( outoutFile );
- _efl_user_data_ userData;
-
- if( outputFilePtr == (FILE *)NULL )
- return -1;
-
- userData.outFilePtr = outputFilePtr;
- userData.kernelHash = kernelSymbols;
-
- /* Loob module symbols */
- g_hash_table_foreach( moduleSymbols, dumpModuleSymbolsIteration, (gpointer)&userData );
-
- /* Close output file */
- releaseFile( outputFilePtr );
-
- return 0;
-}