From c93fa154d508d8dd7e9f37239202479d4c414e81 Mon Sep 17 00:00:00 2001 From: Vreixo Formoso Date: Thu, 6 Dec 2007 22:52:01 +0100 Subject: [PATCH] Getters and setters for time attributes on IsoNode. --- src/libisofs.h | 30 ++++++++++++++++++++++++++++++ src/node.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/src/libisofs.h b/src/libisofs.h index c3df03e..e0ba2d0 100644 --- a/src/libisofs.h +++ b/src/libisofs.h @@ -253,6 +253,36 @@ void iso_node_set_gid(IsoNode *node, gid_t gid); */ gid_t iso_node_get_gid(const IsoNode *node); +/** + * Set the time of last modification of the file + */ +void iso_node_set_mtime(IsoNode *node, time_t time); + +/** + * Get the time of last modification of the file + */ +time_t iso_node_get_mtime(const IsoNode *node); + +/** + * Set the time of last access to the file + */ +void iso_node_set_atime(IsoNode *node, time_t time); + +/** + * Get the time of last access to the file + */ +time_t iso_node_get_atime(const IsoNode *node); + +/** + * Set the time of last status change of the file + */ +void iso_node_set_ctime(IsoNode *node, time_t time); + +/** + * Get the time of last status change of the file + */ +time_t iso_node_get_ctime(const IsoNode *node); + /** * Add a new node to a dir. Note that this function don't add a new ref to * the node, so you don't need to free it, it will be automatically freed diff --git a/src/node.c b/src/node.c index 7b5d2b8..d3f7298 100644 --- a/src/node.c +++ b/src/node.c @@ -173,6 +173,54 @@ gid_t iso_node_get_gid(const IsoNode *node) return node->gid; } +/** + * Set the time of last modification of the file + */ +void iso_node_set_mtime(IsoNode *node, time_t time) +{ + node->mtime = time; +} + +/** + * Get the time of last modification of the file + */ +time_t iso_node_get_mtime(const IsoNode *node) +{ + return node->mtime; +} + +/** + * Set the time of last access to the file + */ +void iso_node_set_atime(IsoNode *node, time_t time) +{ + node->atime = time; +} + +/** + * Get the time of last access to the file + */ +time_t iso_node_get_atime(const IsoNode *node) +{ + return node->atime; +} + +/** + * Set the time of last status change of the file + */ +void iso_node_set_ctime(IsoNode *node, time_t time) +{ + node->ctime = time; +} + +/** + * Get the time of last status change of the file + */ +time_t iso_node_get_ctime(const IsoNode *node) +{ + return node->ctime; +} + /** * Add a new node to a dir. Note that this function don't add a new ref to * the node, so you don't need to free it, it will be automatically freed