struct file_info /* Each file has one of these */
{
- char *name; /* Original name */
struct write_info *writes; /* Record accumulated writes to the file */
struct write_info *raw_writes;
/* Record in order all writes to the file */
if (entry->type == 'f') {
struct file_info *file = target;
- file->name = dup_string(name);
entry->file = file;
entry->next_link = file->links;
if (file->links)
/* Free struct file_info if file is not open and not linked */
if (!file->fds && !file->links) {
free_writes_info(file);
- free(file->name);
free(file);
}
unsigned int wcnt;
normsg("File Info:");
- normsg(" Original name: %s", file->name);
normsg(" Link count: %d", file->link_count);
normsg(" Links:");
entry = file->links;
}
pcv("failed to write %zu bytes to offset %llu of file %s",
block, (unsigned long long)(offset + actual),
- file->name);
+ file->links->name);
return -1;
}
remains -= written;
return 1;
} else
pcv("cannot truncate file %s to %llu",
- file->name, (unsigned long long)new_length);
+ file->links->name, (unsigned long long)new_length);
return -1;
}
free(fdi);
if (!file->link_count && !file->fds) {
free_writes_info(file);
- free(file->name);
free(file);
}
return;
/* Open file to save contents to */
strcpy(name, "/tmp/");
- strcat(name, file->name);
+ strcat(name, file->links->name);
strcat(name, ".integ.sav.read");
normsg("Saving %sn", name);
w_fd = open(name, O_CREAT | O_WRONLY, 0777);
/* Open file to save contents to */
strcpy(name, "/tmp/");
- strcat(name, file->name);
+ strcat(name, file->links->name);
strcat(name, ".integ.sav.written");
normsg("Saving %s", name);
w_fd = open(name, O_CREAT | O_WRONLY, 0777);
ret = fsync(fdi->fd);
if (ret)
pcv("fsync failed for %s",
- fdi->file->name);
+ fdi->file->links->name);
} else {
ret = fdatasync(fdi->fd);
if (ret)
pcv("fdatasync failed for %s",
- fdi->file->name);
+ fdi->file->links->name);
}
}
}