本文整理汇总了Golang中github.com/jacobsa/fuse.Unmount函数的典型用法代码示例。如果您正苦于以下问题:Golang Unmount函数的具体用法?Golang Unmount怎么用?Golang Unmount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Unmount函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestIssue69
func (s *GoofysTest) TestIssue69(t *C) {
s.fs.flags.StatCacheTTL = 0
mountPoint := "/tmp/mnt" + s.fs.bucket
err := os.MkdirAll(mountPoint, 0700)
t.Assert(err, IsNil)
s.mount(t, mountPoint)
defer func() {
err := os.Chdir("/")
t.Assert(err, IsNil)
err = fuse.Unmount(mountPoint)
t.Assert(err, IsNil)
}()
err = os.Chdir(mountPoint)
t.Assert(err, IsNil)
_, err = os.Stat("dir1")
t.Assert(err, IsNil)
err = os.Remove("dir1/file3")
t.Assert(err, IsNil)
// don't really care about error code, but it should be a PathError
os.Stat("dir1")
os.Stat("dir1")
}
开发者ID:kahing,项目名称:goofys,代码行数:31,代码来源:goofys_test.go
示例2: runFuseTest
func (s *GoofysTest) runFuseTest(t *C, mountPoint string, umount bool, cmdArgs ...string) {
s.mount(t, mountPoint)
if umount {
defer func() {
err := fuse.Unmount(mountPoint)
t.Assert(err, IsNil)
}()
}
cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...)
cmd.Env = append(cmd.Env, os.Environ()...)
cmd.Env = append(cmd.Env, "TRAVIS=true")
cmd.Env = append(cmd.Env, "FAST=true")
if isTravis() {
logger := NewLogger("test")
lvl := logrus.InfoLevel
logger.Formatter.(*logHandle).lvl = &lvl
w := logger.Writer()
cmd.Stdout = w
cmd.Stderr = w
}
err := cmd.Run()
t.Assert(err, IsNil)
}
开发者ID:kahing,项目名称:goofys,代码行数:28,代码来源:goofys_test.go
示例3: unmount
// Unmount the file system mounted at the supplied directory. Try again on
// "resource busy" errors, which happen from time to time on OS X (due to weird
// requests from the Finder).
func unmount(dir string) (err error) {
delay := 10 * time.Millisecond
for {
err = fuse.Unmount(dir)
if err == nil {
return
}
if strings.Contains(err.Error(), "resource busy") {
log.Println("Resource busy error while unmounting; trying again")
time.Sleep(delay)
delay = time.Duration(1.3 * float64(delay))
continue
}
err = fmt.Errorf("Unmount: %v", err)
return
}
}
开发者ID:zfo,项目名称:gcsfuse,代码行数:22,代码来源:gcsfuse_test.go
示例4: TearDown
func (t *fsTest) TearDown() {
var err error
// Close any files we opened.
if t.f1 != nil {
ExpectEq(nil, t.f1.Close())
}
if t.f2 != nil {
ExpectEq(nil, t.f2.Close())
}
// Unmount the file system. Try again on "resource busy" errors.
delay := 10 * time.Millisecond
for {
err := fuse.Unmount(t.mfs.Dir())
if err == nil {
break
}
if strings.Contains(err.Error(), "resource busy") {
log.Println("Resource busy error while unmounting; trying again")
time.Sleep(delay)
delay = time.Duration(1.3 * float64(delay))
continue
}
AddFailure("MountedFileSystem.Unmount: %v", err)
AbortTest()
}
if err := t.mfs.Join(t.ctx); err != nil {
AssertEq(nil, err)
}
// Unlink the mount point.
if err = os.Remove(t.Dir); err != nil {
err = fmt.Errorf("Unlinking mount point: %v", err)
return
}
}
开发者ID:horzadome,项目名称:gcsfuse,代码行数:41,代码来源:fs_test.go
示例5: registerSIGINTHandler
func registerSIGINTHandler(mountPoint string) {
// Register for SIGINT.
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, os.Interrupt)
// Start a goroutine that will unmount when the signal is received.
go func() {
for {
<-signalChan
log.Println("Received SIGINT, attempting to unmount...")
err := fuse.Unmount(mountPoint)
if err != nil {
log.Printf("Failed to unmount in response to SIGINT: %v", err)
} else {
log.Printf("Successfully unmounted in response to SIGINT.")
return
}
}
}()
}
开发者ID:kahing,项目名称:gcsfuse,代码行数:21,代码来源:main.go
示例6: registerSIGINTHandler
func registerSIGINTHandler(mountPoint string) {
// Register for SIGINT.
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
// Start a goroutine that will unmount when the signal is received.
go func() {
for {
s := <-signalChan
log.Infof("Received %v, attempting to unmount...", s)
err := fuse.Unmount(mountPoint)
if err != nil {
log.Errorf("Failed to unmount in response to %v: %v", s, err)
} else {
log.Printf("Successfully unmounted %v in response to %v", s, mountPoint)
return
}
}
}()
}
开发者ID:x5u,项目名称:goofys,代码行数:21,代码来源:main.go
示例7: runFuseTest
func (s *GoofysTest) runFuseTest(t *C, mountPoint string, umount bool, cmdArgs ...string) {
server := fuseutil.NewFileSystemServer(s.fs)
// Mount the file system.
mountCfg := &fuse.MountConfig{
FSName: s.fs.bucket,
Options: s.fs.flags.MountOptions,
ErrorLogger: GetStdLogger(NewLogger("fuse"), logrus.ErrorLevel),
DisableWritebackCaching: true,
}
_, err := fuse.Mount(mountPoint, server, mountCfg)
t.Assert(err, IsNil)
if umount {
defer func() {
err := fuse.Unmount(mountPoint)
t.Assert(err, IsNil)
}()
}
cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...)
cmd.Env = append(cmd.Env, os.Environ()...)
cmd.Env = append(cmd.Env, "TRAVIS=true")
cmd.Env = append(cmd.Env, "FAST=true")
if isTravis() {
logger := NewLogger("test")
lvl := logrus.InfoLevel
logger.Formatter.(*logHandle).lvl = &lvl
w := logger.Writer()
cmd.Stdout = w
cmd.Stderr = w
}
err = cmd.Run()
t.Assert(err, IsNil)
}
开发者ID:x5u,项目名称:goofys,代码行数:39,代码来源:goofys_test.go
示例8: unmount
func unmount(dir string) error {
return fuse.Unmount(dir)
}
开发者ID:koding,项目名称:koding,代码行数:3,代码来源:unmount_linux.go
注:本文中的github.com/jacobsa/fuse.Unmount函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论