X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=inode.c;fp=inode.c;h=aa822b76736ddb58bddbdc09302504dad47ac232;hb=19f316a185dc3d2a67fc3d3546f3989e45559d7c;hp=95afc0a9cf7916da1352c64244fc2b501ed8deb2;hpb=f48181d57295355b68dffdd8fad5729bf952ba7a;p=bluesky.git diff --git a/inode.c b/inode.c index 95afc0a..aa822b7 100644 --- a/inode.c +++ b/inode.c @@ -24,6 +24,18 @@ int64_t bluesky_get_current_time() return (int64_t)t.tv_sec * 1000000 + t.tv_usec; } +/* Update an inode to indicate that a modification was made. This increases + * the change counter, updates the ctime to the current time, and optionally + * updates the mtime. */ +void bluesky_inode_update_ctime(BlueSkyInode *inode, gboolean update_mtime) +{ + int64_t now = bluesky_get_current_time(); + inode->change_count++; + inode->ctime = now; + if (update_mtime) + inode->mtime = now; +} + /* Unfortunately a glib hash table is only guaranteed to be able to store * 32-bit keys if we use the key directly. If we want 64-bit inode numbers, * we'll have to allocate memory to store the 64-bit inumber, and use a pointer @@ -85,6 +97,7 @@ BlueSkyInode *bluesky_new_inode(uint64_t inum, BlueSkyFileType type) break; case BLUESKY_DIRECTORY: i->dirents = g_sequence_new(bluesky_dirent_destroy); + i->dirhash = g_hash_table_new(g_str_hash, g_str_equal); break; case BLUESKY_BLOCK: case BLUESKY_CHARACTER: