sahlberg / libnfs

NFS client library
Other
524 stars 201 forks source link

Modify LD_PRELOAD toy doc #406

Closed zrss closed 1 year ago

zrss commented 1 year ago
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

i built a ld_nfs.so with tag libnfs-libnfs-5.0.2.zip, but found that the demo seems missing the leading root path /

df -h .
Filesystem      Size  Used Avail Use% Mounted on
10.100.0.249:/  500G  258G  243G  52% /tmp

ls | grep hello-world.txt
hello-world.txt

hello-world.txt does not work

LD_NFS_DEBUG=9 LD_PRELOAD=./ld_nfs.so cat nfs://10.100.0.249/hello-world.txt
ld_nfs: open(nfs://10.100.0.249/hello-world.txt, 0, 37777402000)
ld_nfs: Failed to mount nfs share : mount/mnt call failed with "RPC error: Mount failed with error MNT3ERR_INVAL(22) Invalid argument(22)"

cat: 'nfs://10.100.0.249/hello-world.txt': Invalid argument

/hello-world.txt is ok

LD_NFS_DEBUG=9 LD_PRELOAD=./ld_nfs.so cat nfs://10.100.0.249//hello-world.txt
ld_nfs: open(nfs://10.100.0.249//hello-world.txt, 0, 37777402000)
ld_nfs: open(nfs://10.100.0.249//hello-world.txt) == 3
ld_nfs: __fxstat(3)
ld_nfs: __fxstat(3) success
ld_nfs: read(fd:3 count:131072)
hello world
ld_nfs: read(fd:3 count:131072)
ld_nfs: close(3)