cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* Re: [Cocci] wireguard project looking for coccinelles to assist with Linux->NT conversion (WinDRBD)
@ 2021-07-01 13:41 Johannes Thoma
  2021-07-01 14:00 ` Jason A. Donenfeld
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Thoma @ 2021-07-01 13:41 UTC (permalink / raw)
  To: jason, cocci; +Cc: Philipp Reisner

Hi Jason,

> [ original mail: https://systeme.lip6.fr/pipermail/cocci/2021-July/008661.html ]
> I'm in the midst of doing something potentially a bit taboo in these
> parts: porting some Linux code to the NT kernel used by Windows.

I am the developer of WinDRBD, a project that ports the (Linux)
DRBD (distributed replicated block device) driver from Linux
to the NT-Kernel family. The source code can be found here:

https://github.com/LINBIT/windrbd

Not including work by Mantech we are working since almost
4 years on this port and are approaching a stable 1.0.0 release
(right now I fix things detected by Windows driver verifier).

The approach we use attempts to minimize patches to the original
source code and use a compatibility layer to map the Linux
interfaces (and behaviour) to the Windows NT interfaces (and
behaviour). Since we use Microsoft's C compiler to build the
project we need to patch some compiler specific things (like
MS C does not know gcc's typeof). Parts of the patching is
done via coccinelle but also there are lots of manual patch
files.

My advice would be to keep the compat.h header (and related
files) so that the changes to the Linux sources are kept
at a minimum. The reason for doing so is that it makes it
far more easy to keep in sync with newer wireguard / DRBD
Linux drivers that will come up. (It takes me about 1 to
2 days to upgrade DRBD changes from 1 or 2 months).

The compat layer implements for example a wait_event()
implementation which allows to use Linux wait_event / wake_up
with minimal changes to the original source code (no changes
neccessary if you are using gcc / clang to compile). Also
there is a mapping of the kernel socket API to WinSock.
As long as you are GPL feel free to re-use parts (or the whole)
of the compat layer (I'd be happy to assist you on that process).

> I was wondering if anybody on this list is a bit bored this summer and
> wanted to spend a week or two on this. It's perhaps not the most

I would love to see your project I think and hope we can
collaborate in the future,

Best regards,

- Johannes

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Cocci] wireguard project looking for coccinelles to assist with Linux->NT conversion (WinDRBD)
  2021-07-01 13:41 [Cocci] wireguard project looking for coccinelles to assist with Linux->NT conversion (WinDRBD) Johannes Thoma
@ 2021-07-01 14:00 ` Jason A. Donenfeld
  0 siblings, 0 replies; 2+ messages in thread
From: Jason A. Donenfeld @ 2021-07-01 14:00 UTC (permalink / raw)
  To: johannes; +Cc: cocci, Philipp Reisner

Hi Johannes,

On Thu, Jul 1, 2021 at 3:42 PM Johannes Thoma
<johannes@johannesthoma.com> wrote:
> The approach we use attempts to minimize patches to the original
> source code and use a compatibility layer to map the Linux
> interfaces (and behaviour) to the Windows NT interfaces (and
> behaviour). Since we use Microsoft's C compiler to build the
> project we need to patch some compiler specific things (like
> MS C does not know gcc's typeof)
> My advice would be to keep the compat.h header (and related
> files) so that the changes to the Linux sources are kept
> at a minimum.

I have no desire nor plans to do this at all in any way, shape, or
form. The compat.h header is going away, and the whole project will be
transformed into native NT code, without Linuxisms. That is why I sent
the email to the cocci mailing list -- because we're going to
transform every inch of the code base. The goal is to have a totally
separate development path, to intentionally allow the implementations
to diverge and integrate well with the unique kernel paradigms of each
respective kernel. We've done that throughout the project - to
OpenBSD, FreeBSD, Userspace in two languages, and now to NT. In each
place, we prefer native implementations that make use of native
runtime facilities. We even take that approach with UIs, using native
OS toolkits, rather than trying to use something like Qt or Electron.
So, the compat.h stuff is definitely going away.

With that said, it looks like you've built up an impressive
translation layer! (FYI, from brief perusal it looks like your RCU
implementation has some issues; I'll send you a link to mine when it's
ready -- it's fully lockless like Linux's. And your get_random_bytes
looks like a security vulnerability. We can talk about NT-specific
stuff offlist though.)

Jason
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-12  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 13:41 [Cocci] wireguard project looking for coccinelles to assist with Linux->NT conversion (WinDRBD) Johannes Thoma
2021-07-01 14:00 ` Jason A. Donenfeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).