touch $DIR/$tdir/d2/x2
mkdir -p $DIR/$tdir/d2/a/b/c
mkdir -p $DIR/$tdir/d2/p/q/r
+ # regular file
FID=$($LFS path2fid $DIR/$tdir/d2/$tfile | tr -d '[')
check_path "/$tdir/d2/$tfile" $DIR $FID --link 0
+
+ # softlink
+ ln -s $DIR/$tdir/d2/$tfile $DIR/$tdir/d2/p/q/r/slink
+ FID=$($LFS path2fid $DIR/$tdir/d2/p/q/r/slink | tr -d '[')
+ check_path "/$tdir/d2/p/q/r/slink" $DIR $FID --link 0
+
+ # hardlink
ln $DIR/$tdir/d2/$tfile $DIR/$tdir/d2/p/q/r/hlink
mv $DIR/$tdir/d2/$tfile $DIR/$tdir/d2/a/b/c/new_file
FID=$($LFS path2fid $DIR/$tdir/d2/a/b/c/new_file | tr -d '[')
# fid2path dir/fsname should both work
check_path "/$tdir/d2/a/b/c/new_file" $FSNAME $FID --link 1
check_path "/$tdir/d2/p/q/r/hlink" $DIR $FID --link 0
- # check that there are 2 links
- ${LFS} fid2path $DIR $FID | wc -l | grep -q 2 || \
- err17935 "expected 2 links"
+ # hardlink count: check that there are 2 links
+ # Doesnt work with CMD yet: 17935
+ ${LFS} fid2path $DIR $FID | wc -l | grep -q 2 || \
+ err17935 "expected 2 links"
+
+ # hardlink indexing: remove the first link
rm $DIR/$tdir/d2/p/q/r/hlink
check_path "/$tdir/d2/a/b/c/new_file" $DIR $FID --link 0
- # Doesnt work with CMD yet: 17935
- return 0
+
+ return 0
}
run_test 162 "path lookup sanity"