github.com/hanwen/go-fuse@v1.0.0/fuse/types_linux.go (about)

     1  // Copyright 2016 the Go-FUSE Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package fuse
     6  
     7  import (
     8  	"syscall"
     9  )
    10  
    11  const (
    12  	ENOATTR = Status(syscall.ENODATA) // On Linux, ENOATTR is an alias for ENODATA.
    13  
    14  	// EREMOTEIO Remote I/O error
    15  	EREMOTEIO = Status(syscall.EREMOTEIO)
    16  )
    17  
    18  type Attr struct {
    19  	Ino       uint64
    20  	Size      uint64
    21  	Blocks    uint64
    22  	Atime     uint64
    23  	Mtime     uint64
    24  	Ctime     uint64
    25  	Atimensec uint32
    26  	Mtimensec uint32
    27  	Ctimensec uint32
    28  	Mode      uint32
    29  	Nlink     uint32
    30  	Owner
    31  	Rdev    uint32
    32  	Blksize uint32
    33  	Padding uint32
    34  }
    35  
    36  type SetAttrIn struct {
    37  	SetAttrInCommon
    38  }
    39  
    40  const (
    41  	// Mask for GetAttrIn.Flags. If set, GetAttrIn has a file handle set.
    42  	FUSE_GETATTR_FH = (1 << 0)
    43  )
    44  
    45  type GetAttrIn struct {
    46  	InHeader
    47  
    48  	Flags_ uint32
    49  	Dummy  uint32
    50  	Fh_    uint64
    51  }
    52  
    53  // Flags accesses the flags. This is a method, because OSXFuse does not
    54  // have GetAttrIn flags.
    55  func (g *GetAttrIn) Flags() uint32 {
    56  	return g.Flags_
    57  }
    58  
    59  // Fh accesses the file handle. This is a method, because OSXFuse does not
    60  // have GetAttrIn flags.
    61  func (g *GetAttrIn) Fh() uint64 {
    62  	return g.Fh_
    63  }
    64  
    65  type CreateIn struct {
    66  	InHeader
    67  	Flags uint32
    68  
    69  	// Mode for the new file; already takes Umask into account.
    70  	Mode uint32
    71  
    72  	// Umask used for this create call.
    73  	Umask   uint32
    74  	Padding uint32
    75  }
    76  
    77  type MknodIn struct {
    78  	InHeader
    79  
    80  	// Mode to use, including the Umask value
    81  	Mode    uint32
    82  	Rdev    uint32
    83  	Umask   uint32
    84  	Padding uint32
    85  }
    86  
    87  type ReadIn struct {
    88  	InHeader
    89  	Fh        uint64
    90  	Offset    uint64
    91  	Size      uint32
    92  	ReadFlags uint32
    93  	LockOwner uint64
    94  	Flags     uint32
    95  	Padding   uint32
    96  }
    97  
    98  type WriteIn struct {
    99  	InHeader
   100  	Fh         uint64
   101  	Offset     uint64
   102  	Size       uint32
   103  	WriteFlags uint32
   104  	LockOwner  uint64
   105  	Flags      uint32
   106  	Padding    uint32
   107  }
   108  
   109  type SetXAttrIn struct {
   110  	InHeader
   111  	Size  uint32
   112  	Flags uint32
   113  }
   114  
   115  type GetXAttrIn struct {
   116  	InHeader
   117  	Size    uint32
   118  	Padding uint32
   119  }
   120  
   121  func (s *StatfsOut) FromStatfsT(statfs *syscall.Statfs_t) {
   122  	s.Blocks = statfs.Blocks
   123  	s.Bsize = uint32(statfs.Bsize)
   124  	s.Bfree = statfs.Bfree
   125  	s.Bavail = statfs.Bavail
   126  	s.Files = statfs.Files
   127  	s.Ffree = statfs.Ffree
   128  	s.Frsize = uint32(statfs.Frsize)
   129  	s.NameLen = uint32(statfs.Namelen)
   130  }