[PATCH] kernel: fix a compile error

Liu Yuan namei.unix at gmail.com
Wed May 8 01:45:38 PDT 2013


From: Liu Yuan <tailai.ly at taobao.com>

make -C /lib/modules/`uname -r`/build/ M=`pwd` CONFIG_TUX3=m modules
make[1]: Entering directory `/home/yliu/linux-src'
  CC [M]  /home/yliu/tux3/user/kernel/dir.o
/home/yliu/tux3/user/kernel/dir.c: In function ‘tux_create_entry’:
/home/yliu/tux3/user/kernel/dir.c:148:4: error: ‘rec_len’ undeclared (first use in this function)
/home/yliu/tux3/user/kernel/dir.c:148:4: note: each undeclared identifier is reported only once for each function it appears in
/home/yliu/tux3/user/kernel/dir.c:130:52: error: unused variable ‘orec_len’ [-Werror=unused-variable]
cc1: all warnings being treated as errors
...

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 user/kernel/dir.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/user/kernel/dir.c b/user/kernel/dir.c
index 93485ba..ee8c413 100644
--- a/user/kernel/dir.c
+++ b/user/kernel/dir.c
@@ -127,7 +127,7 @@ loff_t tux_create_entry(struct inode *dir, const char *name, unsigned len,
 	struct sb *sb = tux_sb(dir->i_sb);
 	tux_dirent *entry;
 	struct buffer_head *buffer, *clone;
-	unsigned reclen = TUX_REC_LEN(len), rec_len, name_len, offset;
+	unsigned reclen = TUX_REC_LEN(len), name_len = 0, rec_len, offset;
 	unsigned blocksize = sb->blocksize;
 	block_t block, blocks = *size >> sb->blockbits;
 	void *olddata;
-- 
1.7.9.5




More information about the Tux3 mailing list