libdokan

package
v2.11.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2018 License: BSD-3-Clause Imports: 30 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Library code gluing together KBFS and the Dokan protocol.

(TODO: Fill in more details.)

Documentation

Overview

Package libdokan is an interface between libkbfs and dokan.

Index

Constants

View Source
const (
	// PublicName is the name of the parent of all public top-level folders.
	PublicName = "public"

	// PrivateName is the name of the parent of all private top-level folders.
	PrivateName = "private"

	// TeamName is the name of the parent of all team top-level folders.
	TeamName = "team"

	// CtxOpID is the display name for the unique operation Dokan ID tag.
	CtxOpID = "DID"

	// WrongUserErrorFileName is the name of error directory for other users.
	WrongUserErrorFileName = `kbfs.access.denied.for.other.windows.users.txt`

	// WrongUserErrorContents is the contents of the file.
	WrongUserErrorContents = `Access to KBFS is limited to the windows user (sid) running KBFS.`
)
View Source
const DefaultMountFlags = dokan.CurrentSession

DefaultMountFlags are the default mount flags for libdokan.

View Source
const HiddenFilePrefix = `._`

HiddenFilePrefix is the prefix for files to be hidden.

Variables

This section is empty.

Functions

func Start

func Start(options StartOptions, kbCtx libkbfs.Context) *libfs.Error

Start the filesystem

Types

type Alias

type Alias struct {
	// contains filtered or unexported fields
}

Alias is a top-level folder accessed through its non-canonical name.

func (Alias) CanDeleteDirectory

func (t Alias) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) error

func (Alias) CanDeleteFile

func (t Alias) CanDeleteFile(ctx context.Context, fi *dokan.FileInfo) error

func (Alias) Cleanup

func (t Alias) Cleanup(ctx context.Context, fi *dokan.FileInfo)

func (Alias) CloseFile

func (t Alias) CloseFile(ctx context.Context, fi *dokan.FileInfo)

func (Alias) FindFiles

func (t Alias) FindFiles(ctx context.Context, fi *dokan.FileInfo, ignored string, cb func(*dokan.NamedStat) error) error

func (Alias) FlushFileBuffers

func (t Alias) FlushFileBuffers(ctx context.Context, fi *dokan.FileInfo) error

func (*Alias) GetFileInformation

func (s *Alias) GetFileInformation(context.Context, *dokan.FileInfo) (a *dokan.Stat, err error)

GetFileInformation for dokan.

func (Alias) GetFileSecurity

func (t Alias) GetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (Alias) LockFile

func (t Alias) LockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (Alias) ReadFile

func (t Alias) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

func (Alias) SetAllocationSize

func (t Alias) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (Alias) SetEndOfFile

func (t Alias) SetEndOfFile(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (Alias) SetFileAttributes

func (t Alias) SetFileAttributes(ctx context.Context, fi *dokan.FileInfo, fileAttributes dokan.FileAttribute) error

func (Alias) SetFileSecurity

func (t Alias) SetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (Alias) SetFileTime

func (t Alias) SetFileTime(context.Context, *dokan.FileInfo, time.Time, time.Time, time.Time) error

func (Alias) UnlockFile

func (t Alias) UnlockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (Alias) WriteFile

func (t Alias) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

type CtxTagKey

type CtxTagKey int

CtxTagKey is the type used for unique context tags

const (
	// CtxIDKey is the type of the tag for unique operation IDs.
	CtxIDKey CtxTagKey = iota
)

type Dir

type Dir struct {
	FSO
}

Dir represents KBFS subdirectories.

func (*Dir) CanDeleteDirectory

func (d *Dir) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) (err error)

CanDeleteDirectory - return just nil TODO check for permissions here.

func (Dir) CanDeleteFile

func (t Dir) CanDeleteFile(ctx context.Context, fi *dokan.FileInfo) error

func (*Dir) Cleanup

func (d *Dir) Cleanup(ctx context.Context, fi *dokan.FileInfo)

Cleanup - forget references, perform deletions etc. If Cleanup is called with non-nil FileInfo that has IsDeleteOnClose() no libdokan locks should be held prior to the call.

func (Dir) CloseFile

func (t Dir) CloseFile(ctx context.Context, fi *dokan.FileInfo)

func (*Dir) FindFiles

func (d *Dir) FindFiles(ctx context.Context, fi *dokan.FileInfo, ignored string, callback func(*dokan.NamedStat) error) (err error)

