diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-07-22 03:28:05 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-07-22 17:12:45 +0200 |
commit | adc8e37d7f86d661ab54adf9c43e4b0aa67a939c (patch) | |
tree | d075abb80d7cd22935a32e20e5bfcb53acef087d /include | |
parent | c673f305ec0c2c80bc3873bcc8718d9ba85340c9 (diff) |
Add a way to optionally keep the original time stamps
First of all, this commit adds a mod_time field to a tree node. When
creating the tree node, the field is set from the struct stat. When
scanning a directory, the time stamps from the input are used if set.
Second, the libsqfs code that reads inodes is modified to store the
mod_time from the inode in the fstree node and to write the tree node
into a generated inode.
Finally, tar2sqfs is modified to optionally keep the timestamps from
the tar archive instead of setting defaults. gensquashfs is similarly
modified to keep the input timestamps if specified.
The result is as follows:
- sqfs2tar will always carry the timestamps from the squashfs over
to the tar ball.
- tar2sqfs will set defaults, unless explicitly asked to preserve
the mtime from the tar ball.
- gensquashfs can optionally preserve the mtime from the input
hierarchy it processes if only --pack-dir is specified.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r-- | include/fstree.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/fstree.h b/include/fstree.h index 4efa9d5..1b25363 100644 --- a/include/fstree.h +++ b/include/fstree.h @@ -119,6 +119,8 @@ struct tree_node_t { uint32_t uid; uint32_t gid; + uint32_t inode_num; + uint32_t mod_time; uint16_t mode; /* SquashFS inode refernce number. 32 bit offset of the meta data @@ -128,8 +130,6 @@ struct tree_node_t { Generated on the fly when writing inodes. */ uint64_t inode_ref; - uint32_t inode_num; - /* Type specific data. Pointers are into payload area blow. */ union { dir_info_t *dir; @@ -241,7 +241,7 @@ int fstree_from_file(fstree_t *fs, const char *filename, FILE *fp); Returns 0 on success, prints errors to stderr. */ -int fstree_from_dir(fstree_t *fs, const char *path); +int fstree_from_dir(fstree_t *fs, const char *path, bool keep_time_stamps); /* Add labels from an SELinux labeling file to all tree nodes. Returns 0 on success. Internally prints errors to stderr. */ |