Skip to contentSkip to conversation

compile error (undefined reference to jffs2_getlink) for kernel 2.4.26

DISCUSSION Kevin Liao 4 participants 9 messages Mar 3, 2005 Memory technology devices (MTD)

lore
Share & tools
lore

Kevin Liao

author
#0 lore raw

I use the snapshop 20050302 to patch kernel 2.4.26 for ARM. I get the following error messages when I try to "make zImage":

fs/fs.o(.text+0x37944): In function `jffs2_readlink':
: undefined reference to `jffs2_getlink'
fs/fs.o(.text+0x3799c): In function `jffs2_follow_link':
: undefined reference to jffs2_getlink' drivers/mtd/mtdlink.o(.text+0x5f28): In function cfi_intelext_partition_fixup':
: undefined reference to `__ffs'

I find this function "jffs2_getlink" should be in jffs2/read.c but it's does not exist. Should I wait for later snapshop or I can fix it manuly? Thank a lot!

Regards,
Kevin

#1 lore raw
Quoted 12 lines · Kevin Liao

I use the snapshop 20050302 to patch kernel 2.4.26 for ARM. I get the following
error messages when I try to "make zImage":

fs/fs.o(.text+0x37944): In function `jffs2_readlink':
: undefined reference to jffs2_getlink' fs/fs.o(.text+0x3799c): In function jffs2_follow_link':
: undefined reference to jffs2_getlink' drivers/mtd/mtdlink.o(.text+0x5f28): In function cfi_intelext_partition_fixup':
: undefined reference to `__ffs'

Quoted 3 lines

I find this function "jffs2_getlink" should be in jffs2/read.c but it's does not
exist. Should I wait for later snapshop or I can fix it manuly? Thank a lot!

Read http://www.linux-mtd.infradead.org/#kernelversions

tglx

author
#2 lore raw

Re: compile error (undefined reference to jffs2_getlink) forkernel 2.4.26

Quoted 13 lines · Thomas Gleixner
Quoted 12 lines · Kevin Liao

I use the snapshop 20050302 to patch kernel 2.4.26 for ARM. I get the following
error messages when I try to "make zImage":

fs/fs.o(.text+0x37944): In function `jffs2_readlink':
: undefined reference to jffs2_getlink' fs/fs.o(.text+0x3799c): In function jffs2_follow_link':
: undefined reference to jffs2_getlink' drivers/mtd/mtdlink.o(.text+0x5f28): In function cfi_intelext_partition_fixup':
: undefined reference to `__ffs'

Quoted 8 lines
Quoted 3 lines

I find this function "jffs2_getlink" should be in jffs2/read.c but it's does not
exist. Should I wait for later snapshop or I can fix it manuly? Thank a lot!

Read http://www.linux-mtd.infradead.org/#kernelversions

tglx

Thanks for the reply. Actully I had read it before I ask this question. According to the webpage, the kernel version I used should be ok. I think the root cause is not the kernel version. Because I serach the whole directory extracted from snapshop 20050302 but found no implementation for jffs2_getlink function. Maybe I search the wrong place?

Regards,
Kevin

#3 lore raw

Re: compile error (undefined reference to jffs2_getlink) forkernel 2.4.26

Quoted 6 lines · Kevin Liao

Thanks for the reply. Actully I had read it before I ask this question. According to the webpage, the kernel version I used should be ok. I think the root cause is not the kernel version. Because I serach the whole directory extracted from snapshop 20050302 but found no implementation for jffs2_getlink function. Maybe I search the wrong place?

Yes, jffs2_getlink is removed. There was an update to jffs2 a couple of days ago. It broke the 2.4 code.

Frankly spoken, I personally don't care.

2.4 is as is and we are not going to do anything about. Feel free to fix it by porting the link changes back to super-v24.c or use an snapshot before said changes.

tglx

#6 lore raw
In reply to Kevin Liao
Quoted 4 lines · Kevin Liao

I use the snapshop 20050302 to patch kernel 2.4.26 for ARM. I get the following
error messages when I try to "make zImage":

Kevin,

I'm sorry, that was my patch which broke 2.4. I've completely forgotten about 2.4-compatibility. I'll see what I might do to repair this. Apologies.

--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.

author
#7 lore raw
Quoted 9 lines

Kevin,

I'm sorry, that was my patch which broke 2.4. I've completely forgotten about 2.4-compatibility. I'll see what I might do to repair this. Apologies.

--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.

You do not need to be sorry at all. I really don't want you guys to maintain the backward compatibility for 2.4.x. I just want to find the reason why this snapshop breaks 2.4.x and try to fix it by myself. I need to say thank to tglx. Because his help, I now have a working 2.4.x kernel with snapshop 20050228:) And I totally agree his suggestion for removing the 2.4.x code from current CVS.

Regards,
Kevin

#8 lore raw
Quoted 1 line · Kevin Liao

You do not need to be sorry at all.

Ok, but I should have been more accurate.

Here is the patch I propose. I didn't test it and didn't compile. Please try it. The idea is simple: f->dents contains the target link and you only need take it from there.

Please, report if the patch works and we might commit it.

--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.

symlink-v24_tweaked.c renamed from symlink-v24.c +24 -2
@@ -27,12 +27,34 @@
 	.setattr =	jffs2_setattr
 };
 
