stbuf->st_mtim = wim_timestamp_to_timespec(inode->i_last_write_time);
stbuf->st_ctim = stbuf->st_mtim;
#else
- stbuf->st_atime = wim_timestamp_to_unix(inode->i_last_access_time);
- stbuf->st_mtime = wim_timestamp_to_unix(inode->i_last_write_time);
+ stbuf->st_atime = wim_timestamp_to_time_t(inode->i_last_access_time);
+ stbuf->st_mtime = wim_timestamp_to_time_t(inode->i_last_write_time);
stbuf->st_ctime = stbuf->st_mtime;
#endif
- stbuf->st_blocks = (stbuf->st_size + 511) / 512;
+ stbuf->st_blocks = DIV_ROUND_UP(stbuf->st_size, 512);
return 0;
}
static void
touch_inode(struct wim_inode *inode)
{
- u64 now = get_wim_timestamp();
+ u64 now = now_as_wim_timestamp();
inode->i_last_access_time = now;
inode->i_last_write_time = now;
}
return wimlib_overwrite(ctx->wim, write_flags, 0);
}
-/* In the case of an allow_other mount, only the owner and root should be
+/* In the case of an allow_other mount, only the mount owner and root are
* allowed to unmount the filesystem. */
static bool
may_unmount_wimfs(void)
if (tv[0].tv_nsec != UTIME_OMIT) {
if (tv[0].tv_nsec == UTIME_NOW)
- inode->i_last_access_time = get_wim_timestamp();
+ inode->i_last_access_time = now_as_wim_timestamp();
else
- inode->i_last_access_time = timespec_to_wim_timestamp(tv[0]);
+ inode->i_last_access_time = timespec_to_wim_timestamp(&tv[0]);
}
if (tv[1].tv_nsec != UTIME_OMIT) {
if (tv[1].tv_nsec == UTIME_NOW)
- inode->i_last_write_time = get_wim_timestamp();
+ inode->i_last_write_time = now_as_wim_timestamp();
else
- inode->i_last_write_time = timespec_to_wim_timestamp(tv[1]);
+ inode->i_last_write_time = timespec_to_wim_timestamp(&tv[1]);
}
return 0;
}
if (!inode)
return -errno;
- inode->i_last_access_time = unix_timestamp_to_wim(times->actime);
- inode->i_last_write_time = unix_timestamp_to_wim(times->modtime);
+ inode->i_last_access_time = time_t_to_wim_timestamp(times->actime);
+ inode->i_last_write_time = time_t_to_wim_timestamp(times->modtime);
return 0;
}
#endif /* !HAVE_UTIMENSAT */
if (mount_flags & WIMLIB_MOUNT_FLAG_READWRITE) {
if (!wim->filename)
return WIMLIB_ERR_NO_FILENAME;
- ret = can_delete_from_wim(wim);
+ ret = can_modify_wim(wim);
if (ret)
return ret;
}
ret = do_unmount(dir);
if (progfunc) {
/* Terminate the progress thread. */
- char empty[0];
+ char empty[1];
mq_send(mq, empty, 0, 1);
pthread_join(commit_progress_tid, NULL);
}