Devices which are Expunged but don't leave...

This forum is for general developer support questions.

Devices which are Expunged but don't leave...

Postby Spirantho » Sat Mar 18, 2017 2:45 pm

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!
Spirantho
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 30
Joined: Thu Jan 26, 2012 11:54 am

Re: Devices which are Expunged but don't leave...

Postby trixie » Sat Mar 18, 2017 11:18 pm

@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().
Smoke me a kipper, I'll be back for breakfast!
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
trixie
 
Posts: 346
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic

Re: Devices which are Expunged but don't leave...

Postby tboeckel » Sun Mar 19, 2017 8:49 pm

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?
User avatar
tboeckel
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 67
Joined: Mon Jun 20, 2011 9:56 am

Re: Devices which are Expunged but don't leave...

Postby ssolie » Mon Mar 20, 2017 8:43 pm

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

There must be an error in your Expunge() vector implementation because it does work. There is some info on the wiki here:
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.
AmigaOS Development Team Lead
Be authentic. Get AmigaOS.
User avatar
ssolie
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 995
Joined: Mon Dec 20, 2010 9:51 pm
Location: Canada


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 1 guest