[Asterisk-Dev] Kernel 2.6.8-1.521 from Fedora C2
Michał Mosiewicz
mimo at proinet.pl
Thu Sep 9 08:08:30 MST 2004
I've noticed problems with zaptel on various kernel from Fedora C2. Most of
the time I had some core dumps from tools like ztcfg. My TDM400P cards
denied working.
I have found out that the problem was actually a UNIT(file) macro
calculation. The way it is done, it returns very strange results without
logic like for example 60909 at least on my "stock" Fedora C2 upgraded to
the latest kernel.
Then I noticed that most functions with fingerprint like (struct inode
*inode, struct file *file) could probably use inode directly instead of
reaching it from file. Actually it appears that inode data is proper, i.e.
it has a proper i_rdev value, proper i_ino value etc. As contrary
file->f_dentry->d_inode seems to have some bogus data.
So, I changed all the function that used UNIT(file) calculation to
MINOR(inode->i_rdev) whereever it was possible (i.e. wherever the function
alread had inode parameter.
I'm not Linux kernel hacker, and I didn't traced those function to any
greater depth. Can somebody check this patch? I wonder why there are people
using FC2 and no one experienced such problems.
--- /usr/src/redhat/BUILD/zaptel-1.0-RC2/zaptel.c 2004-07-28
17:16:14.000000000 -0400
+++ ./zaptel.c 2004-09-09 10:30:16.000000000 -0400
@@ -99,7 +99,7 @@
#endif
/* macro-oni for determining a unit (channel) number */
-#define UNIT(file) MINOR(file->f_dentry->d_inode->i_rdev)
+#define UNIT(file) (MINOR(file->f_dentry->d_inode->i_rdev))
/* names of tx level settings */
static char *zt_txlevelnames[] = {
@@ -2124,7 +2124,7 @@
static int zt_specchan_open(struct inode *inode, struct file *file, int
unit, int inc)
{
int res = 0;
-
+ printk( "Doint specchan_open unit: %i \n", unit);
if (chans[unit] && chans[unit]->sig) {
/* Make sure we're not already open, a net device, or a slave device */
if (chans[unit]->flags & ZT_FLAG_OPEN)
@@ -2212,7 +2212,7 @@
static int zt_open(struct inode *inode, struct file *file)
{
- int unit = UNIT(file);
+ int unit = MINOR(inode->i_rdev);
struct zt_chan *chan;
/* Minor 0: Special "control" descriptor */
if (!unit)
@@ -2511,7 +2511,7 @@
static int zt_release(struct inode *inode, struct file *file)
{
- int unit = UNIT(file);
+ int unit = MINOR(inode->i_rdev);
int res;
struct zt_chan *chan;
@@ -4154,7 +4154,7 @@
static int zt_ioctl(struct inode *inode, struct file *file, unsigned int
cmd, unsigned long data)
{
- int unit = UNIT(file);
+ int unit = MINOR(inode->i_rdev);
struct zt_chan *chan;
struct zt_timer *timer;
More information about the asterisk-dev
mailing list