FindFiles does readdir for dokan.

func (Dir) FlushFileBuffers

func (t Dir) FlushFileBuffers(ctx context.Context, fi *dokan.FileInfo) error

func (*Dir) GetFileInformation

func (d *Dir) GetFileInformation(ctx context.Context, fi *dokan.FileInfo) (st *dokan.Stat, err error)

GetFileInformation for dokan.

func (Dir) GetFileSecurity

func (t Dir) GetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (Dir) LockFile

func (t Dir) LockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (Dir) ReadFile

func (t Dir) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

func (Dir) SetAllocationSize

func (t Dir) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (Dir) SetEndOfFile

func (t Dir) SetEndOfFile(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (*Dir) SetFileAttributes

func (d *Dir) SetFileAttributes(ctx context.Context, fi *dokan.FileInfo, fileAttributes dokan.FileAttribute) error

SetFileAttributes for Dokan.

func (Dir) SetFileSecurity

func (t Dir) SetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (Dir) UnlockFile

func (t Dir) UnlockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (Dir) WriteFile

func (t Dir) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

type EmptyFolder

type EmptyFolder struct {
	// contains filtered or unexported fields
}

EmptyFolder represents an empty, read-only KBFS TLF that has not been created by someone with sufficient permissions.

func (EmptyFolder) CanDeleteDirectory

func (t EmptyFolder) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) error

func (EmptyFolder) CanDeleteFile

func (t EmptyFolder) CanDeleteFile(ctx context.Context, fi *dokan.FileInfo) error

func (EmptyFolder) Cleanup

func (t EmptyFolder) Cleanup(ctx context.Context, fi *dokan.FileInfo)

func (EmptyFolder) CloseFile

func (t EmptyFolder) CloseFile(ctx context.Context, fi *dokan.FileInfo)

func (*EmptyFolder) FindFiles

func (*EmptyFolder) FindFiles(ctx context.Context, fi *dokan.FileInfo, ignored string, callback func(*dokan.NamedStat) error) (err error)

FindFiles for dokan.

func (EmptyFolder) FlushFileBuffers

func (t EmptyFolder) FlushFileBuffers(ctx context.Context, fi *dokan.FileInfo) error

func (*EmptyFolder) GetFileInformation

func (*EmptyFolder) GetFileInformation(context.Context, *dokan.FileInfo) (a *dokan.Stat, err error)

GetFileInformation for dokan.

func (EmptyFolder) GetFileSecurity

func (t EmptyFolder) GetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (EmptyFolder) LockFile

func (t EmptyFolder) LockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (EmptyFolder) ReadFile

func (t EmptyFolder) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

func (EmptyFolder) SetAllocationSize

func (t EmptyFolder) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (EmptyFolder) SetEndOfFile

func (t EmptyFolder) SetEndOfFile(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (EmptyFolder) SetFileAttributes

func (t EmptyFolder) SetFileAttributes(ctx context.Context, fi *dokan.FileInfo, fileAttributes dokan.FileAttribute) error

func (EmptyFolder) SetFileSecurity

func (t EmptyFolder) SetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (EmptyFolder) SetFileTime

func (t EmptyFolder) SetFileTime(context.Context, *dokan.FileInfo, time.Time, time.Time, time.Time) error

func (EmptyFolder) UnlockFile

func (t EmptyFolder) UnlockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (EmptyFolder) WriteFile

func (t EmptyFolder) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

type FS

type FS struct {
	// contains filtered or unexported fields
}

FS implements the newfuse FS interface for KBFS.

func NewFS

func NewFS(ctx context.Context, config libkbfs.Config, log logger.Logger) (*FS, error)

NewFS creates an FS

func (*FS) CreateFile

func (f *FS) CreateFile(ctx context.Context, fi *dokan.FileInfo, cd *dokan.CreateData) (dokan.File, dokan.CreateStatus, error)

CreateFile called from dokan, may be a file or directory.

func (*FS) ErrorPrint

func (f *FS) ErrorPrint(err error)

ErrorPrint prints errors from the Dokan library.

func (*FS) GetDiskFreeSpace

func (f *FS) GetDiskFreeSpace(ctx context.Context) (freeSpace dokan.FreeSpace, err error)

GetDiskFreeSpace returns information about free space on the volume for dokan.

func (*FS) GetVolumeInformation

func (f *FS) GetVolumeInformation(ctx context.Context) (dokan.VolumeInformation, error)

GetVolumeInformation returns information about the whole filesystem for dokan.

func (*FS) MoveFile

func (f *FS) MoveFile(ctx context.Context, src dokan.File, sourceFI *dokan.FileInfo, targetPath string, replaceExisting bool) (err error)

MoveFile tries to move a file.

func (*FS) NotificationGroupWait

func (f *FS) NotificationGroupWait()

NotificationGroupWait waits till the local notification group is done.

func (*FS) Printf

func (f *FS) Printf(fmt string, args ...interface{})

Printf prints information from the Dokan library.

func (*FS) UserChanged

func (f *FS) UserChanged(ctx context.Context, oldName, newName kbname.NormalizedUsername)

UserChanged is called from libfs.

func (*FS) WithContext

func (f *FS) WithContext(ctx context.Context) (context.Context, context.CancelFunc)

WithContext creates context for filesystem operations.

type FSO

type FSO struct {
	// contains filtered or unexported fields
}

FSO is a common type for file system objects, i.e. Dirs or Files.

func (FSO) CanDeleteDirectory

func (t FSO) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) error

