#include "wimlib/dentry.h"
#include "wimlib/encoding.h"
+#include "wimlib/lookup_table.h"
#include "wimlib/metadata.h"
#include "wimlib/paths.h"
#include "wimlib/progress.h"
int lookup_flags,
struct wim_dentry **dentry_ret,
struct wim_lookup_table_entry **lte_ret,
- u16 *stream_idx_ret)
+ unsigned *stream_idx_ret)
{
WIMStruct *wim = ctx->wim;
struct wim_dentry *dentry;
struct wim_lookup_table_entry *lte;
- u16 stream_idx;
+ unsigned stream_idx;
const char *stream_name = NULL;
struct wim_inode *inode;
char *p = NULL;
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;
}
*/
static int
extract_resource_to_staging_dir(struct wim_inode *inode,
- u16 stream_idx,
+ unsigned stream_idx,
struct wim_lookup_table_entry **lte_ptr,
off_t size,
const struct wimfs_context *ctx)
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)
struct wim_dentry *dentry;
struct wim_inode *inode;
struct wim_lookup_table_entry *lte;
- u16 stream_idx;
+ unsigned stream_idx;
struct wimfs_fd *fd;
int ret;
const struct wimfs_context *ctx = wimfs_get_context();
struct wim_dentry *dentry;
struct wim_lookup_table_entry *lte;
- u16 stream_idx;
+ unsigned stream_idx;
int ret;
int fd;
{
const struct wimfs_context *ctx = wimfs_get_context();
struct wim_dentry *dentry;
- u16 stream_idx;
+ unsigned stream_idx;
int ret;
ret = wim_pathname_to_stream(ctx, path, 0, &dentry, NULL, &stream_idx);
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 */
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);
}