Hi everybody,
In my device I have a little Expunge function which just sets md->cw_device.dd_Library.lib_Flags |= LIBF_DELEXP and returns 0.
In the past I could get rid of the device using an avail flush or whatever, but now nothing I seem to do (since I updated to FE?) gets rid of the old device code so I have to keep rebooting to try my new builds.
Is there an example of what should be in my Expunge() routine to make it leave cleanly?
Thanks!
Devices which are Expunged but don't leave...
Re: Devices which are Expunged but don't leave...
@Spirantho
I've never coded a device but I'd say that the expunge procedure will be similar to (if not the same as) that of a library.
Normally, in the expunge function you should check the library instance counter (lib_OpenCnt), and if it is > 0, set lib_Flags |= LIBF_DELEXP and return 0 (LIBF_DELEXP stands for delayed expunge: something else is still using the library, so we can't expunge right now). If the counter == 0, you do your library cleanup, then IExec->Remove() from the system library list, and IExec->DeleteLibrary().
I've never coded a device but I'd say that the expunge procedure will be similar to (if not the same as) that of a library.
Normally, in the expunge function you should check the library instance counter (lib_OpenCnt), and if it is > 0, set lib_Flags |= LIBF_DELEXP and return 0 (LIBF_DELEXP stands for delayed expunge: something else is still using the library, so we can't expunge right now). If the counter == 0, you do your library cleanup, then IExec->Remove() from the system library list, and IExec->DeleteLibrary().
The Rear Window blog
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Re: Devices which are Expunged but don't leave...
The latest SDK should include the "Expunge" tool to specifically expunge single libraries/devices (i.e. "Expunge my.device") or multiple libraries/devices matching a pattern (i.e. "Expunge my_#?.device" to expunge "my_first.device" and "my_second.device") from memory.
Apart from that you should obey what Trixie already said. The LIBF_DELEXP flag should only be set if your library/device cannot be expunged when your Expunge vector is called, because it is still opened. But if there are no living instances then you should of course do the actual expunging. When else would you do it otherwise if no in the Expunge vector?
Apart from that you should obey what Trixie already said. The LIBF_DELEXP flag should only be set if your library/device cannot be expunged when your Expunge vector is called, because it is still opened. But if there are no living instances then you should of course do the actual expunging. When else would you do it otherwise if no in the Expunge vector?
Re: Devices which are Expunged but don't leave...
There must be an error in your Expunge() vector implementation because it does work. There is some info on the wiki here:Spirantho wrote:In the past I could get rid of the device using an avail flush or whatever, but now nothing I seem to do (since I updated to FE?) gets rid of the old device code so I have to keep rebooting to try my new builds...
http://wiki.amigaos.net/wiki/Exec_Devic ... g_a_Device
Normally, all you should have to do is replace the file and the OS will auto-magically expunge it for you.
In cases where replacing the file is not possible there is an Expunge command in your SDK to trigger an expunge manually.
ExecSG Team Lead