在哪里可以找到“__NR_nfsservctl(180)”的 nfsd 系统调用的源代码?

问题描述 投票:0回答:0

我最近没有从事基于 nfsd 的项目构建。我从nfs-utils源代码包中找到了nfsd源代码,其中nfsd主程序以下面的系统调用结束,其中__NR_nfsctl是180(“#define __NR_nfsservctl 180”在unistd_64.h中定义)。

int
nfsctl (int cmd, struct nfsctl_arg * argp, union nfsctl_res * resp)
{
#ifdef __NR_nfsctl
  return syscall (__NR_nfsctl, cmd, argp, resp);
#else
  errno = ENOSYS;
  return -1;
#endif
}

显然,nfsd 或 /usr/sbin/rpc.nfsd 仅用作真正的 nfs 服务器服务的启动器。主要功能已经存在于linux内核中,只有安装nfs-kernel-server后才生效。

我试图在最新的linux内核源代码中找到nfsservctl函数的定义。但我得到的只是“/arch/x86/entry/syscalls/syscall_64.tbl”中系统调用号的定义:

177 64  get_kernel_syms
178 64  query_module
179 common  quotactl        sys_quotactl
180 64  nfsservctl
181 common  getpmsg
182 common  putpmsg
183 common  afs_syscall
184 common  tuxcall
185 common  security
186 common  gettid          sys_gettid
187 common  readahead       sys_readahead

有趣的是,没有系统调用函数绑定到 nfsservctl 系统调用号。是否有可能有一种方法可以在Linux运行时动态注册系统调用函数?

我还在linux-kernel源码中的/fs/nfsd中找到了一些源代码。 nfsservctl 系统调用的源代码很可能只是在这里定义的。但我找不到系统调用的入口。

user@node2:~/rpc_test/linux-5.4.251/fs/nfsd$ ls
acl.h              export.c             idmap.h     nfs3xdr.c       nfs4xdr.c   nfsxdr.c  vfs.h
auth.c             export.h             Kconfig     nfs4acl.c       nfscache.c  pnfs.h    xdr3.h
auth.h             fault_inject.c       lockd.c     nfs4callback.c  nfsctl.c    state.h   xdr4cb.h
blocklayout.c      filecache.c          Makefile    nfs4idmap.c     nfsd.h      stats.c   xdr4.h
blocklayoutxdr.c   filecache.h          netns.h     nfs4layouts.c   nfsfh.c     stats.h   xdr.h
blocklayoutxdr.h   flexfilelayout.c     nfs2acl.c   nfs4proc.c      nfsfh.h     trace.c
cache.h            flexfilelayoutxdr.c  nfs3acl.c   nfs4recover.c   nfsproc.c   trace.h
current_stateid.h  flexfilelayoutxdr.h  nfs3proc.c  nfs4state.c     nfssvc.c    vfs.c

有人可以帮忙或提供一些提示吗?

c unix linux-kernel rpc nfs
© www.soinside.com 2019 - 2024. All rights reserved.