@@ -179,8 +179,8 @@ struct tracecmd_ftrace {
};
struct tracecmd_proc_addr_map {
- unsigned long long start;
- unsigned long long end;
+ size_t start;
+ size_t end;
char *lib_name;
};
@@ -252,7 +252,7 @@ tracecmd_set_all_cpus_to_timestamp(struct tracecmd_input *handle,
unsigned long long time);
int tracecmd_set_cursor(struct tracecmd_input *handle,
- int cpu, unsigned long long offset);
+ int cpu, size_t offset);
unsigned long long
tracecmd_get_cursor(struct tracecmd_input *handle, int cpu);
@@ -339,7 +339,7 @@ int tracecmd_append_buffer_cpu_data(struct tracecmd_output *handle,
const char *name, int cpus, char * const *cpu_data_files);
struct tracecmd_output *tracecmd_get_output_handle_fd(int fd);
unsigned long tracecmd_get_out_file_version(struct tracecmd_output *handle);
-unsigned long long tracecmd_get_out_file_offset(struct tracecmd_output *handle);
+size_t tracecmd_get_out_file_offset(struct tracecmd_output *handle);
/* --- Reading the Fly Recorder Trace --- */
@@ -550,10 +550,10 @@ void tracecmd_compress_destroy(struct tracecmd_compression *handle);
int tracecmd_compress_block(struct tracecmd_compression *handle);
int tracecmd_uncompress_block(struct tracecmd_compression *handle);
void tracecmd_compress_reset(struct tracecmd_compression *handle);
-int tracecmd_compress_buffer_read(struct tracecmd_compression *handle, char *dst, int len);
-int tracecmd_compress_pread(struct tracecmd_compression *handle, char *dst, int len, off_t offset);
+ssize_t tracecmd_compress_buffer_read(struct tracecmd_compression *handle, char *dst, size_t len);
+ssize_t tracecmd_compress_pread(struct tracecmd_compression *handle, char *dst, size_t len, off_t offset);
int tracecmd_compress_buffer_write(struct tracecmd_compression *handle,
- const void *data, unsigned long long size);
+ const void *data, size_t size);
off_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off_t offset, int whence);
int tracecmd_compress_proto_get_name(struct tracecmd_compression *compress,
const char **name, const char **version);
@@ -561,9 +561,9 @@ bool tracecmd_compress_is_supported(const char *name, const char *version);
int tracecmd_compress_protos_get(char ***names, char ***versions);
int tracecmd_compress_proto_register(struct tracecmd_compression_proto *proto);
int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int chunk_size,
- unsigned long long *read_size, unsigned long long *write_size);
+ size_t *read_size, size_t *write_size);
int tracecmd_uncompress_copy_to(struct tracecmd_compression *handle, int fd,
- unsigned long long *read_size, unsigned long long *write_size);
+ size_t *read_size, size_t *write_size);
int tracecmd_uncompress_chunk(struct tracecmd_compression *handle,
struct tracecmd_compress_chunk *chunk, char *data);
int tracecmd_load_chunks_info(struct tracecmd_compression *handle,
@@ -93,7 +93,7 @@ out_add_buffer_option(struct tracecmd_output *handle, const char *name,
struct cpu_data_source {
int fd;
- int size;
+ ssize_t size;
off_t offset;
};
@@ -30,9 +30,9 @@ static struct compress_proto *proto_list;
struct tracecmd_compression {
int fd;
- unsigned int capacity;
- unsigned int capacity_read;
- unsigned int pointer;
+ size_t capacity;
+ size_t capacity_read;
+ size_t pointer;
char *buffer;
struct compress_proto *proto;
struct tep_handle *tep;
@@ -40,10 +40,10 @@ struct tracecmd_compression {
void *context;
};
-static int read_fd(int fd, char *dst, int len)
+static ssize_t read_fd(int fd, char *dst, int len)
{
size_t size = 0;
- int r;
+ ssize_t r;
do {
r = read(fd, dst+size, len);
@@ -59,10 +59,10 @@ static int read_fd(int fd, char *dst, int len)
return size;
}
-static long long write_fd(int fd, const void *data, size_t size)
+static ssize_t write_fd(int fd, const void *data, size_t size)
{
- long long tot = 0;
- long long w;
+ ssize_t tot = 0;
+ ssize_t w;
do {
w = write(fd, data + tot, size - tot);
@@ -77,8 +77,8 @@ static long long write_fd(int fd, const void *data, size_t size)
return tot;
}
-static long long do_write(struct tracecmd_compression *handle,
- const void *data, unsigned long long size)
+static ssize_t do_write(struct tracecmd_compression *handle,
+ const void *data, size_t size)
{
int ret;
@@ -91,9 +91,9 @@ static long long do_write(struct tracecmd_compression *handle,
return write_fd(handle->fd, data, size);
}
-static inline int buffer_extend(struct tracecmd_compression *handle, unsigned int size)
+static inline int buffer_extend(struct tracecmd_compression *handle, size_t size)
{
- int extend;
+ ssize_t extend;
char *buf;
if (size <= handle->capacity)
@@ -146,7 +146,7 @@ off_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off_t offset,
return p;
}
-static int compress_read(struct tracecmd_compression *handle, char *dst, int len)
+static ssize_t compress_read(struct tracecmd_compression *handle, char *dst, size_t len)
{
if (handle->pointer > handle->capacity_read)
@@ -172,9 +172,9 @@ static int compress_read(struct tracecmd_compression *handle, char *dst, int len
*
* On success returns the number of bytes read, or -1 on failure.
*/
-int tracecmd_compress_pread(struct tracecmd_compression *handle, char *dst, int len, off_t offset)
+ssize_t tracecmd_compress_pread(struct tracecmd_compression *handle, char *dst, size_t len, off_t offset)
{
- int ret;
+ ssize_t ret;
if (!handle || !handle->buffer || offset > handle->capacity_read)
return -1;
@@ -195,9 +195,9 @@ int tracecmd_compress_pread(struct tracecmd_compression *handle, char *dst, int
*
* On success returns the number of bytes read, or -1 on failure.
*/
-int tracecmd_compress_buffer_read(struct tracecmd_compression *handle, char *dst, int len)
+ssize_t tracecmd_compress_buffer_read(struct tracecmd_compression *handle, char *dst, size_t len)
{
- int ret;
+ ssize_t ret;
if (!handle || !handle->buffer)
return -1;
@@ -363,7 +363,7 @@ out:
* Returns 0 on success, or -1 on failure.
*/
int tracecmd_compress_buffer_write(struct tracecmd_compression *handle,
- const void *data, unsigned long long size)
+ const void *data, size_t size)
{
if (!handle)
return -1;
@@ -667,16 +667,16 @@ error:
* read and written data.
*/
int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int chunk_size,
- unsigned long long *read_size, unsigned long long *write_size)
+ size_t *read_size, size_t *write_size)
{
- unsigned int rchunk = 0;
- unsigned int chunks = 0;
- unsigned int rsize = 0;
- unsigned int rmax = 0;
- unsigned int csize;
- unsigned int size;
- unsigned int all;
- unsigned int r;
+ size_t rchunk = 0;
+ size_t chunks = 0;
+ size_t rsize = 0;
+ size_t rmax = 0;
+ size_t csize;
+ size_t size;
+ size_t all;
+ size_t r;
off_t end_offset;
off_t offset;
char *buf_from;
@@ -795,7 +795,7 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle,
struct tracecmd_compress_chunk **chunks_info)
{
struct tracecmd_compress_chunk *chunks = NULL;
- unsigned long long size = 0;
+ size_t size = 0;
unsigned int count = 0;
off_t offset;
int ret = -1;
@@ -913,12 +913,12 @@ out:
* the size of read and written data.
*/
int tracecmd_uncompress_copy_to(struct tracecmd_compression *handle, int fd,
- unsigned long long *read_size, unsigned long long *write_size)
+ size_t *read_size, size_t *write_size)
{
- unsigned int s_uncompressed;
- unsigned int s_compressed;
- unsigned int rsize = 0;
- unsigned int wsize = 0;
+ size_t s_uncompressed;
+ size_t s_compressed;
+ size_t rsize = 0;
+ size_t wsize = 0;
char *bytes_out = NULL;
char *bytes_in = NULL;
int size_out = 0;
@@ -2342,8 +2342,7 @@ tracecmd_set_all_cpus_to_timestamp(struct tracecmd_input *handle,
* Now the next tracecmd_peek_data or tracecmd_read_data will return
* the original record.
*/
-int tracecmd_set_cursor(struct tracecmd_input *handle,
- int cpu, unsigned long long offset)
+int tracecmd_set_cursor(struct tracecmd_input *handle, int cpu, size_t offset)
{
struct cpu_data *cpu_data = &handle->cpu_data[cpu];
unsigned long long page_offset;
@@ -3304,8 +3303,8 @@ tracecmd_read_prev(struct tracecmd_input *handle, struct tep_record *record)
static int init_cpu_zfile(struct tracecmd_input *handle, int cpu)
{
struct cpu_data *cpu_data;
- unsigned long long size;
off_t offset;
+ size_t size;
cpu_data = &handle->cpu_data[cpu];
offset = lseek(handle->fd, 0, SEEK_CUR);
@@ -3740,7 +3739,7 @@ static int trace_pid_map_load(struct tracecmd_input *handle, char *buf)
*line = '\0';
if (strlen(buf) > STR_PROCMAP_LINE_MAX)
break;
- res = sscanf(buf, "%llx %llx %s", &maps->lib_maps[i].start,
+ res = sscanf(buf, "%zx %zx %s", &maps->lib_maps[i].start,
&maps->lib_maps[i].end, mapname);
if (res != 3)
break;
@@ -4353,7 +4352,7 @@ static int init_cpu_data(struct tracecmd_input *handle)
int init_latency_data(struct tracecmd_input *handle)
{
- unsigned long long wsize;
+ size_t wsize;
int ret;
if (!handle->cpu_compressed)
@@ -391,9 +391,9 @@ __hidden unsigned long long out_copy_fd_compress(struct tracecmd_output *handle,
unsigned long long *write_size,
int page)
{
- unsigned long long rsize = 0;
- unsigned long long wsize = 0;
- unsigned long long size;
+ size_t rsize = 0;
+ size_t wsize = 0;
+ size_t size;
int ret;
if (handle->compress) {
@@ -3019,7 +3019,7 @@ unsigned long tracecmd_get_out_file_version(struct tracecmd_output *handle)
return handle->file_version;
}
-unsigned long long tracecmd_get_out_file_offset(struct tracecmd_output *handle)
+size_t tracecmd_get_out_file_offset(struct tracecmd_output *handle)
{
return do_lseek(handle, 0, SEEK_CUR);
}
@@ -4407,7 +4407,7 @@ add_pid_maps(struct tracecmd_output *handle, struct buffer_instance *instance)
trace_seq_printf(&s, "%x %x %s\n",
maps->pid, maps->nr_lib_maps, maps->proc_name);
for (i = 0; i < maps->nr_lib_maps; i++)
- trace_seq_printf(&s, "%llx %llx %s\n",
+ trace_seq_printf(&s, "%zx %zx %s\n",
maps->lib_maps[i].start,
maps->lib_maps[i].end,
maps->lib_maps[i].lib_name);