Page 2 of 2

Re: Unlock() invalid lock object

Posted: Tue Feb 09, 2016 5:02 pm
by xenic
Since "Google Drive handler" appears to be ported from MOS or 68k, will OS4 AmigaDOS only use old packets if the lock fl_DOSType field is set to a legacy filesystem (e.g. old FFS)?

Re: Unlock() invalid lock object

Posted: Tue Feb 09, 2016 9:44 pm
by tonyw
It's the file system that calls FreeDosObject() to free locks.
Of course, because it's the file system that executes the "UnLock()" call and calls IDOS->FreeDOSObject() at the end of it.
I was looking for "struct FileLock" which has apparently been replaced for OS4
It's the same thing as IDOS->Lock(), it has merely been renamed from "FileLock()" to "Lock()", since it is a generic structure.
Will OS4 AmigaDOS only use old packets if the lock fl_DOSType field is set to a legacy filesystem (e.g. old FFS)?
Not sure what it will do if you change the fl_DOSType field. I would advise against it, since DOS might send your request to the wrong file system and cause havoc.

Any old DOS packets that the program uses should be handled by the file system and DOS together - the handler may execute the DOS packet itself, or it may pass it back to DOS which will emulate the call with a series of FS primitives. If neither can process the packet, a requester will come up on the screen asking you to submit a bug report for packet number xxx.

Since you don't get such requesters here, I would imagine that the packets are being handled OK. It looks as though either someone other than DOS is zeroing the fl_Lock field, or IDOS->UnLock() is being called twice.

Re: Unlock() invalid lock object

Posted: Tue Feb 09, 2016 10:27 pm
by salass00
tonyw wrote:
It's the file system that calls FreeDosObject() to free locks.
Of course, because it's the file system that executes the "UnLock()" call and calls IDOS->FreeDOSObject() at the end of it.
It's not called directly by UnLock() so it's up to the file system implementation what actually gets called and how.

BTW DOS_LOCK support in AllocDosObject()/FreeDosObject() was added in dos.library V51 so it's unlikely that the google drive handler uses this feature.

Re: Unlock() invalid lock object

Posted: Wed Feb 10, 2016 11:24 am
by chris
xenic wrote:Since "Google Drive handler" appears to be ported from MOS or 68k, will OS4 AmigaDOS only use old packets if the lock fl_DOSType field is set to a legacy filesystem (e.g. old FFS)?
I don't think so. What it does is start with new packets and if they fail, it then uses old packets. The DOSType is largely for filesystem use only AFAIK.

I wouldn't use an existing filesystem ID in a new filesystem/handler as there's a chance the packets will get forwarded to the wrong place (with a "virtual" drive it's less of an issue, but if this was a proper volume it could potentially get mounted with the wrong filesystem), they ought to be unique.

Also I notice the OS4 version has been released now, so I guess this is sorted.