mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
doc
This commit is contained in:
parent
be40ff6048
commit
a1ef0e48a9
|
@ -13,6 +13,12 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/** Create a directory
|
||||||
|
*
|
||||||
|
* Note that the mode argument may not have the type specification
|
||||||
|
* bits set, i.e. S_ISDIR(mode) can be false. To obtain the
|
||||||
|
* correct directory type bits use mode|S_IFDIR
|
||||||
|
* */
|
||||||
func (wfs *WFS) Mkdir(cancel <-chan struct{}, in *fuse.MkdirIn, name string, out *fuse.EntryOut) (code fuse.Status) {
|
func (wfs *WFS) Mkdir(cancel <-chan struct{}, in *fuse.MkdirIn, name string, out *fuse.EntryOut) (code fuse.Status) {
|
||||||
|
|
||||||
if s := checkName(name); s != fuse.OK {
|
if s := checkName(name); s != fuse.OK {
|
||||||
|
@ -73,6 +79,7 @@ func (wfs *WFS) Mkdir(cancel <-chan struct{}, in *fuse.MkdirIn, name string, out
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Remove a directory */
|
||||||
func (wfs *WFS) Rmdir(cancel <-chan struct{}, header *fuse.InHeader, name string) (code fuse.Status) {
|
func (wfs *WFS) Rmdir(cancel <-chan struct{}, header *fuse.InHeader, name string) (code fuse.Status) {
|
||||||
|
|
||||||
if name == "." {
|
if name == "." {
|
||||||
|
|
|
@ -13,18 +13,56 @@ import (
|
||||||
|
|
||||||
// Directory handling
|
// Directory handling
|
||||||
|
|
||||||
|
/** Open directory
|
||||||
|
*
|
||||||
|
* Unless the 'default_permissions' mount option is given,
|
||||||
|
* this method should check if opendir is permitted for this
|
||||||
|
* directory. Optionally opendir may also return an arbitrary
|
||||||
|
* filehandle in the fuse_file_info structure, which will be
|
||||||
|
* passed to readdir, releasedir and fsyncdir.
|
||||||
|
*/
|
||||||
func (wfs *WFS) OpenDir(cancel <-chan struct{}, input *fuse.OpenIn, out *fuse.OpenOut) (code fuse.Status) {
|
func (wfs *WFS) OpenDir(cancel <-chan struct{}, input *fuse.OpenIn, out *fuse.OpenOut) (code fuse.Status) {
|
||||||
if !wfs.inodeToPath.HasInode(input.NodeId) {
|
if !wfs.inodeToPath.HasInode(input.NodeId) {
|
||||||
return fuse.ENOENT
|
return fuse.ENOENT
|
||||||
}
|
}
|
||||||
return fuse.OK
|
return fuse.OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Release directory
|
||||||
|
*
|
||||||
|
* If the directory has been removed after the call to opendir, the
|
||||||
|
* path parameter will be NULL.
|
||||||
|
*/
|
||||||
func (wfs *WFS) ReleaseDir(input *fuse.ReleaseIn) {
|
func (wfs *WFS) ReleaseDir(input *fuse.ReleaseIn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Synchronize directory contents
|
||||||
|
*
|
||||||
|
* If the directory has been removed after the call to opendir, the
|
||||||
|
* path parameter will be NULL.
|
||||||
|
*
|
||||||
|
* If the datasync parameter is non-zero, then only the user data
|
||||||
|
* should be flushed, not the meta data
|
||||||
|
*/
|
||||||
func (wfs *WFS) FsyncDir(cancel <-chan struct{}, input *fuse.FsyncIn) (code fuse.Status) {
|
func (wfs *WFS) FsyncDir(cancel <-chan struct{}, input *fuse.FsyncIn) (code fuse.Status) {
|
||||||
return fuse.OK
|
return fuse.OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Read directory
|
||||||
|
*
|
||||||
|
* The filesystem may choose between two modes of operation:
|
||||||
|
*
|
||||||
|
* 1) The readdir implementation ignores the offset parameter, and
|
||||||
|
* passes zero to the filler function's offset. The filler
|
||||||
|
* function will not return '1' (unless an error happens), so the
|
||||||
|
* whole directory is read in a single readdir operation.
|
||||||
|
*
|
||||||
|
* 2) The readdir implementation keeps track of the offsets of the
|
||||||
|
* directory entries. It uses the offset parameter and always
|
||||||
|
* passes non-zero offset to the filler function. When the buffer
|
||||||
|
* is full (or an error happens) the filler function will return
|
||||||
|
* '1'.
|
||||||
|
*/
|
||||||
func (wfs *WFS) ReadDir(cancel <-chan struct{}, input *fuse.ReadIn, out *fuse.DirEntryList) (code fuse.Status) {
|
func (wfs *WFS) ReadDir(cancel <-chan struct{}, input *fuse.ReadIn, out *fuse.DirEntryList) (code fuse.Status) {
|
||||||
return wfs.doReadDirectory(input, out, false)
|
return wfs.doReadDirectory(input, out, false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,26 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and open a file
|
||||||
|
*
|
||||||
|
* If the file does not exist, first create it with the specified
|
||||||
|
* mode, and then open it.
|
||||||
|
*
|
||||||
|
* If this method is not implemented or under Linux kernel
|
||||||
|
* versions earlier than 2.6.15, the mknod() and open() methods
|
||||||
|
* will be called instead.
|
||||||
|
*/
|
||||||
|
func (wfs *WFS) Create(cancel <-chan struct{}, in *fuse.CreateIn, name string, out *fuse.CreateOut) (code fuse.Status) {
|
||||||
|
return fuse.ENOSYS
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a file node
|
||||||
|
*
|
||||||
|
* This is called for creation of all non-directory, non-symlink
|
||||||
|
* nodes. If the filesystem defines a create() method, then for
|
||||||
|
* regular files that will be called instead.
|
||||||
|
*/
|
||||||
func (wfs *WFS) Mknod(cancel <-chan struct{}, in *fuse.MknodIn, name string, out *fuse.EntryOut) (code fuse.Status) {
|
func (wfs *WFS) Mknod(cancel <-chan struct{}, in *fuse.MknodIn, name string, out *fuse.EntryOut) (code fuse.Status) {
|
||||||
|
|
||||||
if s := checkName(name); s != fuse.OK {
|
if s := checkName(name); s != fuse.OK {
|
||||||
|
@ -73,6 +93,7 @@ func (wfs *WFS) Mknod(cancel <-chan struct{}, in *fuse.MknodIn, name string, out
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Remove a file */
|
||||||
func (wfs *WFS) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name string) (code fuse.Status) {
|
func (wfs *WFS) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name string) (code fuse.Status) {
|
||||||
|
|
||||||
dirFullPath := wfs.inodeToPath.GetPath(header.NodeId)
|
dirFullPath := wfs.inodeToPath.GetPath(header.NodeId)
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/** Create a symbolic link */
|
||||||
func (wfs *WFS) Symlink(cancel <-chan struct{}, header *fuse.InHeader, target string, name string, out *fuse.EntryOut) (code fuse.Status) {
|
func (wfs *WFS) Symlink(cancel <-chan struct{}, header *fuse.InHeader, target string, name string, out *fuse.EntryOut) (code fuse.Status) {
|
||||||
|
|
||||||
if s := checkName(name); s != fuse.OK {
|
if s := checkName(name); s != fuse.OK {
|
||||||
|
|
65
weed/mount/weedfs_unsupported.go
Normal file
65
weed/mount/weedfs_unsupported.go
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
package mount
|
||||||
|
|
||||||
|
import "github.com/hanwen/go-fuse/fuse"
|
||||||
|
|
||||||
|
// https://github.com/libfuse/libfuse/blob/48ae2e72b39b6a31cb2194f6f11786b7ca06aac6/include/fuse.h#L778
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy a range of data from one file to anotherNiels de Vos, 4 years ago: • libfuse: add copy_file_range() support
|
||||||
|
*
|
||||||
|
* Performs an optimized copy between two file descriptors without the
|
||||||
|
* additional cost of transferring data through the FUSE kernel module
|
||||||
|
* to user space (glibc) and then back into the FUSE filesystem again.
|
||||||
|
*
|
||||||
|
* In case this method is not implemented, applications are expected to
|
||||||
|
* fall back to a regular file copy. (Some glibc versions did this
|
||||||
|
* emulation automatically, but the emulation has been removed from all
|
||||||
|
* glibc release branches.)
|
||||||
|
*/
|
||||||
|
func (wfs *WFS) CopyFileRange(cancel <-chan struct{}, in *fuse.CopyFileRangeIn) (written uint32, code fuse.Status) {
|
||||||
|
return 0, fuse.ENOSYS
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocates space for an open file
|
||||||
|
*
|
||||||
|
* This function ensures that required space is allocated for specified
|
||||||
|
* file. If this function returns success then any subsequent write
|
||||||
|
* request to specified range is guaranteed not to fail because of lack
|
||||||
|
* of space on the file system media.
|
||||||
|
*/
|
||||||
|
func (wfs *WFS) Fallocate(cancel <-chan struct{}, in *fuse.FallocateIn) (code fuse.Status) {
|
||||||
|
return fuse.ENOSYS
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find next data or hole after the specified offset
|
||||||
|
*/
|
||||||
|
func (wfs *WFS) Lseek(cancel <-chan struct{}, in *fuse.LseekIn, out *fuse.LseekOut) fuse.Status {
|
||||||
|
return fuse.ENOSYS
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wfs *WFS) GetLk(cancel <-chan struct{}, in *fuse.LkIn, out *fuse.LkOut) (code fuse.Status) {
|
||||||
|
return fuse.ENOSYS
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wfs *WFS) SetLk(cancel <-chan struct{}, in *fuse.LkIn) (code fuse.Status) {
|
||||||
|
return fuse.ENOSYS
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wfs *WFS) SetLkw(cancel <-chan struct{}, in *fuse.LkIn) (code fuse.Status) {
|
||||||
|
return fuse.ENOSYS
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check file access permissions
|
||||||
|
*
|
||||||
|
* This will be called for the access() system call. If the
|
||||||
|
* 'default_permissions' mount option is given, this method is not
|
||||||
|
* called.
|
||||||
|
*
|
||||||
|
* This method is not called under Linux kernel versions 2.4.x
|
||||||
|
*/
|
||||||
|
func (wfs *WFS) Access(cancel <-chan struct{}, input *fuse.AccessIn) (code fuse.Status) {
|
||||||
|
return fuse.ENOSYS
|
||||||
|
}
|
Loading…
Reference in a new issue