Re: [PATCH] (locking) (was Re: dosemu and CLIPPER locks (again))

Bart Oldeman
2003-02-11T17:11:11Z

On 11 Feb 2003, Sergey Suleymanov wrote:

> >>>>> Bart Oldeman writes:
>
> Bart> But Windows locking and Linux locking techniques are
> Bart> incompatible so translating them through smbfs transforms
> Bart> information.
>
> Do you know how Samba server's _posix_ locking consist with
> Dosemu's one? I mean, is samba's mapping SMB locks to posix
> locks compatible enough to dosemu's emulation?

it used to be a similar mapping for byte range locks (code lifted from
samba). locking was reworked for samba 2.2 however.

There are some files you can browse here:
http://samba.org/cgi-bin/cvsweb/samba/source/locking/
and also
http://samba.org/cgi-bin/cvsweb/samba/source/smbd/open.c

and there's a very complicated function there now which requires ASCII art
to understand. Hmm.

as for file locking, Samba appears to maintain a database of what mode the
clients use -- that's possible since it's a server; multiple DOSEMU
instances don't share this information.

Also Samba always tries to open files r/w on the server whereas DOSEMU
MFS opens them r/o if DOS opens a file r/o. This works around the problem
that exclusive POSIX locks cannot be applied to r/o-opened files. This
technique could be used by DOSEMU too (DOS apps still think their open
is r/o and MFS can stop writes) but I'm not sure if it's a good idea...

Bart