Unlock() invalid lock object

This forum is for general developer support questions.
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: Unlock() invalid lock object

Post 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)?
AmigaOne X1000 with 2GB memory - OS4.1 FE
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Unlock() invalid lock object

Post 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.
cheers
tony
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: Unlock() invalid lock object

Post 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.
chris
Posts: 562
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: Unlock() invalid lock object

Post 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.
Post Reply