func (FSO) CanDeleteFile

func (t FSO) CanDeleteFile(ctx context.Context, fi *dokan.FileInfo) error

func (FSO) Cleanup

func (t FSO) Cleanup(ctx context.Context, fi *dokan.FileInfo)

func (FSO) CloseFile

func (t FSO) CloseFile(ctx context.Context, fi *dokan.FileInfo)

func (FSO) FindFiles

func (t FSO) FindFiles(ctx context.Context, fi *dokan.FileInfo, ignored string, cb func(*dokan.NamedStat) error) error

func (FSO) FlushFileBuffers

func (t FSO) FlushFileBuffers(ctx context.Context, fi *dokan.FileInfo) error

func (FSO) GetFileSecurity

func (t FSO) GetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (FSO) LockFile

func (t FSO) LockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (FSO) ReadFile

func (t FSO) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

func (FSO) SetAllocationSize

func (t FSO) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (FSO) SetEndOfFile

func (t FSO) SetEndOfFile(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (FSO) SetFileAttributes

func (t FSO) SetFileAttributes(ctx context.Context, fi *dokan.FileInfo, fileAttributes dokan.FileAttribute) error

func (FSO) SetFileSecurity

func (t FSO) SetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (*FSO) SetFileTime

func (f *FSO) SetFileTime(ctx context.Context, fi *dokan.FileInfo, creation time.Time, lastAccess time.Time, lastWrite time.Time) (err error)

SetFileTime sets mtime for FSOs (File and Dir). TLFs have a separate SetFileTime.

func (FSO) UnlockFile

func (t FSO) UnlockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (FSO) WriteFile

func (t FSO) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

type File

type File struct {
	FSO
}

File represents KBFS files.

func (File) CanDeleteDirectory

func (t File) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) error

func (*File) CanDeleteFile

func (f *File) CanDeleteFile(ctx context.Context, fi *dokan.FileInfo) error

CanDeleteFile - return just nil TODO check for permissions here.

func (*File) Cleanup

func (f *File) Cleanup(ctx context.Context, fi *dokan.FileInfo)

Cleanup - for dokan, remember to handle deletions. If Cleanup is called with non-nil FileInfo that has IsDeleteOnClose() no libdokan locks should be held prior to the call.

func (File) CloseFile

func (t File) CloseFile(ctx context.Context, fi *dokan.FileInfo)

func (File) FindFiles

func (t File) FindFiles(ctx context.Context, fi *dokan.FileInfo, ignored string, cb func(*dokan.NamedStat) error) error

func (*File) FlushFileBuffers

func (f *File) FlushFileBuffers(ctx context.Context, fi *dokan.FileInfo) (err error)

FlushFileBuffers performs a (f)sync.

func (*File) GetFileInformation

func (f *File) GetFileInformation(ctx context.Context, fi *dokan.FileInfo) (a *dokan.Stat, err error)

GetFileInformation for dokan.

func (File) GetFileSecurity

func (t File) GetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (File) LockFile

func (t File) LockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (*File) ReadFile

func (f *File) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error)

ReadFile for dokan reads.

func (*File) SetAllocationSize

func (f *File) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, newSize int64) (err error)

