carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1//go:build linux
2
3package layout
4
5import (
6 "os"
7 "syscall"
8)
9
10// linkCount is the number of directory entries that name the file, read
11// without following a symlink, and the file's inode so an operator can
12// find the other names. A regular file the pass moves must have exactly
13// one name: a second one somewhere else is a second reader and writer the
14// move does not know about.
15func linkCount(fi os.FileInfo) (nlink, inode uint64) {
16 if st, ok := fi.Sys().(*syscall.Stat_t); ok {
17 return uint64(st.Nlink), uint64(st.Ino)
18 }
19 return 1, 0
20}
21