( )⚙ D106 cdatapack: add some windows portability

This is an archive of the discontinued Mercurial Phabricator instance.

cdatapack: add some windows portability
ClosedPublic

Authored by ikostia on Jul 17 2017, 11:24 AM.
Tags
None
Subscribers
None

Details

Reviewers
durham
dsp
Group Reviewers
Restricted Project
Commits
rFBHGXb8a935ce949b: cdatapack: add some windows portability
Summary

This is a first set of changes to help cdatapack compile on Windows. Second
set will include adding some way of using mman on Windows.

Test Plan
  • make local on Linux, rt
  • with some intermediary solution for mman this also builds on Windows 10, I was able to produce cdatapack_get.exe and cdatapack_dump.exe. Here's an example:
PS C:\Code\fb-hg-rpms\fb-hgext\cdatapack> .\cdatapack_get.exe 3ba0b10b8d251743a2692e042b114c1204b19d74 88dadb363234ec4fec3df85810810d6073288350

xplat/third-party/yarn/offline-mirror/smoothscroll-polyfill-0.3.5.tgz
Node                                      Delta Base                                Delta SHA1                                Delta Length
88dadb363234ec4fec3df85810810d6073288350  0000000000000000000000000000000000000000  466e6039b51cb525d70e1a5077ef81e064678eae  26057

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Branch
default
Lint
Lint OK
Unit
Unit Tests OK

Event Timeline

ikostia created this revision.Jul 17 2017, 11:24 AM
Herald added a reviewer: Restricted Project. · View Herald TranscriptJul 17 2017, 11:24 AM
ikostia added inline comments.Jul 17 2017, 11:34 AM
clib/portability/portability.h
17

This is bad, but according to @durham ok for cdatapack purposes.

durham added inline comments.Jul 17 2017, 12:22 PM
clib/portability/inet.h
6

What does this line do? Does it need a comment?

clib/portability/portability.h
17

Hmm, I'm not sure this is safe. I think the code is defining these structs such that they match the on disk format exactly. We'd need to make sure visual studio is doing the same thing.

ikostia planned changes to this revision.Jul 17 2017, 12:58 PM
ikostia added inline comments.
clib/portability/inet.h
6

I think it hints Windows that this .lib file is needed at link time..?
Honestly, I just copied it from https://msdn.microsoft.com/en-us/library/windows/desktop/ms737629(v=vs.85).aspx, but I can read up on it I guess.

clib/portability/portability.h
17

Let me look into https://msdn.microsoft.com/en-us/library/2e70t5y1.aspx, potentially we can use it to achieve the same thing.

ikostia updated this revision to Diff 222.Jul 17 2017, 6:38 PM

fix structure packing portability

ikostia marked 3 inline comments as done.Jul 17 2017, 6:39 PM
ikostia updated this revision to Diff 223.Jul 17 2017, 6:46 PM

some nits

durham accepted this revision.EditedJul 18 2017, 5:51 AM

Could you build and run the tests on linux to make sure the new packed declartion stuff passes there?

Edit: though perhaps you already did, based on the test plan

This revision is now accepted and ready to land.Jul 18 2017, 5:51 AM

Isn't that what I did in the test plan?)

Yea, my bad. Didn't read it thoroughly enough

This revision was automatically updated to reflect the committed changes.