SetAllocationSize for dokan (f)truncates but does not grow file size (it may fallocate, but that is not done at the moment).

func (*File) SetEndOfFile

func (f *File) SetEndOfFile(ctx context.Context, fi *dokan.FileInfo, length int64) (err error)

SetEndOfFile for dokan (f)truncates.

func (*File) SetFileAttributes

func (f *File) SetFileAttributes(ctx context.Context, fi *dokan.FileInfo, fileAttributes dokan.FileAttribute) error

SetFileAttributes for Dokan.

func (File) SetFileSecurity

func (t File) SetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (File) UnlockFile

func (t File) UnlockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (*File) WriteFile

func (f *File) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error)

WriteFile for dokan writes.

type Folder

type Folder struct {
	// contains filtered or unexported fields
}

Folder represents KBFS top-level folders

func (*Folder) BatchChanges

func (f *Folder) BatchChanges(
	ctx context.Context, changes []libkbfs.NodeChange, _ []libkbfs.NodeID)

BatchChanges is called for changes originating anywhere, including other hosts.

func (*Folder) LocalChange

func (f *Folder) LocalChange(ctx context.Context, node libkbfs.Node, write libkbfs.WriteRange)

LocalChange is called for changes originating within in this process.

func (*Folder) TlfHandleChange

func (f *Folder) TlfHandleChange(ctx context.Context,
	newHandle *libkbfs.TlfHandle)

TlfHandleChange is called when the name of a folder changes. Note that newHandle may be nil. Then the handle in the folder is used. This is used on e.g. logout/login.

type FolderList

type FolderList struct {
	// contains filtered or unexported fields
}

FolderList is a node that can list all of the logged-in user's favorite top-level folders, on either a public or private basis.

func (FolderList) CanDeleteDirectory

func (t FolderList) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) error

func (FolderList) CanDeleteFile

func (t FolderList) CanDeleteFile(ctx context.Context, fi *dokan.FileInfo) error

func (FolderList) Cleanup

func (t FolderList) Cleanup(ctx context.Context, fi *dokan.FileInfo)

func (FolderList) CloseFile

func (t FolderList) CloseFile(ctx context.Context, fi *dokan.FileInfo)

func (*FolderList) FindFiles

func (fl *FolderList) FindFiles(ctx context.Context, fi *dokan.FileInfo, ignored string, callback func(*dokan.NamedStat) error) (err error)

FindFiles for dokan.

func (FolderList) FlushFileBuffers

func (t FolderList) FlushFileBuffers(ctx context.Context, fi *dokan.FileInfo) error

func (*FolderList) GetFileInformation

func (*FolderList) GetFileInformation(context.Context, *dokan.FileInfo) (*dokan.Stat, error)

GetFileInformation for dokan.

func (FolderList) GetFileSecurity

func (t FolderList) GetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (FolderList) LockFile

func (t FolderList) LockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (FolderList) ReadFile

func (t FolderList) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

func (FolderList) SetAllocationSize

func (t FolderList) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (FolderList) SetEndOfFile

func (t FolderList) SetEndOfFile(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (FolderList) SetFileAttributes

func (t FolderList) SetFileAttributes(ctx context.Context, fi *dokan.FileInfo, fileAttributes dokan.FileAttribute) error

func (FolderList) SetFileSecurity

func (t FolderList) SetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (FolderList) SetFileTime

func (t FolderList) SetFileTime(context.Context, *dokan.FileInfo, time.Time, time.Time, time.Time) error

func (FolderList) UnlockFile

func (t FolderList) UnlockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (FolderList) WriteFile

func (t FolderList) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

type JournalControlFile

type JournalControlFile struct {
	// contains filtered or unexported fields
}

JournalControlFile is a special file used to control journal settings.

func (*JournalControlFile) GetFileInformation

func (f *JournalControlFile) GetFileInformation(context.Context, *dokan.FileInfo) (*dokan.Stat, error)

func (*JournalControlFile) WriteFile

func (f *JournalControlFile) WriteFile(ctx context.Context,
	fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error)

WriteFile implements writes for dokan.

type PrefetchFile

type PrefetchFile struct {
	// contains filtered or unexported fields
}

PrefetchFile represents a write-only file where any write of at least one byte triggers either disabling or enabling prefetching. It is mainly useful for testing.

func (*PrefetchFile) GetFileInformation

func (f *PrefetchFile) GetFileInformation(context.Context, *dokan.FileInfo) (*dokan.Stat, error)

func (*PrefetchFile) WriteFile

func (f *PrefetchFile) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error)

WriteFile performs writes for dokan.

type ProfileList

type ProfileList struct {
	// contains filtered or unexported fields
}

ProfileList is a node that can list all of the available profiles.

func (ProfileList) CanDeleteDirectory

func (t ProfileList) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) error

func (ProfileList) CanDeleteFile

func (t ProfileList) CanDeleteFile(ctx context.Context, fi *dokan.FileInfo) error

func (ProfileList) Cleanup

func (t ProfileList) Cleanup(ctx context.Context, fi *dokan.FileInfo)

func (ProfileList) CloseFile

func (t ProfileList) CloseFile(ctx context.Context, fi *dokan.FileInfo)

func (ProfileList) FindFiles

func (ProfileList) FindFiles(ctx context.Context, fi *dokan.FileInfo, ignored string, callback func(*dokan.NamedStat) error) (err error)

FindFiles does readdir for dokan.

func (ProfileList) FlushFileBuffers

func (t ProfileList) FlushFileBuffers(ctx context.Context, fi *dokan.FileInfo) error

func (ProfileList) GetFileInformation

func (ProfileList) GetFileInformation(ctx context.Context, fi *dokan.FileInfo) (st *dokan.Stat, err error)

GetFileInformation for dokan.

func (ProfileList) GetFileSecurity

func (t ProfileList) GetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (ProfileList) LockFile

func (t ProfileList) LockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (ProfileList) ReadFile

func (t ProfileList) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

func (ProfileList) SetAllocationSize

func (t ProfileList) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (ProfileList) SetEndOfFile

func (t ProfileList) SetEndOfFile(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (ProfileList) SetFileAttributes

func (t ProfileList) SetFileAttributes(ctx context.Context, fi *dokan.FileInfo, fileAttributes dokan.FileAttribute) error

func (ProfileList) SetFileSecurity

func (t ProfileList) SetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (ProfileList) SetFileTime

func (t ProfileList) SetFileTime(context.Context, *dokan.FileInfo, time.Time, time.Time, time.Time) error

func (ProfileList) UnlockFile

func (t ProfileList) UnlockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (ProfileList) WriteFile

func (t ProfileList) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

type ReclaimQuotaFile

type ReclaimQuotaFile struct {
	// contains filtered or unexported fields
}

ReclaimQuotaFile represents a write-only file when any write of at least one byte triggers a quota reclamation of the folder.

func (*ReclaimQuotaFile) GetFileInformation

func (f *ReclaimQuotaFile) GetFileInformation(context.Context, *dokan.FileInfo) (*dokan.Stat, error)

func (*ReclaimQuotaFile) WriteFile

func (f *ReclaimQuotaFile) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error)

WriteFile implements writes for dokan. Note a write triggers quota reclamation, but does not wait for it to finish. If you want to wait, write to SyncFromServerFileName.

type RekeyFile

type RekeyFile struct {
	// contains filtered or unexported fields
}

RekeyFile represents a write-only file when any write of at least one byte triggers a rekey of the folder.

func (*RekeyFile) GetFileInformation

func (f *RekeyFile) GetFileInformation(context.Context, *dokan.FileInfo) (*dokan.Stat, error)

func (*RekeyFile) WriteFile

func (f *RekeyFile) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error)

WriteFile implements writes for dokan.

type ResetCachesFile

type ResetCachesFile struct {
	// contains filtered or unexported fields
}

ResetCachesFile represents a write-only file where any write of at least one byte triggers the resetting of all data caches. It can only be reached from the top-level FS mount. Note that it does not clear the *node* cache, which means that the BlockPointers for existing nodes are still cached, such that directory listings can still be implicitly cached for nodes still being held by callers.

func (*ResetCachesFile) GetFileInformation

func (f *ResetCachesFile) GetFileInformation(context.Context, *dokan.FileInfo) (*dokan.Stat, error)

func (*ResetCachesFile) WriteFile

func (f *ResetCachesFile) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error)

WriteFile implements writes for dokan.

type Root

type Root struct {
	// contains filtered or unexported fields
}

Root represents the root of the KBFS file system.

func (Root) CanDeleteDirectory

func (t Root) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) error

func (Root) CanDeleteFile

