* [Ocfs2-devel] [PATCH] fix OCFS_FE_SET_ATTRIBUTES mess
@ 2004-06-02 13:10 Christoph Hellwig
0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2004-06-02 13:10 UTC (permalink / raw)
To: ocfs2-devel
Index: src/file.c
===================================================================
--- src/file.c (revision 969)
+++ src/file.c (working copy)
@@ -42,39 +42,27 @@
static int ocfs_truncate_file (ocfs_super * osb, __u64 file_off, __u64 file_size, struct inode *inode);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-#define OCFS_FE_SET_ATTRIBUTES(fe, attr) \
-do { \
- if (attr->ia_valid & ATTR_SIZE) \
- fe->file_size = attr->ia_size; \
- if (attr->ia_valid & ATTR_UID) \
- fe->uid = attr->ia_uid; \
- if (attr->ia_valid & ATTR_GID) \
- fe->gid = attr->ia_gid; \
- if (attr->ia_valid & ATTR_MODE) \
- fe->prot_bits = attr->ia_mode & 0007777; \
- if (attr->ia_valid & ATTR_CTIME) \
- fe->create_time = attr->ia_ctime.tv_sec; \
- if (attr->ia_valid & ATTR_MTIME) \
- fe->modify_time = attr->ia_mtime.tv_sec; \
-} while (0)
-#else /* 2.4 kernel */
-#define OCFS_FE_SET_ATTRIBUTES(fe, attr) \
-do { \
- if (attr->ia_valid & ATTR_SIZE) \
- fe->file_size = attr->ia_size; \
- if (attr->ia_valid & ATTR_UID) \
- fe->uid = attr->ia_uid; \
- if (attr->ia_valid & ATTR_GID) \
- fe->gid = attr->ia_gid; \
- if (attr->ia_valid & ATTR_MODE) \
- fe->prot_bits = attr->ia_mode & 0007777; \
- if (attr->ia_valid & ATTR_CTIME) \
- fe->create_time = attr->ia_ctime; \
- if (attr->ia_valid & ATTR_MTIME) \
- fe->modify_time = attr->ia_mtime; \
-} while (0)
+#define ocfs_get_seconds(t) (t).tv_sec
+#else
+#define ocfs_get_seconds(t) (t)
#endif
+static void ocfs_fe_set_attributes(ocfs_file_entry *fe, struct iattr *attr)
+{
+ if (attr->ia_valid & ATTR_SIZE)
+ fe->file_size = attr->ia_size;
+ if (attr->ia_valid & ATTR_UID)
+ fe->uid = attr->ia_uid;
+ if (attr->ia_valid & ATTR_GID)
+ fe->gid = attr->ia_gid;
+ if (attr->ia_valid & ATTR_MODE)
+ fe->prot_bits = attr->ia_mode & 0007777;
+ if (attr->ia_valid & ATTR_CTIME)
+ fe->create_time = ocfs_get_seconds(attr->ia_ctime);
+ if (attr->ia_valid & ATTR_MTIME)
+ fe->modify_time = ocfs_get_seconds(attr->ia_mtime);
+}
+
static inline int ocfs_sync_inode(struct inode *inode)
{
int status;
@@ -659,7 +647,7 @@
fileEntry->modify_time = OCFS_CURRENT_TIME;
DISK_LOCK_SEQNUM (fileEntry) = 0;
- OCFS_FE_SET_ATTRIBUTES(fileEntry, attr);
+ ocfs_fe_set_attributes(fileEntry, attr);
/* Set the valid bit here */
SET_VALID_BIT (fileEntry->sync_flags);
@@ -1287,7 +1275,7 @@
LOG_TRACE_ARGS("fileEntry->alloc_size = %llu\n", fileEntry->alloc_size);
if (attr)
- OCFS_FE_SET_ATTRIBUTES(fileEntry, attr);
+ ocfs_fe_set_attributes(fileEntry, attr);
/* Set the Valid bit and reset the change bit here... TODO */
SET_VALID_BIT (fileEntry->sync_flags);
fileEntry->sync_flags &= ~(OCFS_SYNC_FLAG_CHANGE);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-06-02 13:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-02 13:10 [Ocfs2-devel] [PATCH] fix OCFS_FE_SET_ATTRIBUTES mess Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.