[Tux3] [PATCH 1/3] Use tuxtime() to update timestamp
OGAWA Hirofumi
hirofumi at mail.parknet.co.jp
Mon Nov 10 21:34:22 PST 2008
# HG changeset patch
# User OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>
# Date 1226380667 -32400
# Node ID 24f3b0f20899b2c5ad5554b7512f647f75c5d3be
# 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 24f3b0f20899 user/dir.c
--- a/user/dir.c Mon Nov 10 20:15:37 2008 -0800
+++ b/user/dir.c Tue Nov 11 14:17:47 2008 +0900
@@ -194,7 +194,11 @@
memcpy(entry->name, name, len);
entry->inum = cpu_to_le32(inum);
entry->type = ext2_type_by_mode[(mode & S_IFMT) >> STAT_SHIFT];
+#ifdef main
+ dir->i_mtime = dir->i_ctime = tuxtime();
+#else
dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+#endif
mark_inode_dirty(dir);
offset = (void *)entry - buffer->data;
brelse_dirty(buffer);
diff -r dab895e2e896 -r 24f3b0f20899 user/inode.c
--- a/user/inode.c Mon Nov 10 20:15:37 2008 -0800
+++ b/user/inode.c Tue Nov 11 14:17:47 2008 +0900
@@ -16,26 +16,6 @@
#define filemap_included
#include "filemap.c"
#undef main
-
-#include <sys/time.h>
-#include <time.h>
-
-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 24f3b0f20899 user/tux3.h
--- a/user/tux3.h Mon Nov 10 20:15:37 2008 -0800
+++ b/user/tux3.h Tue Nov 11 14:17:47 2008 +0900
@@ -7,6 +7,8 @@
#include <string.h>
#include <inttypes.h>
#include <byteswap.h>
+#include <sys/time.h>
+#include <time.h>
#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 <hirofumi at mail.parknet.co.jp>
_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://tux3.org/cgi-bin/mailman/listinfo/tux3
More information about the Tux3
mailing list