File: autoconf-kernel_read-new-args.c

package info (click to toggle)
systemtap 5.1-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 47,964 kB
  • sloc: cpp: 80,838; ansic: 54,757; xml: 49,725; exp: 43,665; sh: 11,527; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (35 lines) | stat: -rw-r--r-- 1,101 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// The following kernel commit changed the kernel_read() function signature:
//
// commit bdd1d2d3d251c65b74ac4493e08db18971c09240
// Author: Christoph Hellwig <hch@lst.de>
// Date:   Fri Sep 1 17:39:13 2017 +0200
//
//     fs: fix kernel_read prototype
//
//     Use proper ssize_t and size_t types for the return value and count
//     argument, move the offset last and make it an in/out argument like
//     all other read/write helpers, and make the buf argument a void pointer
//     to get rid of lots of casts in the callers.
//
//     Signed-off-by: Christoph Hellwig <hch@lst.de>
//     Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
//
// This changed the function signature from:
//
// int kernel_read(struct file *file, loff_t offset, char *addr,
// 		unsigned long count);
//
// to:
//
// ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos);
//

#include <linux/fs.h>

ssize_t foo(struct file *file, void *buf, size_t count, loff_t *pos);

ssize_t foo(struct file *file, void *buf, size_t count, loff_t *pos)
{
	return kernel_read(file, buf, count, pos);
}