Whamcloud - gitweb
- more systematic unpacking/packing and handling of update records
[fs/lustre-release.git] / lustre / tests / testreq.c
1 #include <stdio.h>
2 #include <sys/ioctl.h>
3 #include <fcntl.h>
4 #include <errno.h>
5 #include <string.h>
6
7 #define IOC_REQUEST_GETATTR             _IOWR('f', 30, long)
8 #define IOC_REQUEST_READPAGE            _IOWR('f', 31, long)
9 #define IOC_REQUEST_SETATTR             _IOWR('f', 32, long)
10 #define IOC_REQUEST_CREATE              _IOWR('f', 33, long)
11
12 int main(int argc, char **argv)
13 {
14         int fd, rc; 
15         int cmd = IOC_REQUEST_GETATTR;
16
17         printf("ioctl type %d, nr %d size %d\n", 
18                _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd));
19
20         fd = open("/dev/request", O_RDONLY);
21         if (fd == -1) { 
22                 printf("error opening /dev/request: %s\n", strerror(errno));
23                 return 1;
24         }
25
26         printf("getattr test... ");
27         rc = ioctl(fd, IOC_REQUEST_GETATTR, NULL); 
28         printf("result: %d\n", rc); 
29
30         printf("readpage test... ");
31         rc = ioctl(fd, IOC_REQUEST_READPAGE, NULL); 
32         printf("result: %d\n", rc); 
33
34         printf("setattr test... ");
35         rc = ioctl(fd, IOC_REQUEST_SETATTR, NULL); 
36         printf("result: %d\n", rc); 
37
38         printf("create test... ");
39         rc = ioctl(fd, IOC_REQUEST_CREATE, NULL); 
40         printf("result: %d\n", rc); 
41         return 0;
42 }