func (t Root) CanDeleteFile(ctx context.Context, fi *dokan.FileInfo) error

func (Root) Cleanup

func (t Root) Cleanup(ctx context.Context, fi *dokan.FileInfo)

func (Root) CloseFile

func (t Root) CloseFile(ctx context.Context, fi *dokan.FileInfo)

func (*Root) FindFiles

func (r *Root) FindFiles(ctx context.Context, fi *dokan.FileInfo, ignored string, callback func(*dokan.NamedStat) error) error

FindFiles for dokan readdir.

func (Root) FlushFileBuffers

func (t Root) FlushFileBuffers(ctx context.Context, fi *dokan.FileInfo) error

func (*Root) GetFileInformation

func (r *Root) GetFileInformation(ctx context.Context, fi *dokan.FileInfo) (*dokan.Stat, error)

GetFileInformation for dokan stats.

func (Root) GetFileSecurity

func (t Root) GetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (Root) LockFile

func (t Root) LockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (Root) ReadFile

func (t Root) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

func (Root) SetAllocationSize

func (t Root) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (Root) SetEndOfFile

func (t Root) SetEndOfFile(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (Root) SetFileAttributes

func (t Root) SetFileAttributes(ctx context.Context, fi *dokan.FileInfo, fileAttributes dokan.FileAttribute) error

func (Root) SetFileSecurity

func (t Root) SetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (Root) SetFileTime

func (t Root) SetFileTime(context.Context, *dokan.FileInfo, time.Time, time.Time, time.Time) error

func (Root) UnlockFile

func (t Root) UnlockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (Root) WriteFile

func (t Root) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

type SpecialReadFile

type SpecialReadFile struct {
	// contains filtered or unexported fields
}

SpecialReadFile represents a file whose contents are determined by a function.

func NewArchiveRelTimeFile

func NewArchiveRelTimeFile(
	fs *FS, handle *libkbfs.TlfHandle, filename string) *SpecialReadFile

NewArchiveRelTimeFile returns a special read file that contains a by-revision directory name that corresponds to the given relative time string for the given folder.

func NewErrorFile

func NewErrorFile(fs *FS) *SpecialReadFile

NewErrorFile returns a special read file that contains a text representation of the last few KBFS errors.

func NewFileInfoFile

func NewFileInfoFile(
	fs *FS, dir libkbfs.Node, name string) *SpecialReadFile

NewFileInfoFile returns a special file that contains a text representation of a file's KBFS metadata.

func NewMetricsFile

func NewMetricsFile(fs *FS) *SpecialReadFile

NewMetricsFile returns a special read file that contains a text representation of all metrics.

func NewNonTLFStatusFile

func NewNonTLFStatusFile(fs *FS) *SpecialReadFile

NewNonTLFStatusFile returns a special read file that contains a text representation of the global KBFS status.

func NewTLFStatusFile

func NewTLFStatusFile(folder *Folder) *SpecialReadFile

NewTLFStatusFile returns a special read file that contains a text representation of the status of the current TLF.

func NewTlfEditHistoryFile

func NewTlfEditHistoryFile(folder *Folder) *SpecialReadFile

NewTlfEditHistoryFile returns a special read file that contains a text representation of the file edit history for that TLF.

func NewUpdateHistoryFile

func NewUpdateHistoryFile(folder *Folder) *SpecialReadFile

NewUpdateHistoryFile returns a special read file that contains a text representation of the update history of the current TLF.

func NewUserEditHistoryFile

func NewUserEditHistoryFile(folder *Folder) *SpecialReadFile

NewUserEditHistoryFile returns a special read file that contains a text representation of the file edit history for the logged-in user.

func (SpecialReadFile) CanDeleteDirectory

func (t SpecialReadFile) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) error

func (SpecialReadFile) CanDeleteFile

func (t SpecialReadFile) CanDeleteFile(ctx context.Context, fi *dokan.FileInfo) error

func (SpecialReadFile) Cleanup

func (t SpecialReadFile) Cleanup(ctx context.Context, fi *dokan.FileInfo)

func (SpecialReadFile) CloseFile

func (t SpecialReadFile) CloseFile(ctx context.Context, fi *dokan.FileInfo)

func (SpecialReadFile) FindFiles

func (t SpecialReadFile) FindFiles(ctx context.Context, fi *dokan.FileInfo, ignored string, cb func(*dokan.NamedStat) error) error

