return 0;
}
-static struct capi_interface_user cuser = {
- name: "capi20",
-};
-
static char rev[32];
static int __init capi_init(void)
&capi_fops, NULL);
printk(KERN_NOTICE "capi20: started up with major %d\n", capi_major);
- attach_capi_interface(&cuser);
-
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
if (capinc_tty_init() < 0) {
- (void) detach_capi_interface(&cuser);
devfs_unregister_chrdev(capi_major, "capi20");
MOD_DEC_USE_COUNT;
return -ENOMEM;
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
capinc_tty_exit();
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
- (void) detach_capi_interface(&cuser);
devfs_unregister_chrdev(capi_major, "capi20");
devfs_unregister(devfs_find_handle(NULL, "capi20",
capi_major, 0,
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
capinc_tty_exit();
#endif
- (void) detach_capi_interface(&cuser);
printk(KERN_NOTICE "capi: Rev %s: unloaded\n", rev);
}
}
}
-static struct capi_interface_user cuser = {
- name: "capidrv",
-};
-
static int __init capidrv_init(void)
{
struct capi_register_params rparam;
MOD_INC_USE_COUNT;
- attach_capi_interface(&cuser);
-
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(rev, p + 2, sizeof(rev));
rev[sizeof(rev)-1] = 0;
rparam.datablklen = 2048;
errcode = capi20_register(&rparam, &global.appid);
if (errcode) {
- detach_capi_interface(&cuser);
MOD_DEC_USE_COUNT;
return -EIO;
}
errcode = capi20_get_profile(0, &profile);
if (errcode != CAPI_NOERROR) {
capi20_release(global.appid);
- detach_capi_interface(&cuser);
MOD_DEC_USE_COUNT;
return -EIO;
}
capi20_release(global.appid);
- detach_capi_interface(&cuser);
-
proc_exit();
printk(KERN_NOTICE "capidrv: Rev%s: unloaded\n", rev);
static int ncards;
static struct sk_buff_head recv_queue;
-static LIST_HEAD(users);
-static spinlock_t users_lock = SPIN_LOCK_UNLOCKED;
-
static LIST_HEAD(drivers);
static spinlock_t drivers_lock = SPIN_LOCK_UNLOCKED;
return len;
}
-/*
- * /proc/capi/users:
- * name
- */
-static int proc_users_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- struct list_head *l;
- struct capi_interface_user *cp;
- int len = 0;
-
- spin_lock(&users_lock);
- list_for_each(l, &users) {
- cp = list_entry(l, struct capi_interface_user, user_list);
- len += sprintf(page+len, "%s\n", cp->name);
- if (len <= off) {
- off -= len;
- len = 0;
- } else {
- if (len-off > count)
- goto endloop;
- }
- }
-endloop:
- spin_unlock(&users_lock);
- *start = page+off;
- if (len < count)
- *eof = 1;
- if (len>count) len = count;
- if (len<0) len = 0;
- return len;
-}
-
/*
* /proc/capi/controller:
* cnr driver cardstate name driverinfo
{ "capi", S_IFDIR, 0 },
{ "capi/applications", 0 , proc_applications_read_proc },
{ "capi/driver", 0 , proc_driver_read_proc },
- { "capi/users", 0 , proc_users_read_proc },
{ "capi/controller", 0 , proc_controller_read_proc },
{ "capi/applstats", 0 , proc_applstats_read_proc },
{ "capi/contrstats", 0 , proc_contrstats_read_proc },
EXPORT_SYMBOL(capi20_set_callback);
-/* ------------------------------------------------------------- */
-/* -------- Exported Functions --------------------------------- */
-/* ------------------------------------------------------------- */
-
-void attach_capi_interface(struct capi_interface_user *userp)
-{
-
- spin_lock(&users_lock);
- list_add_tail(&userp->user_list, &users);
- spin_unlock(&users_lock);
- printk(KERN_NOTICE "kcapi: %s attached\n", userp->name);
-}
-
-EXPORT_SYMBOL(attach_capi_interface);
-
-void detach_capi_interface(struct capi_interface_user *userp)
-{
- spin_lock(&users_lock);
- list_del(&userp->user_list);
- spin_unlock(&users_lock);
- printk(KERN_NOTICE "kcapi: %s detached\n", userp->name);
-}
-
-EXPORT_SYMBOL(detach_capi_interface);
-
/* ------------------------------------------------------------- */
/* -------- Init & Cleanup ------------------------------------- */
/* ------------------------------------------------------------- */