---------------------
PatchSet 3115 
Date: 2005/04/12 16:27:28
Author: tiwai
Branch: HEAD
Tag: (none) 
Log:
Summary: Fix permissions in some /proc files

Fix by Guillaume Chazarain <guichaz@yahoo.fr>:

Some tunables in /proc have a write() function, but as their
permission does not reflect it, it can be confusing to the user.

So here is a patch that corrects the mode of those files. Note that I
have only tested the "xrun_debug" entry.

Members: 
	core/pcm.c:1.51->1.52 
	core/pcm_memory.c:1.34->1.35 
	pci/ca0106/ca0106_proc.c:1.2->1.3 
	pci/emu10k1/emu10k1x.c:1.9->1.10 
	pci/emu10k1/emuproc.c:1.29->1.30 

Index: /sound/core/pcm.c
diff -u /sound/core/pcm.c.old /sound/core/pcm.c
--- /sound/core/pcm.c.old	Tue Mar 22 07:31:21 2005
+++ /sound/core/pcm.c	Tue Apr 12 08:27:28 2005
@@ -451,6 +451,7 @@
 		entry->c.text.read = snd_pcm_xrun_debug_read;
 		entry->c.text.write_size = 64;
 		entry->c.text.write = snd_pcm_xrun_debug_write;
+		entry->mode |= S_IWUSR;
 		entry->private_data = pstr;
 		if (snd_info_register(entry) < 0) {
 			snd_info_free_entry(entry);
Index: /sound/core/pcm_memory.c
diff -u /sound/core/pcm_memory.c.old /sound/core/pcm_memory.c
--- /sound/core/pcm_memory.c.old	Thu Jan 13 09:27:29 2005
+++ /sound/core/pcm_memory.c	Tue Apr 12 08:27:28 2005
@@ -204,6 +204,7 @@
 		entry->c.text.read = snd_pcm_lib_preallocate_proc_read;
 		entry->c.text.write_size = 64;
 		entry->c.text.write = snd_pcm_lib_preallocate_proc_write;
+		entry->mode |= S_IWUSR;
 		entry->private_data = substream;
 		if (snd_info_register(entry) < 0) {
 			snd_info_free_entry(entry);
Index: /sound/pci/ca0106/ca0106_proc.c
diff -u /sound/pci/ca0106/ca0106_proc.c.old /sound/pci/ca0106/ca0106_proc.c
--- /sound/pci/ca0106/ca0106_proc.c.old	Sun Jan  9 23:33:03 2005
+++ /sound/pci/ca0106/ca0106_proc.c	Tue Apr 12 08:27:28 2005
@@ -418,6 +418,7 @@
 		snd_info_set_text_ops(entry, emu, 1024, snd_ca0106_proc_reg_read32);
 		entry->c.text.write_size = 64;
 		entry->c.text.write = snd_ca0106_proc_reg_write32;
+		entry->mode |= S_IWUSR;
 	}
 	if(! snd_card_proc_new(emu->card, "ca0106_reg16", &entry))
 		snd_info_set_text_ops(entry, emu, 1024, snd_ca0106_proc_reg_read16);
@@ -427,6 +428,7 @@
 		snd_info_set_text_ops(entry, emu, 1024, snd_ca0106_proc_reg_read1);
 		entry->c.text.write_size = 64;
 		entry->c.text.write = snd_ca0106_proc_reg_write;
+		entry->mode |= S_IWUSR;
 //		entry->private_data = emu;
 	}
 	if(! snd_card_proc_new(emu->card, "ca0106_regs2", &entry)) 
Index: /sound/pci/emu10k1/emu10k1x.c
diff -u /sound/pci/emu10k1/emu10k1x.c.old /sound/pci/emu10k1/emu10k1x.c
--- /sound/pci/emu10k1/emu10k1x.c.old	Mon Apr 11 08:58:28 2005
+++ /sound/pci/emu10k1/emu10k1x.c	Tue Apr 12 08:27:29 2005
@@ -1075,6 +1075,7 @@
 		snd_info_set_text_ops(entry, emu, 1024, snd_emu10k1x_proc_reg_read);
 		entry->c.text.write_size = 64;
 		entry->c.text.write = snd_emu10k1x_proc_reg_write;
+		entry->mode |= S_IWUSR;
 		entry->private_data = emu;
 	}
 	
Index: /sound/pci/emu10k1/emuproc.c
diff -u /sound/pci/emu10k1/emuproc.c.old /sound/pci/emu10k1/emuproc.c
--- /sound/pci/emu10k1/emuproc.c.old	Sat Apr  9 15:38:25 2005
+++ /sound/pci/emu10k1/emuproc.c	Tue Apr 12 08:27:29 2005
@@ -527,26 +527,31 @@
 		snd_info_set_text_ops(entry, emu, 1024, snd_emu_proc_io_reg_read);
 		entry->c.text.write_size = 64;
 		entry->c.text.write = snd_emu_proc_io_reg_write;
+		entry->mode |= S_IWUSR;
 	}
 	if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) {
 		snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read00a);
 		entry->c.text.write_size = 64;
 		entry->c.text.write = snd_emu_proc_ptr_reg_write00;
+		entry->mode |= S_IWUSR;
 	}
 	if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) {
 		snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read00b);
 		entry->c.text.write_size = 64;
 		entry->c.text.write = snd_emu_proc_ptr_reg_write00;
+		entry->mode |= S_IWUSR;
 	}
 	if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) {
 		snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read20a);
 		entry->c.text.write_size = 64;
 		entry->c.text.write = snd_emu_proc_ptr_reg_write20;
+		entry->mode |= S_IWUSR;
 	}
 	if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) {
 		snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read20b);
 		entry->c.text.write_size = 64;
 		entry->c.text.write = snd_emu_proc_ptr_reg_write20;
+		entry->mode |= S_IWUSR;
 	}
 #endif