Commit ef7c274
feat(windows): virtiofs Phase 2 - file read operations
Implement Phase 2 of Windows virtiofs passthrough filesystem:
File operations:
- open(): Open file for reading with handle management
- Validates file exists and is regular file
- Creates handle and stores in HandleData tracking
- Supports O_DIRECT and O_SYNC flags
- Returns OpenOptions for cache control
- read(): Read file data with zero-copy support
- Retrieves path from handle
- Opens file and seeks to offset
- Reads requested size into buffer
- Writes to ZeroCopyWriter for efficient transfer
- release(): Close file handle
- Removes handle from tracking map
- Cleans up resources
- statfs(): Get filesystem statistics
- Uses GetDiskFreeSpaceExW Windows API
- Returns disk space information (total, free, available)
- Provides synthetic inode counts
- 4KB block size for compatibility
Windows API integration:
- GetDiskFreeSpaceExW for disk space queries
- std::fs::File for file I/O operations
- Proper error handling with POSIX errno mapping
Phase 2 provides complete read-only file access capability.
Phase 3 will add write operations (create, write, unlink, mkdir, rmdir).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent c769137 commit ef7c274
1 file changed
Lines changed: 128 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
446 | 447 | | |
447 | 448 | | |
448 | 449 | | |
449 | | - | |
450 | | - | |
451 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
452 | 504 | | |
453 | 505 | | |
454 | 506 | | |
| |||
472 | 524 | | |
473 | 525 | | |
474 | 526 | | |
475 | | - | |
476 | | - | |
| 527 | + | |
| 528 | + | |
477 | 529 | | |
478 | | - | |
479 | | - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
480 | 565 | | |
481 | 566 | | |
482 | 567 | | |
483 | 568 | | |
484 | 569 | | |
485 | 570 | | |
486 | 571 | | |
487 | | - | |
| 572 | + | |
488 | 573 | | |
489 | 574 | | |
490 | 575 | | |
491 | 576 | | |
492 | | - | |
493 | | - | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
494 | 580 | | |
495 | 581 | | |
496 | 582 | | |
| |||
516 | 602 | | |
517 | 603 | | |
518 | 604 | | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
523 | 609 | | |
524 | 610 | | |
525 | 611 | | |
526 | | - | |
527 | | - | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
528 | 639 | | |
529 | 640 | | |
530 | 641 | | |
| |||
0 commit comments