// unlockPath unlock directories
433797
func unlockPath(fileHandles []uintptr) {
	if fileHandles != nil {
		for _, handle := range fileHandles {
			syscall.CloseHandle(syscall.Handle(handle))
		}
	}
}
914321
func unlockpt(f *os.File) error {
	if _, err := C.grantpt(C.int(f.Fd())); err != nil {
		return err
	}
	return nil
}
791416
func (part *Partition) UnlockUpdate(id int) {
	part.exclUpdateLock.Lock()
	ch := part.exclUpdate[id]
	delete(part.exclUpdate, id)
	part.exclUpdateLock.Unlock()
	close(ch)
}
588989
func (d *manifestDeployer) CharmPath(path string) string {
	return filepath.Join(d.charmPath, path)
}
920136
func (l *lock) Unlock() {
	l.mu.Lock()
	defer l.mu.Unlock()
	select {
	case <-l.ch:
	default:
		close(l.ch)
	}
}
98497
func (l *Lock) Unlock() error {
	if l == nil {
		return nil
	}

	// Unlock kvstore mutex first
	err := l.kvLock.Unlock()

	// unlock local lock even if kvstore cannot be unlocked
	kvstoreLocks.unlock(l.path, l.id)
	Trace("Unlocked", nil, logrus.Fields{fieldKey: l.path})

	return err
}
961065
func (c *Collection) Unlock(key string, opts *UnlockOptions) (mutOut *MutationResult, errOut error) {
	if opts == nil {
		opts = &UnlockOptions{}
	}

	span := c.startKvOpTrace(opts.ParentSpanContext, "Unlock")
	defer span.Finish()

	ctx, cancel := c.context(opts.Context, opts.Timeout)
	if cancel != nil {
		defer cancel()
	}

	res, err := c.unlock(ctx, span.Context(), key, *opts)
	if err != nil {
		return nil, err
	}

	return res, nil
}
580605
func (s *LocalState) lockInfoPath() string {
	stateDir, stateName := filepath.Split(s.Path)
	if stateName == "" {
		panic("empty state file path")
	}

	if stateName[0] == '.' {
		stateName = stateName[1:]
	}

	return filepath.Join(stateDir, fmt.Sprintf(".%s.lock.info", stateName))
}
1048556
func unlockpt(f *os.File) error {
	var u int32
	if _, _, err := unix.Syscall(unix.SYS_IOCTL, f.Fd(), unix.TIOCSPTLCK, uintptr(unsafe.Pointer(&u))); err != 0 {
		return err
	}
	return nil
}
393384
func UnlockServices(conn client.Connection, svcs []ServiceLockNode) error {
	tx := conn.NewTransaction()
	for _, svc := range svcs {
		node, err := NewServiceNodeFromService(&service.Service{})
		if err != nil {
			return NewUnlockServiceFailure(svc.ServiceID, svc.PoolID, err)
		}
		if err := conn.Get(svc.Path(), node); err != nil && err != client.ErrNoNode {
			return NewUnlockServiceFailure(svc.ServiceID, svc.PoolID, err)
		}
		if node.Locked {
			node.Locked = false
			tx.Set(svc.Path(), node)
		}
	}
	return tx.Commit()
}
409049
func (f *File) Unlock() (err error) {
	f.lockedLock.Lock()
	defer f.lockedLock.Unlock()
	if !f.locked {
		return nil
	}

	// Send the event only if f.locked == true.
	done := make(chan struct{})
	f.fs.sendEvents(FSEvent{
		EventType: FSEventUnlock,
		File:      f,
		Done:      done,
	})
	defer close(done)

	defer func() {
		if err == nil {
			f.locked = false
		}
	}()

	err = f.fs.SyncAll()
	if err != nil {
		return err
	}
	jManager, err := libkbfs.GetJournalManager(f.fs.config)
	if err != nil {
		return err
	}
	jStatus, _ := jManager.JournalStatus(f.fs.root.GetFolderBranch().Tlf)
	if jStatus.RevisionStart == kbfsmd.RevisionUninitialized {
		// Journal MDs are all flushed and we haven't made any more writes.
		// Calling FinishSingleOp won't make it to the server, so we make a
		// naked request to server just to release the lock.
		return f.fs.config.MDServer().ReleaseLock(f.fs.ctx,
			f.fs.root.GetFolderBranch().Tlf, f.getLockID())
	}

	if f.fs.config.Mode().Type() == libkbfs.InitSingleOp {
		err = jManager.FinishSingleOp(f.fs.ctx,
			f.fs.root.GetFolderBranch().Tlf, &keybase1.LockContext{
				RequireLockID:       f.getLockID(),
				ReleaseAfterSuccess: true,
			}, f.fs.priority)
		if err != nil {
			return err
		}
	} else {
		err = jManager.WaitForCompleteFlush(
			f.fs.ctx, f.fs.root.GetFolderBranch().Tlf)
		if err != nil {
			return err
		}

		f.fs.log.CDebugf(f.fs.ctx, "Releasing the lock")

		// Need to explicitly release the lock from the server. If
		// single-op mode isn't enabled, then the journal will be
		// flushing on its own without waiting for the call to
		// `FinishSingleOp`. That means the journal can already be
		// completely flushed by the time `FinishSingleOp` is called,
		// and it will be a no-op. It won't have made any call to the
		// server to release the lock, so we have to do it explicitly
		// here.
		err = f.fs.config.MDServer().ReleaseLock(
			f.fs.ctx, f.fs.root.GetFolderBranch().Tlf, f.getLockID())
		if err != nil {
			return err
		}
	}
	return nil
}
1186221
func (l *KeyLock) Unlock() error {
	err := l.keyLock.Unlock()
	if err != nil {
		return err
	}
	return nil
}
217644
func unlockpt(f *os.File) error {
	var u int32
	return ioctl(f.Fd(), unix.TIOCPTYUNLK, uintptr(unsafe.Pointer(&u)))
}
1019789
func (fm *filesManager) unlockFile(file *file) {
	if !atomic.CompareAndSwapInt32(&file.state, fileInUse, fileOpened) {
		panic(fmt.Errorf("failed to switch state from fileInUse to fileOpened for file %q, state=%v",
			file.name, file.state))
	}
}
429965
func (m *ExpirationManager) unlockLease(leaseID string) {
	locksutil.LockForKey(m.restoreLocks, leaseID).Unlock()
}
436590
func goModPath(fname string, isDir bool) (string, error) {
	root := fname
	if !isDir {
		root = filepath.Dir(fname)
	}

	goModPathCache.RLock()
	goModPath, ok := goModPathCache.paths[root]
	goModPathCache.RUnlock()
	if ok {
		return goModPath, nil
	}

	defer func() {
		goModPathCache.Lock()
		goModPathCache.paths[root] = goModPath
		goModPathCache.Unlock()
	}()

	cmd := exec.Command("go", "env", "GOMOD")
	cmd.Dir = root

	stdout, err := cmd.Output()
	if err != nil {
		return "", err
	}

	goModPath = string(bytes.TrimSpace(stdout))

	return goModPath, nil
}
898481
func (cs *StreamManager) UnlockProtectedEntry(e *Entry) {
	for i := range e.Values {
		if bool(e.Values[i].Value.Protected) {
			e.Values[i].Value.Content = string(cs.Unpack(e.Values[i].Value.Content))
		}
	}
	for i := range e.Histories {
		cs.UnlockProtectedEntries(e.Histories[i].Entries)
	}
}