美文网首页
路径查找

路径查找

作者: eesly_yuan | 来源:发表于2017-01-25 11:10 被阅读22次

int kern_path(const char *name, unsigned int flags, struct path *path)
int fastcall path_lookup(const char *path, unsigned flags, struct nameidata *nd)
int user_path_at(int dfd, const char __user *name, unsigned flags, struct path *path)

/**
 * path_put - put a reference to a path
 * @path: path to put the reference to
 *
 * Given a path decrement the reference count to the dentry and the vfsmount.
 */
void path_put(const struct path *path)
{
        dput(path->dentry);
        mntput(path->mnt);
}

or

void path_release(struct nameidata *nd)
{
        dput(nd->dentry);
        mntput(nd->mnt);
}

get_user_pages()
作用:获取用户区进程使用内存的某个页(struct page),然后在内核区通过 kmap()等函数映射到内核区线性地址,从而可以在内核区向其写入数据。对于获取的page记得put_page()。

int get_user_pages(struct task_struct \*tsk, 
  struct mm_struct \*mm, 
  unsigned long start, 
  int len, 
  int write, 
  int force, 
  struct page \*\*pages, 
  struct vm_area_struct \*\*vmas);
其中
tsk :指定进程
mm : 进程的内存占用结构,如current->mm,
start :要获取其页面的起始线性地址
len :要获取的页数
write :是否要对该页进行写入
force :待查
pages :存放获取的struct page的指针数组
vms : 返回各个页对应的struct vm_area_struct,可以传入NULL表示不获取
返回值:数返回实际获取的页数

相关文章

  • FIND实时查找

    文件查找find :实时查找工具,通过遍历指定路径完成文件查找 语法:find [OPTION]... [查找路径...

  • 路径查找

    int kern_path(const char *name, unsigned int flags, struc...

  • 常用命令记录

    查找命令路径

  • webpack笔记

    publicPath: 所有资源从这个路径开始查找resolve: 指定查找的路径path: webpack内置处...

  • 动态链接库问题_20170309

    动态链接库原理 用时查找 查找路径: 默认去/usr/lib /lib 下查找 可以设置自定义路径: export...

  • pip

    Python2 的路径查找命令:witch python Python3 的路径查找命令:which python...

  • 2022-01-11

    查找工程so库路径

  • AI知识点-布尔运算

    在窗口菜单中找到路径查找器,打开路径查找器面板; 1、联集,又称加法,将两个元素的路径合并在一起,形成一个路径; ...

  • UI学习笔记2 --- AI 基础

    1. AI 基础及路径查找器 PS 和 AI 的区别: AI 基本操作: 案例制作: 路径查找器: cmd+shi...

  • Day5-命令查找、文件内容处理命令

    一、命令查找 which ls #查找ls命令的绝对路径 当我们想要查看命令的绝对路径 #which comm...

网友评论

      本文标题:路径查找

      本文链接:https://www.haomeiwen.com/subject/kmptittx.html