make出现实参太少~ 望大神们给解决下

ID_King 2012-12-13 10:46:52
初次接触linux内核,用cryptfs生成的代码中,make之后出现如下错误:
file.c:467: 错误:提供给函数‘dentry_open’的实参太少file.c:467: 错误:提供给函数‘dentry_open’的实参太少
file.c:654: 错误:提供给函数‘posix_lock_file’的实参太少

上述代码为:
467 lower_file = dentry_open(lower_dentry, DENTRY_TO_LVFSMNT(file->f_dentry), lower_flags);
654 error = posix_lock_file(file, fl);

内核版本:2.6.32-71.el6.i686

1、这两个函数应该都是,内核定义的函数吧?
2、如果是,我要去找这两个函数定义
3、如果不是,怎么修改?

大神们,帮帮忙~~
...全文
541 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
nevil 2012-12-13
  • 打赏
  • 举报
回复
贴下两上函数的原型和实现 至于一些参数怎么用,可以参考内核调用的地方
/*
 * dentry_open() will have done dput(dentry) and mntput(mnt) if it returns an
 * error.
 */
struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags,
			 const struct cred *cred)
{
	int error;
	struct file *f;

	/*
	 * We must always pass in a valid mount pointer.   Historically
	 * callers got away with not passing it, but we must enforce this at
	 * the earliest possible point now to avoid strange problems deep in the
	 * filesystem stack.
	 */
	if (!mnt) {
		printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__);
		dump_stack();
		return ERR_PTR(-EINVAL);
	}

	error = -ENFILE;
	f = get_empty_filp();
	if (f == NULL) {
		dput(dentry);
		mntput(mnt);
		return ERR_PTR(error);
	}

	return __dentry_open(dentry, mnt, flags, f, NULL, cred);
}
/**
 * posix_lock_file - Apply a POSIX-style lock to a file
 * @filp: The file to apply the lock to
 * @fl: The lock to be applied
 * @conflock: Place to return a copy of the conflicting lock, if found.
 *
 * Add a POSIX style lock to a file.
 * We merge adjacent & overlapping locks whenever possible.
 * POSIX locks are sorted by owner task, then by starting address
 *
 * Note that if called with an FL_EXISTS argument, the caller may determine
 * whether or not a lock was successfully freed by testing the return
 * value for -ENOENT.
 */
int posix_lock_file(struct file *filp, struct file_lock *fl,
			struct file_lock *conflock)
{
	return __posix_lock_file(filp->f_path.dentry->d_inode, fl, conflock);
}
ID_King 2012-12-13
  • 打赏
  • 举报
回复
引用 4 楼 fengfengdiandia 的回复:
楼主的参数个数匹配有问题,根据源码中参数的个数和参数的类型来传值即可
问题解决了,我的内核版本太高了,而且我刚接触linux内核,还有好多不懂~~
ID_King 2012-12-13
  • 打赏
  • 举报
回复
引用 3 楼 nevil 的回复:
参考内核代码别人怎么用,你也怎么用 引用 2 楼 xiaolong2w 的回复: 引用 1 楼 nevil 的回复:贴下两上函数的原型和实现 至于一些参数怎么用,可以参考内核调用的地方 C/C++ code ? 1234567891011121314151617181920212223242526272829303132 /* * d……
额 我还是太菜了,方便加我一下QQ吗,1171904587~到时候请教你,这上边说不清楚~
疯疯癫癫 2012-12-13
  • 打赏
  • 举报
回复
楼主的参数个数匹配有问题,根据源码中参数的个数和参数的类型来传值即可
nevil 2012-12-13
  • 打赏
  • 举报
回复
参考内核代码别人怎么用,你也怎么用
引用 2 楼 xiaolong2w 的回复:
引用 1 楼 nevil 的回复:贴下两上函数的原型和实现 至于一些参数怎么用,可以参考内核调用的地方 C/C++ code ? 1234567891011121314151617181920212223242526272829303132 /* * dentry_open() will have done dput(dentr……
ID_King 2012-12-13
  • 打赏
  • 举报
回复
引用 1 楼 nevil 的回复:
贴下两上函数的原型和实现 至于一些参数怎么用,可以参考内核调用的地方 C/C++ code ? 1234567891011121314151617181920212223242526272829303132 /* * dentry_open() will have done dput(dentry) and mntput(mnt) if it retur……
我在内核中也查了到了函数原型的声明: int (*dentry_open) (struct file *file, const struct cred *cred); struct file * dentry_open(struct dentry *, struct vfsmount *, int, const struct cred *); 这自后需要怎么办?参数个数不一样呀?还有函数定义在哪个文件中找到的~

4,438

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