Skip to content

Commit

Permalink
feat(fuse): support /dev/fd/N mount point (#5082)
Browse files Browse the repository at this point in the history
Signed-off-by: jiefenghuang <[email protected]>
  • Loading branch information
jiefenghuang authored Aug 12, 2024
1 parent d4779d9 commit eae3e78
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmd/mount_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,25 @@ func watchdog(ctx context.Context, mp string) {
}
}

// parseFuseFd checks if `mountPoint` is the special form /dev/fd/N (with N >= 0),
// and returns N in this case. Returns -1 otherwise.
func parseFuseFd(mountPoint string) (fd int) {
dir, file := path.Split(mountPoint)
if dir != "/dev/fd/" {
return -1
}
fd, err := strconv.Atoi(file)
if err != nil || fd <= 0 {
return -1
}
return fd
}

func checkMountpoint(name, mp, logPath string, background bool) {
if parseFuseFd(mp) > 0 {
logger.Infof("\033[92mOK\033[0m, %s with special mount point %s", name, mp)
return
}
mountTimeOut := 10 // default 10 seconds
interval := 500 // check every 500 Millisecond
if tStr, ok := os.LookupEnv("JFS_MOUNT_TIMEOUT"); ok {
Expand Down

0 comments on commit eae3e78

Please sign in to comment.