🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.internals
Article #2544

how to free up allocated clists ?

#2544
From: Paul Barton-Davis
Date: Wed, 19 Jun 1991 00:19
53 lines
2030 bytes
Here's an easy one for someone. I presumed a need to free up any
allocated clist cblocks that have been allocated by my device driver
when I finally close the device. It wasn't clear to me how to do this
from the descriptions of the various put/get clblock options, but
here's what I came up with (the entire close entry point is included):

pc21close (dev, flag)

dev_t dev;
int flag;

{
    register int unit;
    register int i;
    struct cblock *free_block;
    int x;

    if ((unit = minor (dev)) >= pc21_max)
    {
	u.u_error = ENODEV;
	return;
    }

    /* mark the board as available
     */

    pc21_params[unit].status &= ~PC21_BUSY;

    /* remove cblocks from output clist
     */

X    x = splcli();
X    while ((free_block = getcb (&(pc21_params[unit].output))) !=
X	   (struct cblock *) NULL)
X	putcf (free_block);
X    splx (x);

    u.u_error = 0;
    return;
}
 
Can someone tell me if the lines marked with an "X" do what I want
them to: get each allocated cblock and return it too the free list ?
Is there a better way to do this, or can I even forget about it
completely ?

Thanks for any advice - I'm hoping this isn't the source of a problem
we're having on a machine running this driver.
-- 
Paul Barton-Davis                                 <pauld@cs.washington.edu>

Man has survived because he did not know how to realize his wishes.
Now that he can realize them, he must either change them, or perish.
Technical Details
Message-ID: <1991Jun19.001950.10530@beaver.cs.washington.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zephyr.ens.tek.com!uw-beaver!stowe.cs.washington.edu!pauld

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zephyr.ens.tek.com!uw-beaver!stowe.cs.washington.edu!pauld
From: pauld@cs.washington.edu (Paul Barton-Davis)
Newsgroups: comp.unix.internals
Subject: how to free up allocated clists ?
Message-ID: <1991Jun19.001950.10530@beaver.cs.washington.edu>
Date: 19 Jun 91 00:19:50 GMT
Sender: news@beaver.cs.washington.edu (USENET News System)
Organization: Computer Science & Engineering, U. of Washington, Seattle
Lines: 53
Originator: pauld@stowe.cs.washington.edu