jffs2, symlink, and 2.6.13
PATCH 1/1 jffs2, symlink, and 2.6.13
The function prototype for follow_link() in struct inode_operations changed in linux 2.6.13. Instead of returning int, it now expects returning void*.
I have attached a patch that fixes up the jffs2 code to accommodate the new prototype. No functional changes were made to the jffs2 code.
For those on earlier kernel versions, this change will yield compiler warnings. I am not sure what the policy is for maintaining compatibility with older kernel versions, so I did not include any changes to compatmac.h. Do we want to reproduce the struct inode_operations declaration in compatmac.h just so that latest mtd does not yield compiler warnings on older kernels?
Pete
[jffs2] Fixup symlink.c for linux 2.6.13
[From: Peter Grayson <[email protected]>]
fs/jffs2/symlink.c +9 -9
@@ -18,19 +18,19 @@#include <linux/namei.h> #include "nodelist.h" -static int jffs2_follow_link (struct dentry *dentry,struct nameidata *nd); +static void *jffs2_follow_link (struct dentry *dentry,struct nameidata *nd);struct inode_operations jffs2_symlink_inode_operations = -{ +{ .readlink = generic_readlink, .follow_link = jffs2_follow_link, .setattr = jffs2_setattr }; -static int jffs2_follow_link (struct dentry *dentry,struct nameidata *nd) +static void *jffs2_follow_link (struct dentry *dentry,struct nameidata *nd) {struct jffs2_inode_info *f =JFFS2_INODE_INFO (dentry->d_inode); - +/* * We don't acquire the f->sem mutex here since the only data we * use is f->target.
@@ -43,20 +43,20 @@* stopped using our f->target string which we provide by means of * nd_set_link() call. */ - +if (!f->target) { -printk (KERN_ERR "jffs2_follow_link(): can't find symlink taerget\n" ); -return -EIO ; +printk (KERN_ERR "jffs2_follow_link(): can't find symlink target\n" ); +return ERR_PTR (-EIO ); }D1 (printk (KERN_DEBUG "jffs2_follow_link(): target path is '%s'\n" , (char *) f->target));nd_set_link (nd, (char *)f->target); - +/* * We will unlock the f->sem mutex but VFS will use the f->target string. This is safe * since the only way that may cause f->target to be changed is iput() operation. * But VFS will not use f->target after iput() has been called. */ -return 0 ; +return NULL ; }
Quoted 6 lines · Peter Grayson
For those on earlier kernel versions, this change will yield compiler warnings. I am not sure what the policy is for maintaining compatibility with older kernel versions, so I did not include any changes to
compatmac.h. Do we want to reproduce the structinode_operationsdeclaration incompatmac.hjust so that latest mtd does not yield compiler warnings on older kernels?
The patch looks OK. Not sure how to support compatimility, I would just let gcc print warnings in older kernels. And it looks like it is harmless. Anyone, comments?
Signature · 3 lines
Best Regards, Artem B. Bityuckiy, St.-Petersburg, Russia.
Quoted 11 lines · Artem B. Bityutskiy
Quoted 6 lines · Peter Grayson
For those on earlier kernel versions, this change will yield compiler warnings. I am not sure what the policy is for maintaining compatibility with older kernel versions, so I did not include any changes to
compatmac.h. Do we want to reproduce the structinode_operationsdeclaration incompatmac.hjust so that latest mtd does not yield compiler warnings on older kernels?The patch looks OK. Not sure how to support compatimility, I would just let gcc print warnings in older kernels. And it looks like it is harmless. Anyone, comments?
I'd rather it be added to compatmac.h. We have things in there that support older 2.6 kernels already, so adding another wouldn't hurt. There's even a section for kernels older than 2.6.13 already.
josh
Quoted 9 lines · Josh Boyer
Quoted 8 lines · Artem B. Bityutskiy
Quoted 6 lines · Peter Grayson
For those on earlier kernel versions, this change will yield compiler warnings. I am not sure what the policy is for maintaining compatibility with older kernel versions, so I did not include any changes to
compatmac.h. Do we want to reproduce the structinode_operationsdeclaration incompatmac.hjust so that latest mtd does not yield compiler warnings on older kernels?
Quoted 7 lines
Quoted 3 lines
The patch looks OK. Not sure how to support compatimility, I would just let gcc print warnings in older kernels. And it looks like it is harmless. Anyone, comments?
I'd rather it be added to
compatmac.h. We have things in there that support older 2.6 kernels already, so adding another wouldn't hurt. There's even a section for kernels older than 2.6.13 already.
Yes, it is better, providing one do it it elegantly and without introducing any crap to symlink.c.
Signature · 3 lines
Best Regards, Artem B. Bityuckiy, St.-Petersburg, Russia.