github.com/hanwen/go-fuse@v1.0.0/fuse/types_darwin.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.ENOATTR) // ENOATTR is not defined for all GOOS. 13 14 // EREMOTEIO is not supported on Darwin. 15 EREMOTEIO = Status(syscall.EIO) 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 Crtime_ uint64 // OS X 26 Atimensec uint32 27 Mtimensec uint32 28 Ctimensec uint32 29 Crtimensec_ uint32 // OS X 30 Mode uint32 31 Nlink uint32 32 Owner 33 Rdev uint32 34 Flags_ uint32 // OS X 35 } 36 37 const ( 38 FATTR_CRTIME = (1 << 28) 39 FATTR_CHGTIME = (1 << 29) 40 FATTR_BKUPTIME = (1 << 30) 41 FATTR_FLAGS = (1 << 31) 42 ) 43 44 type SetAttrIn struct { 45 SetAttrInCommon 46 47 // OS X only 48 Bkuptime_ uint64 49 Chgtime_ uint64 50 Crtime uint64 51 BkuptimeNsec uint32 52 ChgtimeNsec uint32 53 CrtimeNsec uint32 54 Flags_ uint32 // see chflags(2) 55 } 56 57 const ( 58 FOPEN_PURGE_ATTR = (1 << 30) 59 FOPEN_PURGE_UBC = (1 << 31) 60 ) 61 62 // compat with linux. 63 const ( 64 // Mask for GetAttrIn.Flags. If set, GetAttrIn has a file handle set. 65 FUSE_GETATTR_FH = (1 << 0) 66 ) 67 68 type GetAttrIn struct { 69 InHeader 70 } 71 72 func (g *GetAttrIn) Flags() uint32 { 73 return 0 74 } 75 76 func (g *GetAttrIn) Fh() uint64 { 77 return 0 78 } 79 80 // Uses OpenIn struct for create. 81 type CreateIn struct { 82 InHeader 83 84 Flags uint32 85 Mode uint32 86 } 87 88 type MknodIn struct { 89 InHeader 90 91 Mode uint32 92 Rdev uint32 93 } 94 95 type ReadIn struct { 96 InHeader 97 98 Fh uint64 99 Offset uint64 100 Size uint32 101 ReadFlags uint32 102 } 103 104 type WriteIn struct { 105 InHeader 106 Fh uint64 107 Offset uint64 108 Size uint32 109 WriteFlags uint32 110 } 111 112 type SetXAttrIn struct { 113 InHeader 114 Size uint32 115 Flags uint32 116 Position uint32 117 Padding uint32 118 } 119 120 type GetXAttrIn struct { 121 InHeader 122 Size uint32 123 Padding uint32 124 Position uint32 125 Padding2 uint32 126 } 127 128 const ( 129 CAP_CASE_INSENSITIVE = (1 << 29) 130 CAP_VOL_RENAME = (1 << 30) 131 CAP_XTIMES = (1 << 31) 132 ) 133 134 type GetxtimesOut struct { 135 Bkuptime uint64 136 Crtime uint64 137 Bkuptimensec uint32 138 Crtimensec uint32 139 } 140 141 type ExchangeIn struct { 142 InHeader 143 Olddir uint64 144 Newdir uint64 145 Options uint64 146 } 147 148 func (s *StatfsOut) FromStatfsT(statfs *syscall.Statfs_t) { 149 s.Blocks = statfs.Blocks 150 s.Bfree = statfs.Bfree 151 s.Bavail = statfs.Bavail 152 s.Files = statfs.Files 153 s.Ffree = statfs.Ffree 154 s.Bsize = uint32(statfs.Iosize) // Iosize translates to Bsize: the optimal transfer size. 155 s.Frsize = s.Bsize // Bsize translates to Frsize: the minimum transfer size. 156 }