Whamcloud - gitweb
It's been a good day: chmod/chown and friends now work for Lustre Light.
[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
11 int main(int argc, char **argv)
12 {
13         int fd, rc; 
14         int cmd = IOC_REQUEST_GETATTR;
15
16         printf("ioctl type %d, nr %d size %d\n", 
17                _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd));
18
19         fd = open("/dev/request", O_RDONLY);
20         if (fd == -1) { 
21                 printf("error opening /dev/request: %s\n", strerror(errno));
22                 return 1;
23         }
24
25         printf("getattr test... ");
26         rc = ioctl(fd, IOC_REQUEST_GETATTR, NULL); 
27         printf("result: %d\n", rc); 
28
29         printf("readpage test... ");
30         rc = ioctl(fd, IOC_REQUEST_READPAGE, NULL); 
31         printf("result: %d\n", rc); 
32
33         printf("setattr test... ");
34         rc = ioctl(fd, IOC_REQUEST_SETATTR, NULL); 
35         printf("result: %d\n", rc); 
36         return 0;
37 }