func (SpecialReadFile) FlushFileBuffers

func (t SpecialReadFile) FlushFileBuffers(ctx context.Context, fi *dokan.FileInfo) error

func (*SpecialReadFile) GetFileInformation

func (f *SpecialReadFile) GetFileInformation(ctx context.Context, fi *dokan.FileInfo) (*dokan.Stat, error)

GetFileInformation does stats for dokan.

func (SpecialReadFile) GetFileSecurity

func (t SpecialReadFile) GetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (SpecialReadFile) LockFile

func (t SpecialReadFile) LockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (*SpecialReadFile) ReadFile

func (f *SpecialReadFile) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

ReadFile does reads for dokan.

func (SpecialReadFile) SetAllocationSize

func (t SpecialReadFile) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (SpecialReadFile) SetEndOfFile

func (t SpecialReadFile) SetEndOfFile(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (SpecialReadFile) SetFileAttributes

func (t SpecialReadFile) SetFileAttributes(ctx context.Context, fi *dokan.FileInfo, fileAttributes dokan.FileAttribute) error

func (SpecialReadFile) SetFileSecurity

func (t SpecialReadFile) SetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (SpecialReadFile) SetFileTime

func (t SpecialReadFile) SetFileTime(context.Context, *dokan.FileInfo, time.Time, time.Time, time.Time) error

func (SpecialReadFile) UnlockFile

func (t SpecialReadFile) UnlockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (SpecialReadFile) WriteFile

func (t SpecialReadFile) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

type StartOptions

type StartOptions struct {
	KbfsParams  libkbfs.InitParams
	RuntimeDir  string
	Label       string
	DokanConfig dokan.Config
	ForceMount  bool
	SkipMount   bool
	MountPoint  string
}

StartOptions are options for starting up

type Symlink struct {
	// contains filtered or unexported fields
}

Symlink represents KBFS symlinks.

func (Symlink) CanDeleteDirectory

func (t Symlink) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) error

func (Symlink) CanDeleteFile

func (t Symlink) CanDeleteFile(ctx context.Context, fi *dokan.FileInfo) error

func (Symlink) Cleanup

func (t Symlink) Cleanup(ctx context.Context, fi *dokan.FileInfo)

func (Symlink) CloseFile

func (t Symlink) CloseFile(ctx context.Context, fi *dokan.FileInfo)

func (Symlink) FindFiles

func (t Symlink) FindFiles(ctx context.Context, fi *dokan.FileInfo, ignored string, cb func(*dokan.NamedStat) error) error

func (Symlink) FlushFileBuffers

func (t Symlink) FlushFileBuffers(ctx context.Context, fi *dokan.FileInfo) error

func (*Symlink) GetFileInformation

func (s *Symlink) GetFileInformation(ctx context.Context, fi *dokan.FileInfo) (a *dokan.Stat, err error)

GetFileInformation does stat for dokan.

func (Symlink) GetFileSecurity

func (t Symlink) GetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (Symlink) LockFile

func (t Symlink) LockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (Symlink) ReadFile

func (t Symlink) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

func (Symlink) SetAllocationSize

func (t Symlink) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (Symlink) SetEndOfFile

func (t Symlink) SetEndOfFile(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (Symlink) SetFileAttributes

func (t Symlink) SetFileAttributes(ctx context.Context, fi *dokan.FileInfo, fileAttributes dokan.FileAttribute) error

func (Symlink) SetFileSecurity

func (t Symlink) SetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (Symlink) SetFileTime

func (t Symlink) SetFileTime(context.Context, *dokan.FileInfo, time.Time, time.Time, time.Time) error

func (Symlink) UnlockFile

func (t Symlink) UnlockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (Symlink) WriteFile

func (t Symlink) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

type SyncControlFile

type SyncControlFile struct {
	// contains filtered or unexported fields
}

SyncControlFile is a special file used to control sync settings.

func (*SyncControlFile) GetFileInformation

func (f *SyncControlFile) GetFileInformation(context.Context, *dokan.FileInfo) (*dokan.Stat, error)

func (*SyncControlFile) WriteFile

func (f *SyncControlFile) WriteFile(ctx context.Context,
	fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error)

WriteFile implements writes for dokan.

type SyncFromServerFile

type SyncFromServerFile struct {
	// contains filtered or unexported fields
}

SyncFromServerFile represents a write-only file when any write of at least one byte triggers a sync of the folder from the server. A sync:

  • Waits for any outstanding conflict resolution tasks to finish (and it fails if the TLF is still in staged mode after waiting for CR).
  • Checks with the server for what the latest revision is for the folder.
  • Fetches and applies any missing revisions.
  • Waits for all outstanding block archive tasks to complete.
  • Waits for all outstanding quota reclamation tasks to complete.

func (*SyncFromServerFile) GetFileInformation

func (f *SyncFromServerFile) GetFileInformation(context.Context, *dokan.FileInfo) (*dokan.Stat, error)

func (*SyncFromServerFile) WriteFile

func (f *SyncFromServerFile) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error)

