Commit b248a511 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: remove unused type FileMode

parent bf2c65fb
package fuse
import (
"log"
"os"
"syscall"
"time"
)
type FileMode uint32
func (me FileMode) String() string {
switch uint32(me) & syscall.S_IFMT {
case syscall.S_IFIFO:
return "p"
case syscall.S_IFCHR:
return "c"
case syscall.S_IFDIR:
return "d"
case syscall.S_IFBLK:
return "b"
case syscall.S_IFREG:
return "f"
case syscall.S_IFLNK:
return "l"
case syscall.S_IFSOCK:
return "s"
default:
log.Panic("Unknown mode: %o", me)
}
return "0"
}
func (m FileMode) IsFifo() bool { return (uint32(m) & syscall.S_IFMT) == syscall.S_IFIFO }
// IsChar reports whether the FileInfo describes a character special file.
func (m FileMode) IsChar() bool { return (uint32(m) & syscall.S_IFMT) == syscall.S_IFCHR }
// IsDir reports whether the FileInfo describes a directory.
func (m FileMode) IsDir() bool { return (uint32(m) & syscall.S_IFMT) == syscall.S_IFDIR }
// IsBlock reports whether the FileInfo describes a block special file.
func (m FileMode) IsBlock() bool { return (uint32(m) & syscall.S_IFMT) == syscall.S_IFBLK }
// IsRegular reports whether the FileInfo describes a regular file.
func (m FileMode) IsRegular() bool { return (uint32(m) & syscall.S_IFMT) == syscall.S_IFREG }
// IsSymlink reports whether the FileInfo describes a symbolic link.
func (m FileMode) IsSymlink() bool { return (uint32(m) & syscall.S_IFMT) == syscall.S_IFLNK }
// IsSocket reports whether the FileInfo describes a socket.
func (m FileMode) IsSocket() bool { return (uint32(m) & syscall.S_IFMT) == syscall.S_IFSOCK }
func (a *Attr) IsFifo() bool { return (uint32(a.Mode) & syscall.S_IFMT) == syscall.S_IFIFO }
// IsChar reports whether the FileInfo describes a character special file.
......
package fuse
import (
"syscall"
"testing"
)
func TestFileMode(t *testing.T) {
sock := FileMode(syscall.S_IFSOCK)
if sock.IsDir() {
t.Error("Socket should not be directory")
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment