Example #1
0
int snd_info_register(snd_info_entry_t * entry)
{
	struct proc_dir_entry *root, *p = NULL;

	snd_assert(entry != NULL, return -ENXIO);
	root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
	down(&info_mutex);
	p = snd_create_proc_entry(entry->name, entry->mode, root);
	if (!p) {
		up(&info_mutex);
		return -ENOMEM;
	}
#ifdef LINUX_2_3
	p->owner = entry->module;
#endif

#ifndef TARGET_OS2
	if (!S_ISDIR(entry->mode)) {
#ifdef LINUX_2_3
		p->proc_fops = &snd_info_entry_operations;
#else
		p->ops = &snd_info_entry_inode_operations;
#endif
	}
#endif
	p->size = entry->size;
	p->data = entry;
	entry->p = p;
	up(&info_mutex);
	return 0;
}
Example #2
0
int __init snd_info_init(void)
{
	struct proc_dir_entry *p;

	p = snd_create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, &proc_root);
	if (p == NULL)
		return -ENOMEM;
	snd_proc_root = p;
	p = snd_create_proc_entry("dev", S_IFDIR | S_IRUGO | S_IXUGO, snd_proc_root);
	if (p == NULL)
		return -ENOMEM;
	snd_proc_dev = p;
#ifdef CONFIG_SND_SEQUENCER
	{
		snd_info_entry_t *entry;
		if ((entry = snd_info_create_module_entry(THIS_MODULE, "seq", NULL)) == NULL)
			return -ENOMEM;
		entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
		if (snd_info_register(entry) < 0) {
			snd_info_free_entry(entry);
			return -ENOMEM;
		}
		snd_seq_root = entry;
	}
#endif
	snd_info_version_init();
#ifdef CONFIG_SND_DEBUG_MEMORY
	snd_memory_info_init();
#endif
	snd_minor_info_init();
#ifdef CONFIG_SND_OSSEMUL
	snd_minor_info_oss_init();
#endif
	snd_card_info_init();
	return 0;
}
Example #3
0
File: info.c Project: 274914765/C
int __init snd_info_init(void)
{
    struct proc_dir_entry *p;

    p = snd_create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL);
    if (p == NULL)
        return -ENOMEM;
    snd_proc_root = p;
#ifdef CONFIG_SND_OSSEMUL
    {
        struct snd_info_entry *entry;
        if ((entry = snd_info_create_module_entry(THIS_MODULE, "oss", NULL)) == NULL)
            return -ENOMEM;
        entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
        if (snd_info_register(entry) < 0) {
            snd_info_free_entry(entry);
            return -ENOMEM;
        }
        snd_oss_root = entry;
    }
#endif
#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
    {
        struct snd_info_entry *entry;
        if ((entry = snd_info_create_module_entry(THIS_MODULE, "seq", NULL)) == NULL)
            return -ENOMEM;
        entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
        if (snd_info_register(entry) < 0) {
            snd_info_free_entry(entry);
            return -ENOMEM;
        }
        snd_seq_root = entry;
    }
#endif
    snd_info_version_init();
    snd_minor_info_init();
    snd_minor_info_oss_init();
    snd_card_info_init();
    return 0;
}
Example #4
0
int snd_info_card_register(snd_card_t * card)
{
	char str[8];
	char *s;
	snd_info_entry_t *entry;
	struct proc_dir_entry *p;

	snd_assert(card != NULL, return -ENXIO);

	sprintf(str, "card%i", card->number);
	if ((entry = snd_info_create_module_entry(card->module, str, NULL)) == NULL)
		return -ENOMEM;
	entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
	if (snd_info_register(entry) < 0) {
		snd_info_free_entry(entry);
		return -ENOMEM;
	}
	card->proc_root = entry;

	if (!strcmp(card->id, str))
		return 0;

	s = snd_kmalloc_strdup(str, GFP_KERNEL);
	if (s == NULL)
		return -ENOMEM;
	p = snd_create_proc_entry(card->id, S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO, snd_proc_root);
	if (p == NULL)
		return -ENOMEM;
	p->data = s;
#ifndef TARGET_OS2
#ifdef LINUX_2_3
	p->owner = card->module;
	p->proc_iops = &snd_info_card_link_inode_operations;
#else
	p->ops = &snd_info_card_link_inode_operations;
#endif
#endif
	card->proc_root_link = p;
	return 0;
}