mirror of https://gitee.com/openkylin/linux.git
perf dso: Separate generic code in dso__data_file_size()
Moving file specific code in dso__data_file_size function into separate file_size function. I'll add bpf specific code in following patches. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stanislav Fomichev <sdf@google.com> Link: http://lkml.kernel.org/r/20190508132010.14512-2-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
7cb10a08df
commit
5523769ee1
|
@ -898,18 +898,12 @@ static ssize_t cached_read(struct dso *dso, struct machine *machine,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dso__data_file_size(struct dso *dso, struct machine *machine)
|
static int file_size(struct dso *dso, struct machine *machine)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char sbuf[STRERR_BUFSIZE];
|
char sbuf[STRERR_BUFSIZE];
|
||||||
|
|
||||||
if (dso->data.file_size)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (dso->data.status == DSO_DATA_STATUS_ERROR)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
pthread_mutex_lock(&dso__data_open_lock);
|
pthread_mutex_lock(&dso__data_open_lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -938,6 +932,17 @@ int dso__data_file_size(struct dso *dso, struct machine *machine)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int dso__data_file_size(struct dso *dso, struct machine *machine)
|
||||||
|
{
|
||||||
|
if (dso->data.file_size)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (dso->data.status == DSO_DATA_STATUS_ERROR)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return file_size(dso, machine);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dso__data_size - Return dso data size
|
* dso__data_size - Return dso data size
|
||||||
* @dso: dso object
|
* @dso: dso object
|
||||||
|
|
Loading…
Reference in New Issue