yaffs2 源码错误 too few arguments to function 'yaffs_flush_file' 2014.10.11
来自:http://blog.csdn.net/cinmyheart/article/details/38747505
yaffs2 源码错误
错误:
2014-08-06
Charles Mannin |
版本的 yaffs 有误!
yaffs_flush_file的定义:
source file :yaffs_guts.c
- int yaffs_flush_file(struct yaffs_obj *in,
- int update_time,
- int data_sync,
- int discard_cache)
- {
- if (!in->dirty)
- return YAFFS_OK;
- yaffs_flush_file_cache(in, discard_cache);
- if (data_sync)
- return YAFFS_OK;
- if (update_time)
- yaffs_load_current_time(in, 0, 0);
- return (yaffs_update_oh(in, NULL, 0, 0, 0, NULL) >= 0) ?
- YAFFS_OK : YAFFS_FAIL;
- }
yafss_vfs.c
- #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
- static int yaffs_file_flush(struct file *file, fl_owner_t id)
- #else
- static int yaffs_file_flush(struct file *file)
- #endif
- {
- struct yaffs_obj *obj = yaffs_dentry_to_obj(file->f_dentry);
- struct yaffs_dev *dev = obj->my_dev;
- yaffs_trace(YAFFS_TRACE_OS,
- "yaffs_file_flush object %d (%s)",
- obj->obj_id,
- obj->dirty ? "dirty" : "clean");
- yaffs_gross_lock(dev);
- yaffs_flush_file(obj, 1, 0);
- yaffs_gross_unlock(dev);
- return 0;
- }
看过yaffs_flush_file的定义之后,发现这里应该输入四个参数,但是这里只有三个参数传入,编译器报错
同样的
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
- static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync)
- #elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
- static int yaffs_sync_object(struct file *file, int datasync)
- #else
- static int yaffs_sync_object(struct file *file, struct dentry *dentry,
- int datasync)
- #endif
- {
- struct yaffs_obj *obj;
- struct yaffs_dev *dev;
- #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
- struct dentry *dentry = file->f_path.dentry;
- #endif
- obj = yaffs_dentry_to_obj(dentry);
- dev = obj->my_dev;
- yaffs_trace(YAFFS_TRACE_OS | YAFFS_TRACE_SYNC,
- "yaffs_sync_object");
- yaffs_gross_lock(dev);
- yaffs_flush_file(obj, 1, datasync);
- yaffs_gross_unlock(dev);
- return 0;
- }
yaffs_sync_object里面的yaffs_flush_file也只有三个参数传入和定义不符合
- void yaffs_flush_whole_cache(struct yaffs_dev *dev, int discard)
- {
- struct yaffs_obj *obj;
- int n_caches = dev->param.n_caches;
- int i;
- /* Find a dirty object in the cache and flush it...
- * until there are no further dirty objects.
- */
- do {
- obj = NULL;
- for (i = 0; i < n_caches && !obj; i++) {
- if (dev->cache[i].object && dev->cache[i].dirty)
- obj = dev->cache[i].object;
- }
- if (obj)
- yaffs_flush_file_cache(obj, discard);
- } while (obj);
- }