@@ -64,14 +64,14 @@ struct inode *simplefs_iget(struct super_block *sb, unsigned long ino)
6464 i_gid_write (inode , le32_to_cpu (cinode -> i_gid ));
6565 inode -> i_size = le32_to_cpu (cinode -> i_size );
6666
67- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
67+ #if SIMPLEFS_AT_LEAST (6 , 6 , 0 )
6868 inode_set_ctime (inode , (time64_t ) le32_to_cpu (cinode -> i_ctime ), 0 );
6969#else
7070 inode -> i_ctime .tv_sec = (time64_t ) le32_to_cpu (cinode -> i_ctime );
7171 inode -> i_ctime .tv_nsec = 0 ;
7272#endif
7373
74- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
74+ #if SIMPLEFS_AT_LEAST (6 , 7 , 0 )
7575 inode_set_atime (inode , (time64_t ) le32_to_cpu (cinode -> i_atime ), 0 );
7676 inode_set_mtime (inode , (time64_t ) le32_to_cpu (cinode -> i_mtime ), 0 );
7777#else
@@ -175,7 +175,7 @@ static struct dentry *simplefs_lookup(struct inode *dir,
175175 brelse (bh );
176176
177177 /* Update directory access time */
178- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
178+ #if SIMPLEFS_AT_LEAST (6 , 7 , 0 )
179179 inode_set_atime_to_ts (dir , current_time (dir ));
180180#else
181181 dir -> i_atime = current_time (dir );
@@ -209,10 +209,8 @@ static struct inode *simplefs_new_inode(struct inode *dir, mode_t mode)
209209 uint32_t ino , bno ;
210210 int ret ;
211211
212- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
213- #if LINUX_VERSION_CODE <= KERNEL_VERSION (6 , 7 , 0 )
212+ #if SIMPLEFS_AT_LEAST (6 , 6 , 0 ) && SIMPLEFS_LESS_EQUAL (6 , 7 , 0 )
214213 struct timespec64 cur_time ;
215- #endif
216214#endif
217215
218216 /* Check mode before doing anything to avoid undoing everything */
@@ -250,9 +248,9 @@ static struct inode *simplefs_new_inode(struct inode *dir, mode_t mode)
250248#endif
251249 set_nlink (inode , 1 );
252250
253- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
251+ #if SIMPLEFS_AT_LEAST (6 , 7 , 0 )
254252 simple_inode_init_ts (inode );
255- #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
253+ #elif SIMPLEFS_AT_LEAST (6 , 6 , 0 )
256254 cur_time = current_time (inode );
257255 inode -> i_atime = inode -> i_mtime = cur_time ;
258256 inode_set_ctime_to_ts (inode , cur_time );
@@ -294,9 +292,9 @@ static struct inode *simplefs_new_inode(struct inode *dir, mode_t mode)
294292 set_nlink (inode , 1 );
295293 }
296294
297- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
295+ #if SIMPLEFS_AT_LEAST (6 , 7 , 0 )
298296 simple_inode_init_ts (inode );
299- #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
297+ #elif SIMPLEFS_AT_LEAST (6 , 6 , 0 )
300298 cur_time = current_time (inode );
301299 inode -> i_atime = inode -> i_mtime = cur_time ;
302300 inode_set_ctime_to_ts (inode , cur_time );
@@ -347,10 +345,8 @@ static int simplefs_create(struct inode *dir,
347345 char * fblock ;
348346 struct buffer_head * bh , * bh2 ;
349347
350- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
351- #if LINUX_VERSION_CODE <= KERNEL_VERSION (6 , 7 , 0 )
348+ #if SIMPLEFS_AT_LEAST (6 , 6 , 0 ) && SIMPLEFS_LESS_EQUAL (6 , 7 , 0 )
352349 struct timespec64 cur_time ;
353- #endif
354350#endif
355351 int ret = 0 , alloc = false, bno = 0 ;
356352 int ei = 0 , bi = 0 , fi = 0 ;
@@ -431,9 +427,9 @@ static int simplefs_create(struct inode *dir,
431427 /* Update stats and mark dir and new inode dirty */
432428 mark_inode_dirty (inode );
433429
434- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
430+ #if SIMPLEFS_AT_LEAST (6 , 7 , 0 )
435431 simple_inode_init_ts (dir );
436- #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
432+ #elif SIMPLEFS_AT_LEAST (6 , 6 , 0 )
437433 cur_time = current_time (dir );
438434 dir -> i_mtime = dir -> i_atime = cur_time ;
439435 inode_set_ctime_to_ts (dir , cur_time );
@@ -558,10 +554,8 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
558554 struct inode * inode = d_inode (dentry );
559555 struct buffer_head * bh = NULL , * bh2 = NULL ;
560556 struct simplefs_file_ei_block * file_block = NULL ;
561- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
562- #if LINUX_VERSION_CODE <= KERNEL_VERSION (6 , 7 , 0 )
557+ #if SIMPLEFS_AT_LEAST (6 , 6 , 0 ) && SIMPLEFS_LESS_EQUAL (6 , 7 , 0 )
563558 struct timespec64 cur_time ;
564- #endif
565559#endif
566560 int ei = 0 , bi = 0 ;
567561 int ret = 0 ;
@@ -577,9 +571,9 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
577571 goto clean_inode ;
578572
579573 /* Update inode stats */
580- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
574+ #if SIMPLEFS_AT_LEAST (6 , 7 , 0 )
581575 simple_inode_init_ts (dir );
582- #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
576+ #elif SIMPLEFS_AT_LEAST (6 , 6 , 0 )
583577 cur_time = current_time (dir );
584578 dir -> i_mtime = dir -> i_atime = cur_time ;
585579 inode_set_ctime_to_ts (dir , cur_time );
@@ -648,11 +642,11 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
648642 i_gid_write (inode , 0 );
649643 inode -> i_mode = 0 ;
650644
651- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
645+ #if SIMPLEFS_AT_LEAST (6 , 7 , 0 )
652646 inode_set_mtime (inode , 0 , 0 );
653647 inode_set_atime (inode , 0 , 0 );
654648 inode_set_ctime (inode , 0 , 0 );
655- #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
649+ #elif SIMPLEFS_AT_LEAST (6 , 6 , 0 )
656650 inode -> i_mtime .tv_sec = inode -> i_atime .tv_sec = 0 ;
657651 inode_set_ctime (inode , 0 , 0 );
658652#else
@@ -699,10 +693,8 @@ static int simplefs_rename(struct inode *old_dir,
699693 struct simplefs_file_ei_block * eblock_new = NULL ;
700694 struct simplefs_dir_block * dblock = NULL ;
701695
702- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
703- #if LINUX_VERSION_CODE <= KERNEL_VERSION (6 , 7 , 0 )
696+ #if SIMPLEFS_AT_LEAST (6 , 6 , 0 ) && SIMPLEFS_LESS_EQUAL (6 , 7 , 0 )
704697 struct timespec64 cur_time ;
705- #endif
706698#endif
707699
708700 int new_pos = -1 , ret = 0 ;
@@ -798,9 +790,9 @@ static int simplefs_rename(struct inode *old_dir,
798790 brelse (bh2 );
799791
800792 /* Update new parent inode metadata */
801- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
793+ #if SIMPLEFS_AT_LEAST (6 , 7 , 0 )
802794 simple_inode_init_ts (new_dir );
803- #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
795+ #elif SIMPLEFS_AT_LEAST (6 , 6 , 0 )
804796 cur_time = current_time (new_dir );
805797 new_dir -> i_atime = new_dir -> i_mtime = cur_time ;
806798 inode_set_ctime_to_ts (new_dir , cur_time );
@@ -819,9 +811,9 @@ static int simplefs_rename(struct inode *old_dir,
819811 goto release_new ;
820812
821813 /* Update old parent inode metadata */
822- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
814+ #if SIMPLEFS_AT_LEAST (6 , 7 , 0 )
823815 simple_inode_init_ts (old_dir );
824- #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
816+ #elif SIMPLEFS_AT_LEAST (6 , 6 , 0 )
825817 cur_time = current_time (old_dir );
826818 old_dir -> i_atime = old_dir -> i_mtime = cur_time ;
827819 inode_set_ctime_to_ts (old_dir , cur_time );
0 commit comments