[Tux3] [PATCH 1/3] Use tuxtime() to update timestamp

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <tux3@...>
Date: Tuesday, November 11, 2008 - 3:17 am

# HG changeset patch
# User OGAWA Hirofumi
# Date 1226387681 -32400
# Node ID 6b615de4d62bea052bb57474e754233f911edf1e
# Parent dab895e2e896189f1764a7ec3330b6473757138e
Use tuxtime() to update timestamp

And this moves time functions to tux3.h to use those without including
inode.c

diff -r dab895e2e896 -r 6b615de4d62b user/dir.c
--- a/user/dir.c Mon Nov 10 20:15:37 2008 -0800
+++ b/user/dir.c Tue Nov 11 16:14:41 2008 +0900
@@ -194,7 +194,7 @@
memcpy(entry->name, name, len);
entry->inum = cpu_to_le32(inum);
entry->type = ext2_type_by_mode[(mode & S_IFMT) >> STAT_SHIFT];
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = tuxtime();
mark_inode_dirty(dir);
offset = (void *)entry - buffer->data;
brelse_dirty(buffer);
diff -r dab895e2e896 -r 6b615de4d62b user/inode.c
--- a/user/inode.c Mon Nov 10 20:15:37 2008 -0800
+++ b/user/inode.c Tue Nov 11 16:14:41 2008 +0900
@@ -16,26 +16,6 @@
#define filemap_included
#include "filemap.c"
#undef main
-
-#include
-#include
-
-fixed32 tuxtime(void)
-{
- struct timeval now;
- gettimeofday(&now, NULL);
- return tuxtimeval(now.tv_sec, now.tv_usec);
-}
-
-unsigned millionths(fixed32 val)
-{
- return (((val & 0xffffffff) * 1000000) + 0x80000000) >> 32;
-}
-
-u32 high32(fixed32 val)
-{
- return val >> 32;
-}

struct inode *new_inode(SB, inum_t inum)
{
diff -r dab895e2e896 -r 6b615de4d62b user/tux3.h
--- a/user/tux3.h Mon Nov 10 20:15:37 2008 -0800
+++ b/user/tux3.h Tue Nov 11 16:14:41 2008 +0900
@@ -7,6 +7,8 @@
#include
#include
#include
+#include
+#include
#include "err.h"
#include "trace.h"
#include "buffer.h"
@@ -245,6 +247,23 @@
return ((u64)sec << 32) + ((u64)usec << 32) / 1000000;
}

+static inline fixed32 tuxtime(void)
+{
+ struct timeval now;
+ gettimeofday(&now, NULL);
+ return tuxtimeval(now.tv_sec, now.tv_usec);
+}
+
+static inline unsigned millionths(fixed32 val)
+{
+ return (((val & 0xffffffff) * 1000000) + 0x80000000) >> 32;
+}
+
+static inline u32 high32(fixed32 val)
+{
+ return val >> 32;
+}
+
struct iattr {
u64 isize, mtime, ctime, atime;
unsigned mode, uid, gid, links;

--
OGAWA Hirofumi

_______________________________________________
Tux3 mailing list
Tux3@tux3.org
http://tux3.org/cgi-bin/mailman/listinfo/tux3

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[Tux3] [PATCH 1/3] Use tuxtime() to update timestamp, OGAWA Hirofumi, (Tue Nov 11, 3:17 am)
[Tux3] Two kinds of atomic commit, Daniel Phillips, (Mon Jul 28, 1:46 am)