Lines Matching refs:file
48 struct perf_data_file *file = &files[i]; in perf_data__create_dir() local
50 ret = asprintf(&file->path, "%s/data.%d", data->path, i); in perf_data__create_dir()
54 ret = open(file->path, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR); in perf_data__create_dir()
58 file->fd = ret; in perf_data__create_dir()
91 struct perf_data_file *file; in perf_data__open_dir() local
104 file = realloc(files, (nr + 1) * sizeof(*files)); in perf_data__open_dir()
105 if (!file) in perf_data__open_dir()
108 files = file; in perf_data__open_dir()
109 file = &files[nr++]; in perf_data__open_dir()
111 file->path = strdup(path); in perf_data__open_dir()
112 if (!file->path) in perf_data__open_dir()
115 ret = open(file->path, O_RDONLY); in perf_data__open_dir()
119 file->fd = ret; in perf_data__open_dir()
120 file->size = st.st_size; in perf_data__open_dir()
145 struct perf_data_file *file = &data->dir.files[i]; in perf_data__update_dir() local
148 if (fstat(file->fd, &st)) in perf_data__update_dir()
151 file->size = st.st_size; in perf_data__update_dir()
173 data->file.fd = fd; in check_pipe()
228 fd = open(data->file.path, O_RDONLY); in open_file_read()
232 pr_err("failed to open %s: %s", data->file.path, in open_file_read()
234 if (err == ENOENT && !strcmp(data->file.path, "perf.data")) in open_file_read()
245 data->file.path); in open_file_read()
251 data->file.path); in open_file_read()
255 data->file.size = st.st_size; in open_file_read()
268 fd = open(data->file.path, O_CREAT|O_RDWR|O_TRUNC|O_CLOEXEC, in open_file_write()
272 pr_err("failed to open %s : %s\n", data->file.path, in open_file_write()
286 zfree(&data->file.path); in open_file()
290 data->file.fd = fd; in open_file()
296 data->file.path = strdup(data->path); in open_file_dup()
297 if (!data->file.path) in open_file_dup()
311 if (asprintf(&data->file.path, "%s/header", data->path) < 0) in open_dir()
350 zfree(&data->file.path); in perf_data__close()
351 close(data->file.fd); in perf_data__close()
354 ssize_t perf_data_file__write(struct perf_data_file *file, in perf_data_file__write() argument
357 return writen(file->fd, buf, size); in perf_data_file__write()
363 return perf_data_file__write(&data->file, buf, size); in perf_data__write()
389 close(data->file.fd); in perf_data__switch()
394 if (lseek(data->file.fd, pos, SEEK_SET) == (off_t)-1) { in perf_data__switch()
401 ret = data->file.fd; in perf_data__switch()
408 u64 size = data->file.size; in perf_data__size()
415 struct perf_data_file *file = &data->dir.files[i]; in perf_data__size() local
417 size += file->size; in perf_data__size()