Ejemplo n.º 1
0
/*
 * close method of the file structure
 */
void
wav_close(struct file *file)
{
	struct wav *f = (struct wav *)file, **pf;

	if (f->mode & MODE_RECMASK) {
		pipe_trunc(&f->pipe.file, f->endpos);
		if (f->hdr == HDR_WAV) {
			wav_writehdr(f->pipe.fd,
			    &f->hpar,
			    &f->startpos,
			    f->endpos - f->startpos);
		}
	}
	pipe_close(file);
	if (f->pstate != WAV_CFG)
		dev_unref(f->dev);
	for (pf = &wav_list; *pf != f; pf = &(*pf)->next) {
#ifdef DEBUG
		if (*pf == NULL) {
			dbg_puts("wav_close: not on list\n");
			dbg_panic();
		}
#endif
	}
	*pf = f->next;
}
Ejemplo n.º 2
0
void dev_lst_free (dev_list_t *lst)
{
	device_t *dev;

	while (lst->head != NULL) {
		dev = lst->head;
		lst->head = lst->head->next;

		dev_unref (dev);
	}
}