sj-i /
php-fuse
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * This file is part of the sj-i/php-fuse package. |
||
| 5 | * |
||
| 6 | * (c) sji <[email protected]> |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view the LICENSE |
||
| 9 | * file that was distributed with this source code. |
||
| 10 | */ |
||
| 11 | |||
| 12 | declare(strict_types=1); |
||
| 13 | |||
| 14 | namespace Fuse\Filesystem\Delegation; |
||
| 15 | |||
| 16 | use Fuse\FilesystemFlagsImplementationTrait; |
||
| 17 | use Fuse\FilesystemInterface; |
||
| 18 | use Fuse\Libc\Fcntl\Flock; |
||
| 19 | use Fuse\Libc\Fuse\FuseBufVec; |
||
| 20 | use Fuse\Libc\Fuse\FuseConnInfo; |
||
| 21 | use Fuse\Libc\Fuse\FuseDirFill; |
||
| 22 | use Fuse\Libc\Fuse\FuseDirHandle; |
||
| 23 | use Fuse\Libc\Fuse\FuseFileInfo; |
||
| 24 | use Fuse\Libc\Fuse\FuseFillDir; |
||
| 25 | use Fuse\Libc\Fuse\FuseIoctlArgPointer; |
||
| 26 | use Fuse\Libc\Fuse\FuseIoctlDataPointer; |
||
| 27 | use Fuse\Libc\Fuse\FusePollHandle; |
||
| 28 | use Fuse\Libc\Fuse\FusePrivateData; |
||
| 29 | use Fuse\Libc\Fuse\FuseReadDirBuffer; |
||
| 30 | use Fuse\Libc\String\CBytesBuffer; |
||
| 31 | use Fuse\Libc\String\CStringBuffer; |
||
| 32 | use Fuse\Libc\Sys\Stat\Stat; |
||
| 33 | use Fuse\Libc\Sys\StatVfs\StatVfs; |
||
| 34 | use Fuse\Libc\Time\TimeSpec; |
||
| 35 | use Fuse\Libc\Utime\UtimBuf; |
||
| 36 | use Fuse\MountableFilesystemTrait; |
||
| 37 | use TypedCData\TypedCDataArray; |
||
|
0 ignored issues
–
show
|
|||
| 38 | |||
| 39 | trait DelegationFilesystemTrait |
||
| 40 | { |
||
| 41 | use MountableFilesystemTrait; |
||
| 42 | use FilesystemFlagsImplementationTrait; |
||
| 43 | |||
| 44 | private FilesystemInterface $filesystem; |
||
| 45 | |||
| 46 | private function setDelegation(FilesystemInterface $filesystem): void |
||
| 47 | { |
||
| 48 | $this->filesystem = $filesystem; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** @return int|null|FusePrivateData|void */ |
||
| 52 | private function delegate(string $method_name, array $args) |
||
| 53 | { |
||
| 54 | /** @var int|null|FusePrivateData|void */ |
||
| 55 | return $this->filesystem->$method_name(...$args); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * int (*getattr) (const char *, struct stat *); |
||
| 60 | */ |
||
| 61 | public function getattr(string $path, Stat $stat): int |
||
| 62 | { |
||
| 63 | /** @var int */ |
||
| 64 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * int (*readlink) (const char *, char *, size_t); |
||
| 69 | */ |
||
| 70 | public function readlink(string $path, CStringBuffer $buffer, int $size): int |
||
| 71 | { |
||
| 72 | /** @var int */ |
||
| 73 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t); |
||
| 78 | * |
||
| 79 | * @deprecated |
||
| 80 | */ |
||
| 81 | public function getdir(string $path, FuseDirHandle $dirhandle, FuseDirFill $dirfill): int |
||
| 82 | { |
||
| 83 | /** @var int */ |
||
| 84 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * int (*mknod) (const char *, mode_t, dev_t); |
||
| 89 | */ |
||
| 90 | public function mknod(string $path, int $mode, int $dev): int |
||
| 91 | { |
||
| 92 | /** @var int */ |
||
| 93 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * int (*mkdir) (const char *, mode_t); |
||
| 98 | */ |
||
| 99 | public function mkdir(string $path, int $mode): int |
||
| 100 | { |
||
| 101 | /** @var int */ |
||
| 102 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 103 | } |
||
| 104 | |||
| 105 | /** |
||
| 106 | * int (*unlink) (const char *); |
||
| 107 | */ |
||
| 108 | public function unlink(string $path): int |
||
| 109 | { |
||
| 110 | /** @var int */ |
||
| 111 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 112 | } |
||
| 113 | |||
| 114 | /** |
||
| 115 | * int (*rmdir) (const char *); |
||
| 116 | */ |
||
| 117 | public function rmdir(string $path): int |
||
| 118 | { |
||
| 119 | /** @var int */ |
||
| 120 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 121 | } |
||
| 122 | |||
| 123 | /** |
||
| 124 | * int (*symlink) (const char *, const char *); |
||
| 125 | */ |
||
| 126 | public function symlink(string $path, string $link): int |
||
| 127 | { |
||
| 128 | /** @var int */ |
||
| 129 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 130 | } |
||
| 131 | |||
| 132 | /** |
||
| 133 | * int (*rename) (const char *, const char *); |
||
| 134 | */ |
||
| 135 | public function rename(string $from, string $to): int |
||
| 136 | { |
||
| 137 | /** @var int */ |
||
| 138 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 139 | } |
||
| 140 | |||
| 141 | /** |
||
| 142 | * int (*link) (const char *, const char *); |
||
| 143 | */ |
||
| 144 | public function link(string $path, string $link): int |
||
| 145 | { |
||
| 146 | /** @var int */ |
||
| 147 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 148 | } |
||
| 149 | |||
| 150 | /** |
||
| 151 | * int (*chmod) (const char *, mode_t); |
||
| 152 | */ |
||
| 153 | public function chmod(string $path, int $mode): int |
||
| 154 | { |
||
| 155 | /** @var int */ |
||
| 156 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 157 | } |
||
| 158 | |||
| 159 | /** |
||
| 160 | * int (*chown) (const char *, uid_t, gid_t); |
||
| 161 | */ |
||
| 162 | public function chown(string $path, int $uid, int $gid): int |
||
| 163 | { |
||
| 164 | /** @var int */ |
||
| 165 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 166 | } |
||
| 167 | |||
| 168 | /** |
||
| 169 | * int (*truncate) (const char *, off_t); |
||
| 170 | */ |
||
| 171 | public function truncate(string $path, int $offset): int |
||
| 172 | { |
||
| 173 | /** @var int */ |
||
| 174 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 175 | } |
||
| 176 | |||
| 177 | /** |
||
| 178 | * int (*utime) (const char *, struct utimbuf *); |
||
| 179 | */ |
||
| 180 | public function utime(string $path, UtimBuf $utime_buf): int |
||
| 181 | { |
||
| 182 | /** @var int */ |
||
| 183 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 184 | } |
||
| 185 | |||
| 186 | /** |
||
| 187 | * int (*open) (const char *, struct fuse_file_info *); |
||
| 188 | */ |
||
| 189 | public function open(string $path, FuseFileInfo $fuse_file_info): int |
||
| 190 | { |
||
| 191 | /** @var int */ |
||
| 192 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 193 | } |
||
| 194 | |||
| 195 | /** |
||
| 196 | * int (*read) (const char *, char *, size_t, off_t, struct fuse_file_info *); |
||
| 197 | */ |
||
| 198 | public function read(string $path, CBytesBuffer $buffer, int $size, int $offset, FuseFileInfo $fuse_file_info): int |
||
| 199 | { |
||
| 200 | /** @var int */ |
||
| 201 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 202 | } |
||
| 203 | |||
| 204 | /** |
||
| 205 | * int (*write) (const char *, const char *, size_t, off_t, struct fuse_file_info *); |
||
| 206 | */ |
||
| 207 | public function write(string $path, string $buffer, int $size, int $offset, FuseFileInfo $fuse_file_info): int |
||
| 208 | { |
||
| 209 | /** @var int */ |
||
| 210 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 211 | } |
||
| 212 | |||
| 213 | /** |
||
| 214 | * int (*statfs) (const char *, struct statvfs *); |
||
| 215 | */ |
||
| 216 | public function statfs(string $path, StatVfs $statvfs): int |
||
| 217 | { |
||
| 218 | /** @var int */ |
||
| 219 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 220 | } |
||
| 221 | |||
| 222 | /** |
||
| 223 | * int (*flush) (const char *, struct fuse_file_info *); |
||
| 224 | */ |
||
| 225 | public function flush(string $path, FuseFileInfo $fuse_file_info): int |
||
| 226 | { |
||
| 227 | /** @var int */ |
||
| 228 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 229 | } |
||
| 230 | |||
| 231 | /** |
||
| 232 | * int (*release) (const char *, struct fuse_file_info *); |
||
| 233 | */ |
||
| 234 | public function release(string $path, FuseFileInfo $fuse_file_info): int |
||
| 235 | { |
||
| 236 | /** @var int */ |
||
| 237 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 238 | } |
||
| 239 | |||
| 240 | /** |
||
| 241 | * int (*fsync) (const char *, int, struct fuse_file_info *); |
||
| 242 | */ |
||
| 243 | public function fsync(string $path, int $flags, FuseFileInfo $fuse_file_info): int |
||
| 244 | { |
||
| 245 | /** @var int */ |
||
| 246 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 247 | } |
||
| 248 | |||
| 249 | /** |
||
| 250 | * int (*setxattr) (const char *, const char *, const char *, size_t, int); |
||
| 251 | */ |
||
| 252 | public function setxattr(string $path, string $name, string $value, int $size): int |
||
| 253 | { |
||
| 254 | /** @var int */ |
||
| 255 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 256 | } |
||
| 257 | |||
| 258 | /** |
||
| 259 | * int (*getxattr) (const char *, const char *, char *, size_t); |
||
| 260 | */ |
||
| 261 | public function getxattr(string $path, string $name, ?string &$value, int $size): int |
||
| 262 | { |
||
| 263 | /** @var int */ |
||
| 264 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 265 | } |
||
| 266 | |||
| 267 | /** |
||
| 268 | * int (*listxattr) (const char *, char *, size_t);* |
||
| 269 | */ |
||
| 270 | public function listxattr(string $path, ?string &$value, int $size): int |
||
| 271 | { |
||
| 272 | /** @var int */ |
||
| 273 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 274 | } |
||
| 275 | |||
| 276 | /** |
||
| 277 | * int (*removexattr) (const char *, const char *); |
||
| 278 | */ |
||
| 279 | public function removexattr(string $path, string $name): int |
||
| 280 | { |
||
| 281 | /** @var int */ |
||
| 282 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 283 | } |
||
| 284 | |||
| 285 | /** |
||
| 286 | * int (*opendir) (const char *, struct fuse_file_info *); |
||
| 287 | */ |
||
| 288 | public function opendir(string $path, FuseFileInfo $fuse_file_info): int |
||
| 289 | { |
||
| 290 | /** @var int */ |
||
| 291 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 292 | } |
||
| 293 | |||
| 294 | /** |
||
| 295 | * int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *); |
||
| 296 | */ |
||
| 297 | public function readdir( |
||
| 298 | string $path, |
||
| 299 | FuseReadDirBuffer $buf, |
||
| 300 | FuseFillDir $filler, |
||
| 301 | int $offset, |
||
| 302 | FuseFileInfo $fuse_file_info |
||
| 303 | ): int { |
||
| 304 | /** @var int */ |
||
| 305 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 306 | } |
||
| 307 | |||
| 308 | /** |
||
| 309 | * int (*releasedir) (const char *, struct fuse_file_info *); |
||
| 310 | */ |
||
| 311 | public function releasedir(string $path, FuseFileInfo $fuse_file_info): int |
||
| 312 | { |
||
| 313 | /** @var int */ |
||
| 314 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 315 | } |
||
| 316 | |||
| 317 | /** |
||
| 318 | * int (*fsyncdir) (const char *, int, struct fuse_file_info *); |
||
| 319 | */ |
||
| 320 | public function fsyncdir(string $path, FuseFileInfo $fuse_file_info): int |
||
| 321 | { |
||
| 322 | /** @var int */ |
||
| 323 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 324 | } |
||
| 325 | |||
| 326 | /** |
||
| 327 | * void *(*init) (struct fuse_conn_info *conn); |
||
| 328 | */ |
||
| 329 | public function init(FuseConnInfo $conn): ?FusePrivateData |
||
| 330 | { |
||
| 331 | /** @var ?FusePrivateData */ |
||
| 332 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 333 | } |
||
| 334 | |||
| 335 | /** |
||
| 336 | * void (*destroy) (void *); |
||
| 337 | */ |
||
| 338 | public function destroy(?FusePrivateData $private_data): void |
||
| 339 | { |
||
| 340 | $this->delegate(__FUNCTION__, func_get_args()); |
||
| 341 | } |
||
| 342 | |||
| 343 | /** |
||
| 344 | * int (*access) (const char *, int); |
||
| 345 | */ |
||
| 346 | public function access(string $path, int $mode): int |
||
| 347 | { |
||
| 348 | /** @var int */ |
||
| 349 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 350 | } |
||
| 351 | |||
| 352 | /** |
||
| 353 | * int (*create) (const char *, mode_t, struct fuse_file_info *); |
||
| 354 | */ |
||
| 355 | public function create(string $path, int $mode, FuseFileInfo $fuse_file_info): int |
||
| 356 | { |
||
| 357 | /** @var int */ |
||
| 358 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 359 | } |
||
| 360 | |||
| 361 | /** |
||
| 362 | * int (*ftruncate) (const char *, off_t, struct fuse_file_info *); |
||
| 363 | */ |
||
| 364 | public function ftruncate(string $path, int $offset, FuseFileInfo $fuse_file_info): int |
||
| 365 | { |
||
| 366 | /** @var int */ |
||
| 367 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 368 | } |
||
| 369 | |||
| 370 | /** |
||
| 371 | * int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *); |
||
| 372 | */ |
||
| 373 | public function fgetattr(string $path, Stat $stat, FuseFileInfo $fuse_file_info): int |
||
| 374 | { |
||
| 375 | /** @var int */ |
||
| 376 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 377 | } |
||
| 378 | |||
| 379 | /** |
||
| 380 | * int (*lock) (const char *, struct fuse_file_info *, int cmd, struct flock *); |
||
| 381 | */ |
||
| 382 | public function lock(string $path, FuseFileInfo $fuse_file_info, int $cmd, Flock $flock): int |
||
| 383 | { |
||
| 384 | /** @var int */ |
||
| 385 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 386 | } |
||
| 387 | |||
| 388 | /** |
||
| 389 | * int (*utimens) (const char *, const struct timespec tv[2]); |
||
| 390 | * |
||
| 391 | * @param TypedCDataArray<TimeSpec> $tv |
||
| 392 | */ |
||
| 393 | public function utimens(string $path, TypedCDataArray $tv): int |
||
| 394 | { |
||
| 395 | /** @var int */ |
||
| 396 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 397 | } |
||
| 398 | |||
| 399 | /** |
||
| 400 | * int (*bmap) (const char *, size_t blocksize, uint64_t *idx); |
||
| 401 | */ |
||
| 402 | public function bmap(string $path, int $blocksize, int &$idx): int |
||
| 403 | { |
||
| 404 | /** @var int */ |
||
| 405 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 406 | } |
||
| 407 | |||
| 408 | /** |
||
| 409 | * int (*ioctl) (const char *, int cmd, void *arg, struct fuse_file_info *, unsigned int flags, void *data); |
||
| 410 | */ |
||
| 411 | public function ioctl( |
||
| 412 | string $path, |
||
| 413 | int $cmd, |
||
| 414 | FuseIoctlArgPointer $arg, |
||
| 415 | FuseFileInfo $fuse_file_info, |
||
| 416 | int $flags, |
||
| 417 | FuseIoctlDataPointer $data |
||
| 418 | ): int { |
||
| 419 | /** @var int */ |
||
| 420 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 421 | } |
||
| 422 | |||
| 423 | /** |
||
| 424 | * int (*poll) (const char *, struct fuse_file_info *, struct fuse_pollhandle *ph, unsigned *reventsp); |
||
| 425 | */ |
||
| 426 | public function poll( |
||
| 427 | string $path, |
||
| 428 | FuseFileInfo $fuse_file_info, |
||
| 429 | FusePollHandle $fuse_pollhandle, |
||
| 430 | int &$reventsp |
||
| 431 | ): int { |
||
| 432 | /** @var int */ |
||
| 433 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 434 | } |
||
| 435 | |||
| 436 | /** |
||
| 437 | * int (*write_buf) (const char *, struct fuse_bufvec *buf, off_t off, struct fuse_file_info *); |
||
| 438 | */ |
||
| 439 | public function writeBuf(string $path, FuseBufVec $buf, int $offset, FuseFileInfo $fuse_file_info): int |
||
| 440 | { |
||
| 441 | /** @var int */ |
||
| 442 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 443 | } |
||
| 444 | |||
| 445 | /** |
||
| 446 | * int (*read_buf) (const char *, struct fuse_bufvec **bufp, size_t size, off_t off, struct fuse_file_info *); |
||
| 447 | * |
||
| 448 | * @param TypedCDataArray<FuseBufVec> $bufp |
||
| 449 | */ |
||
| 450 | public function readBuf( |
||
| 451 | string $path, |
||
| 452 | TypedCDataArray $bufp, |
||
| 453 | int $size, |
||
| 454 | int $offset, |
||
| 455 | FuseFileInfo $fuse_file_info |
||
| 456 | ): int { |
||
| 457 | /** @var int */ |
||
| 458 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 459 | } |
||
| 460 | |||
| 461 | /** |
||
| 462 | * int (*flock) (const char *, struct fuse_file_info *, int op); |
||
| 463 | */ |
||
| 464 | public function flock(string $path, FuseFileInfo $fuse_file_info, int $op): int |
||
| 465 | { |
||
| 466 | /** @var int */ |
||
| 467 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 468 | } |
||
| 469 | |||
| 470 | /** |
||
| 471 | * int (*fallocate) (const char *, int, off_t, off_t, struct fuse_file_info *); |
||
| 472 | */ |
||
| 473 | public function fallocate(string $path, int $mode, int $offset, FuseFileInfo $fuse_file_info): int |
||
| 474 | { |
||
| 475 | /** @var int */ |
||
| 476 | return $this->delegate(__FUNCTION__, func_get_args()); |
||
|
0 ignored issues
–
show
|
|||
| 477 | } |
||
| 478 | } |
||
| 479 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths