Whamcloud - gitweb
assorted bug fixes and a working directory readpage routine
[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 #define IOC_REQUEST_GETATTR             _IOWR('f', 30, long)
7 #define IOC_REQUEST_READPAGE            _IOWR('f', 31, long)
8
9 int main(int argc, char **argv)
10 {
11         int fd, rc; 
12         int cmd = IOC_REQUEST_GETATTR;
13
14         printf("ioctl type %d, nr %d size %d\n", 
15                _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd));
16
17         fd = open("/dev/request", O_RDONLY);
18         if (fd == -1) { 
19                 printf("error opening /dev/request: %s\n", strerror(errno));
20                 return 1;
21         }
22
23         printf("getattr test... ");
24         rc = ioctl(fd, IOC_REQUEST_GETATTR, NULL); 
25         printf("result: %d\n", rc); 
26
27         printf("readpage test... ");
28         rc = ioctl(fd, IOC_REQUEST_READPAGE, NULL); 
29         printf("result: %d\n", rc); 
30         return 0;
31 }