WriteFile implements writes for dokan.

type TLF

type TLF struct {
	// contains filtered or unexported fields
}

TLF represents the root directory of a TLF. It wraps a lazy-loaded Dir.

func (*TLF) CanDeleteDirectory

func (tlf *TLF) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) (err error)

CanDeleteDirectory - return just nil because tlfs can always be removed from favorites.

func (TLF) CanDeleteFile

func (t TLF) CanDeleteFile(ctx context.Context, fi *dokan.FileInfo) error

func (*TLF) Cleanup

func (tlf *TLF) Cleanup(ctx context.Context, fi *dokan.FileInfo)

Cleanup - forget references, perform deletions etc.

func (TLF) CloseFile

func (t TLF) CloseFile(ctx context.Context, fi *dokan.FileInfo)

func (*TLF) FindFiles

func (tlf *TLF) FindFiles(ctx context.Context, fi *dokan.FileInfo, pattern string, callback func(*dokan.NamedStat) error) (err error)

FindFiles does readdir for dokan.

func (TLF) FlushFileBuffers

func (t TLF) FlushFileBuffers(ctx context.Context, fi *dokan.FileInfo) error

func (*TLF) GetFileInformation

func (tlf *TLF) GetFileInformation(ctx context.Context, fi *dokan.FileInfo) (st *dokan.Stat, err error)

GetFileInformation for dokan.

func (TLF) GetFileSecurity

func (t TLF) GetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (TLF) LockFile

func (t TLF) LockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (TLF) ReadFile

func (t TLF) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

func (TLF) SetAllocationSize

func (t TLF) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (TLF) SetEndOfFile

func (t TLF) SetEndOfFile(ctx context.Context, fi *dokan.FileInfo, length int64) error

func (*TLF) SetFileAttributes

func (tlf *TLF) SetFileAttributes(ctx context.Context, fi *dokan.FileInfo, fileAttributes dokan.FileAttribute) error

SetFileAttributes for Dokan.

func (TLF) SetFileSecurity

func (t TLF) SetFileSecurity(ctx context.Context, fi *dokan.FileInfo, si winacl.SecurityInformation, sd *winacl.SecurityDescriptor) error

func (*TLF) SetFileTime

func (tlf *TLF) SetFileTime(ctx context.Context, fi *dokan.FileInfo, creation time.Time, lastAccess time.Time, lastWrite time.Time) (err error)

SetFileTime sets mtime for FSOs (File and Dir).

func (TLF) UnlockFile

func (t TLF) UnlockFile(ctx context.Context, fi *dokan.FileInfo, offset int64, length int64) error

func (TLF) WriteFile

func (t TLF) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error)

type UnstageFile

type UnstageFile struct {
	// contains filtered or unexported fields
}

UnstageFile represents a write-only file when any write of at least one byte triggers unstaging all unmerged commits and fast-forwarding to the current master.

func (*UnstageFile) GetFileInformation

func (f *UnstageFile) GetFileInformation(context.Context, *dokan.FileInfo) (*dokan.Stat, error)

func (*UnstageFile) WriteFile

func (f *UnstageFile) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error)

WriteFile implements writes for dokan.

type UpdatesFile

type UpdatesFile struct {
	// contains filtered or unexported fields
}

UpdatesFile represents a write-only file where any write of at least one byte triggers either disabling remote folder updates and conflict resolution, or re-enabling both. It is mainly useful for testing.

func (*UpdatesFile) GetFileInformation

func (f *UpdatesFile) GetFileInformation(context.Context, *dokan.FileInfo) (*dokan.Stat, error)

func (*UpdatesFile) WriteFile

func (f *UpdatesFile) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error)

WriteFile performs writes for dokan.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL