Commit 98521b38 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf memswap: Split the byteswap memory range wrappers from util.[ch]

Just one more step into splitting util.[ch] to reduce the includes hell.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-navarr9mijkgwgbzu464dwam@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 5ab8c689
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ libperf-y += find_bit.o
libperf-y += kallsyms.o
libperf-y += levenshtein.o
libperf-y += llvm-utils.o
libperf-y += memswap.o
libperf-y += parse-events.o
libperf-y += perf_regs.o
libperf-y += path.o
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "evlist.h"
#include "evsel.h"
#include "header.h"
#include "memswap.h"
#include "../perf.h"
#include "trace-event.h"
#include "session.h"
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include "../perf.h"
#include "session.h"
#include "machine.h"
#include "memswap.h"
#include "sort.h"
#include "tool.h"
#include "event.h"
+24 −0
Original line number Diff line number Diff line
#include <byteswap.h>
#include "memswap.h"
#include <linux/types.h>

void mem_bswap_32(void *src, int byte_size)
{
	u32 *m = src;
	while (byte_size > 0) {
		*m = bswap_32(*m);
		byte_size -= sizeof(u32);
		++m;
	}
}

void mem_bswap_64(void *src, int byte_size)
{
	u64 *m = src;

	while (byte_size > 0) {
		*m = bswap_64(*m);
		byte_size -= sizeof(u64);
		++m;
	}
}
+7 −0
Original line number Diff line number Diff line
#ifndef PERF_MEMSWAP_H_
#define PERF_MEMSWAP_H_

void mem_bswap_64(void *src, int byte_size);
void mem_bswap_32(void *src, int byte_size);

#endif /* PERF_MEMSWAP_H_ */
Loading