+static inline char * jffs2_provide_link(struct jffs2_sb_info *c, struct jffs2_inode_info *f)
+{
+	unsigned char *kbuf = kmalloc(f->metadata->size + 1, GFP_USER);
+	
+	if (!kbuf) {
+		printk(KERN_ERR "jffs2_provide_link(): can't allocate memory for symlink target\n");
+		return ERR_PTR(-ENOMEM);
+	}
+	
+	if (!f->dents) {
+		printk(KERN_ERR "jffs2_provide_link(): can't find symlink target\n");
+		return ERR_PTR(-EIO);
+	}
+	
+	D1(printk(KERN_DEBUG "jffs2_provide_link(): target path is '%s'\n", (char *) f->dents));
+
+	memcpy(kbuf, (char *) f->dents, f->metadata->size + 1);
+	buf[f->metadata->size + 1] = '\0';
+
+	return buf;
+}
+
 int jffs2_readlink(struct dentry *dentry, char *buffer, int buflen)
 {
 	unsigned char *kbuf;
 	int ret;
 
-	kbuf = jffs2_getlink(JFFS2_SB_INFO(dentry->d_inode->i_sb), JFFS2_INODE_INFO(dentry->d_inode));
+	kbuf = jffs2_provide_link(JFFS2_SB_INFO(dentry->d_inode->i_sb), JFFS2_INODE_INFO(dentry->d_inode));
 	if (IS_ERR(kbuf))
 		return PTR_ERR(kbuf);
 
@@ -46,7 +68,7 @@
 	unsigned char *buf;
 	int ret;
 
-	buf = jffs2_getlink(JFFS2_SB_INFO(dentry->d_inode->i_sb), JFFS2_INODE_INFO(dentry->d_inode));
+	buf = jffs2_provide_link(JFFS2_SB_INFO(dentry->d_inode->i_sb), JFFS2_INODE_INFO(dentry->d_inode));
 
 	if (IS_ERR(buf))
 		return PTR_ERR(buf);
#4 lore raw

Re: compile error (undefined reference to jffs2_getlink) forkernel 2.4.26

In reply to Thomas Gleixner
Quoted 8 lines · Thomas Gleixner
Quoted 6 lines · Kevin Liao

Thanks for the reply. Actully I had read it before I ask this question. According to the webpage, the kernel version I used should be ok. I think the root cause is not the kernel version. Because I serach the whole directory extracted from snapshop 20050302 but found no implementation for jffs2_getlink function. Maybe I search the wrong place?

Quoted 8 lines

Yes, jffs2_getlink is removed. There was an update to jffs2 a couple of days ago. It broke the 2.4 code.

Frankly spoken, I personally don't care.

2.4 is as is and we are not going to do anything about. Feel free to fix it by porting the link changes back to super-v24.c or use an snapshot before said changes.

I'm a real outsider here, and don't care much about whether the code works under 2.4 or not.

But at least one way of interpreting
http://www.linux-mtd.infradead.org/#kernelversions is:

Code in the 2.6 kernel tree gets updated. Code in the 2.4 tree doesn't, you'll have to fetch it from CVS yourself. You need at least 2.4.26; anything lower than that is ancient and we're not interested in supporting it.

In other words, the whole text about "ancient kernels" can easily be interpreted to mean anything *before 2.4.26*, and that 2.4.26 and on is still fair game to ask the mailing list at the moment.

It also says that in the *future*, 2.4 will be completely put into maintenance mode. If that future is now, IMHO somebody should update that web page to say so.

With the way that page currently reads, I don't think being curt with someone who asks about 2.4.26 and pointing them at the web page is really fair.

[Personally, I don't think you should move to that future just yet; 2-6 more months would be where I would do it. Where I work, there was some resistance to moving to 2.6 because it isn't yet "mature" in the embedded space, as in the major embedded suppliers like MontaVista aren't really shipping 2.6 yet. That was a couple of months ago, and I haven't been paying attentiion; they might be there now. At any rate, I recognize my opinion doesn't really matter because I'm not an active developer; I'm only suggesting what I think is a way to create less friction in this community.]

Thanks for listening; If I cause more heat than light with this, I appologize profusely.

--> Steve Wahl

#5 lore raw

Re: compile error (undefined reference to jffs2_getlink) forkernel 2.4.26

Quoted 3 lines · Steve Wahl

In other words, the whole text about "ancient kernels" can easily be interpreted to mean anything *before 2.4.26*, and that 2.4.26 and on is still fair game to ask the mailing list at the moment.

You're right.

Quoted 3 lines

It also says that in the *future*, 2.4 will be completely put into maintenance mode. If that future is now, IMHO somebody should update that web page to say so.

Will happen.

Quoted 5 lines

[Personally, I don't think you should move to that future just yet; 2-6 more months would be where I would do it. Where I work, there was some resistance to moving to 2.6 because it isn't yet "mature" in the embedded space, as in the major embedded suppliers like MontaVista aren't really shipping 2.6 yet.

In my opinion we should have removed it since long. It's lying around, makes the tree ugly, breaks on a regular base and nobody cares to fix it. The active MTD developers are doing 2.6 only and are blamed on a regular base, why it does not work on 2.4.

If somebody stands up and takes the responsibility to keep the 2.4 stuff alive, I could be convinced to keep it alive.

Anybody up to it?

tglx