Skip to content

Commit 1f1fec6

Browse files
committed
Fix unused variable warning
The variable cur_time in inode.c is now conditionally declared and used only when the kernel version is 6.6.0. Therefore, another condition needs to be added to check for its declaration, or it should be only declared when used.
1 parent fcac769 commit 1f1fec6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

inode.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ static struct inode *simplefs_new_inode(struct inode *dir, mode_t mode)
192192
int ret;
193193

194194
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
195+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 7, 0)
195196
struct timespec64 cur_time;
197+
#endif
196198
#endif
197199

198200
/* Check mode before doing anything to avoid undoing everything */
@@ -328,9 +330,10 @@ static int simplefs_create(struct inode *dir,
328330
struct buffer_head *bh, *bh2;
329331

330332
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
333+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 7, 0)
331334
struct timespec64 cur_time;
332335
#endif
333-
336+
#endif
334337
int ret = 0, alloc = false, bno = 0;
335338
int ei = 0, bi = 0, fi = 0;
336339

@@ -538,7 +541,9 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
538541
struct buffer_head *bh = NULL, *bh2 = NULL;
539542
struct simplefs_file_ei_block *file_block = NULL;
540543
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
544+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 7, 0)
541545
struct timespec64 cur_time;
546+
#endif
542547
#endif
543548
int ei = 0, bi = 0;
544549
int ret = 0;
@@ -677,7 +682,9 @@ static int simplefs_rename(struct inode *old_dir,
677682
struct simplefs_dir_block *dblock = NULL;
678683

679684
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
685+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 7, 0)
680686
struct timespec64 cur_time;
687+
#endif
681688
#endif
682689

683690
int new_pos = -1, ret = 0;

0 commit comments

Comments
 (0)