Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c56a3b18
Commit
c56a3b18
authored
Apr 13, 2010
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: Update the documentation for changes of proc files
Signed-off-by:
Takashi Iwai
<
tiwai@suse.de
>
parent
02f4865f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
Documentation/DocBook/writing-an-alsa-driver.tmpl
Documentation/DocBook/writing-an-alsa-driver.tmpl
+17
-10
No files found.
Documentation/DocBook/writing-an-alsa-driver.tmpl
View file @
c56a3b18
...
...
@@ -5518,34 +5518,41 @@ struct _snd_pcm_runtime {
]]>
</programlisting>
</informalexample>
For the raw data,
<structfield>
size
</structfield>
field must be
set properly. This specifies the maximum size of the proc file access.
</para>
<para>
The
callback is much more complicated than the text-file
version.
You need to use a low-level I/O functions such as
The
read/write callbacks of raw mode are more direct than the text mode.
You need to use a low-level I/O functions such as
<function>
copy_from/to_user()
</function>
to transfer the
data.
<informalexample>
<programlisting>
<![CDATA[
static
long
my_file_io_read(struct snd_info_entry *entry,
static
ssize_t
my_file_io_read(struct snd_info_entry *entry,
void *file_private_data,
struct file *file,
char *buf,
unsigned long
count,
unsigned long
pos)
size_t
count,
loff_t
pos)
{
long size = count;
if (pos + size >
local_max_size)
size = local_max_size - pos;
if (copy_to_user(buf, local_data + pos, size))
if (copy_to_user(buf, local_data + pos, count))
return -EFAULT;
return
size
;
return
count
;
}
]]>
</programlisting>
</informalexample>
If the size of the info entry has been set up properly,
<structfield>
count
</structfield>
and
<structfield>
pos
</structfield>
are
guaranteed to fit within 0 and the given size.
You don't have to check the range in the callbacks unless any
other condition is required.
</para>
</chapter>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment