~ubuntu-branches/ubuntu/vivid/oss4/vivid

« back to all changes in this revision

Viewing changes to kernel/framework/osscore/oss_memblk.c

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis, Samuel Thibault, Romain Beauxis, Sebastien NOEL
  • Date: 2011-06-14 10:06:56 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110614100656-cx4oc7u426zn812z
Tags: 4.2-build2004-1
[ Samuel Thibault ]
* debian/control: Add liboss4-salsa2, liboss4-salsa-dev and
  liboss4-salsa-asound2 packages, equivalent to (and will replace) those from
  the oss-libsalsa package (Closes: #589127).
* debian/patches/liboss4-salsa.patch: New patch to rename libsalsa into
  liboss4-salsa to avoid conflicts in the archive for no good reason.
* debian/rules: Make in libOSSlib and libsalsa.
* debian/liboss4-salsa-dev.install, debian/liboss4-salsa2.install,
  debian/liboss4-salsa-asound2.links, debian/liboss4-salsa-dev.links:
  Install liboss4-salsa libraries like was done in the oss-libsalsa package.
* include-alsa: Add a copy of ALSA 1.0.5 headers: Cf ALSA_1.0.* symbols in
  libsalsa, this is the roughly supported version.
* debian/copyright: Update for new include-alsa files.
* alsa.pc: New file for compatibility with libasound-dev.
* debian/control:
  - Add Vcs-Browser and Vcs-Svn fields.
  - Use linux-any instead of the list of Linux archs (Closes: #604679).
  - Make dkms dependency linux-any only.
* debian/patches/hurd_iot.patch: New patch to fix soundcard.h usage in
  libsalsa on hurd-i386.
* debian/patches/libsalsa_fixes.patch: New patch to fix some printf usages
  and ioctl declaration in libsalsa.
* debian/patches/no_EBADE.patch: New patch to cope with hurd-i386 not having
  EBADE.
* debian/patches/CFLAGS.patch: New patch to make oss4 take debian/rules
  CFLAGS into account.
* debian/patches/snd_asoundlib_version.patch: New patch to add
  snd_asoundlib_version().
* debian/patches/generic_srccconf.patch: New patch to fix source
  configuration on unknown archs.

[ Romain Beauxis ]
* Fixed README.Debian to only mention dkms' modules.
* Switch to dpkg-source 3.0 (quilt) format
* Added DM-Upload-Allowed: yes

[ Sebastien NOEL ]
* New upstream release (Closes: #595298, #619272).
* Fix typo in initscript (Closes: #627149).
* debian/control: adjust linux-headers dependencies (Closes: #628879).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Purpose: OSS memory block allocation and management routines.
 
3
 */
 
4
/*
 
5
 *
 
6
 * This file is part of Open Sound System.
 
7
 *
 
8
 * Copyright (C) 4Front Technologies 1996-2008.
 
9
 *
 
10
 * This this source file is released under GPL v2 license (no other versions).
 
11
 * See the COPYING file included in the main directory of this source
 
12
 * distribution for the license terms and conditions.
 
13
 *
 
14
 */
 
15
 
 
16
#include <oss_config.h>
 
17
 
 
18
struct _oss_memblk_t
 
19
{
 
20
        oss_memblk_t *next;
 
21
        void *addr;
 
22
};
 
23
 
 
24
oss_memblk_t *oss_global_memblk=NULL;
 
25
 
 
26
void
 
27
*oss_memblk_malloc(oss_memblk_t **blk, int size)
 
28
{
 
29
        oss_memblk_t *newblk;
 
30
 
 
31
        newblk = KERNEL_MALLOC (sizeof(oss_memblk_t) + size);
 
32
 
 
33
        newblk->addr = newblk +1;
 
34
        newblk->next = NULL;
 
35
 
 
36
        if (*blk == NULL)
 
37
           {
 
38
                /*
 
39
                 * No earlier memory blocks in the chain.
 
40
                 */
 
41
                *blk = newblk;
 
42
                return newblk->addr;
 
43
           }
 
44
 
 
45
/*
 
46
 * Add this block to the chain.
 
47
 */
 
48
        newblk->next = *blk;
 
49
        *blk = newblk;
 
50
 
 
51
        return newblk->addr;
 
52
}
 
53
 
 
54
void
 
55
oss_memblk_free(oss_memblk_t **blk, void *addr)
 
56
{
 
57
        oss_memblk_t *this_one = *blk, *prev = NULL;
 
58
 
 
59
        while (this_one != NULL)
 
60
        {
 
61
                if (this_one->addr == addr)
 
62
                   {
 
63
                           if (prev == NULL) /* First one in the chain */
 
64
                              {
 
65
                                      *blk = this_one->next;
 
66
                                      KERNEL_FREE (this_one);
 
67
                              }
 
68
                           else
 
69
                              {
 
70
                                      prev->next = this_one->next;
 
71
                                      KERNEL_FREE (this_one);
 
72
                              }
 
73
 
 
74
                           return;
 
75
                   }
 
76
 
 
77
                this_one = this_one->next;
 
78
        }
 
79
}
 
80
 
 
81
void
 
82
oss_memblk_unalloc(oss_memblk_t **blk)
 
83
{
 
84
/*
 
85
 * Free all memory allocations on the chain.
 
86
 */
 
87
        oss_memblk_t *this_one = *blk;
 
88
 
 
89
   while (this_one != NULL)
 
90
   {
 
91
           oss_memblk_t *next_one;
 
92
 
 
93
           next_one = this_one->next;
 
94
 
 
95
           KERNEL_FREE(this_one);
 
96
           this_one = next_one;
 
97
   }
 
98
 
 
99
   *blk = NULL;
 
100
}