Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial support for raw devices #76

Merged
merged 2 commits into from
Nov 7, 2016
Merged

Conversation

johanneswuerbach
Copy link
Contributor

I haven't checked, whether all kinds of volumes work, but virtual disk images do, which allows you to use sparse volumes now with xhyve.

Example:

hdiutil create -megabytes 20 -fs "MS-DOS" disk
hdiutil attach disk.dmg // Get disk number
xhyve ... -s 4:0,ahci-hd,/dev/rdiskN ...

Ported from machyve/xhyve#80

goto err;
}
assert(blocks != 0);
assert(sectsz != 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should probably be dynamic checks that also perror, in case we compile with asserts disabled.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since they were commented out before I presume these originally come from bhyve and it would be better not to diverge on such trivial things. Maybe bhyve could be changed too though.

To that end, rebasing this PR onto #75 seems like a good idea to me.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed its not worth the divergence.

@@ -618,17 +618,17 @@ blockif_open(const char *optstr, const char *ident)
sectsz = DEV_BSIZE;
psectsz = psectoff = 0;
candelete = geom = 0;
blocks = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please indent to match the surrounding code (and again in the following if/ioctl combination).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, editor fail :-(

@ijc
Copy link
Collaborator

ijc commented Nov 3, 2016

Nice work. Apart from my comments on the code it would be good if the commit message incorporated the info from the PR text too since it is useful reference information IMHO.

I expect hyperkit.1 probably needs updating to reflect this change too.

@johanneswuerbach
Copy link
Contributor Author

Regarding the hyperkit.1, I just modified the last example (could also create a new one) The other parts seem to already mention using devices like /dev/disk even when is wasn't working.

@ijc
Copy link
Collaborator

ijc commented Nov 4, 2016

LGTM but please rebase onto master now that #75 has been merged (should make your patch a lot smaller too, which is good!)

1 similar comment
@ijc
Copy link
Collaborator

ijc commented Nov 4, 2016

LGTM but please rebase onto master now that #75 has been merged (should make your patch a lot smaller too, which is good!)

@johanneswuerbach johanneswuerbach force-pushed the raw-devices branch 2 times, most recently from 328640c to fdda0f7 Compare November 4, 2016 13:19
Support for using virtual disk images.

Example:

```
hdiutil create -megabytes 20 -fs "MS-DOS" disk
hdiutil attach disk.dmg // Get disk number N
xhyve ... -s 4:0,ahci-hd,/dev/rdiskN ...
```

Signed-off-by: Johannes Würbach <johannes.wuerbach@googlemail.com>
@johanneswuerbach
Copy link
Contributor Author

Rebased 👍

@johanneswuerbach
Copy link
Contributor Author

Added a small test in a separate commit, wdyt?

Test whether a disk image is mountable & writable inside the VM
and whether the result is readable again by macOS.

Signed-off-by: Johannes Würbach <johannes.wuerbach@googlemail.com>
@ijc
Copy link
Collaborator

ijc commented Nov 7, 2016

LGTM, merging, thanks

@ijc ijc merged commit 00f4e16 into moby:master Nov 7, 2016
@johanneswuerbach johanneswuerbach deleted the raw-devices branch November 7, 2016 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants