compile error (undefined reference to jffs2_getlink) for kernel 2.4.26
Artem B. Bityuckiy
dedekind at infradead.org
Thu Mar 3 07:19:14 EST 2005
Kevin Liao wrote:
> 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.
-------------- next part --------------
--- symlink-v24.c 2005-03-03 15:13:21.227821215 +0300
+++ symlink-v24_tweaked.c 2005-03-03 15:15:31.457291207 +0300
@@ -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);
More information about the linux-mtd
mailing list