8 #include <lustre_lib.h>
11 int main(int argc, char **argv)
13 struct obd_ioctl_data data = { 0 };
14 char rawbuf[8192], parent[4096], *buf = rawbuf, *base, *t;
15 int max = sizeof(rawbuf), fd, offset, rc;
18 printf("usage: %s filename\n", argv[0]);
23 t = strrchr(base, '/');
28 strncpy(parent, base, t - base);
29 offset = t - base - 1;
32 fd = open(parent, O_RDONLY);
34 printf("open(%s) error: %s\n", parent, strerror(errno));
38 data.ioc_version = OBD_IOCTL_VERSION;
39 data.ioc_len = sizeof(data);
41 data.ioc_inlbuf1 = base + offset + 2;
43 data.ioc_inlbuf1 = base;
44 data.ioc_inllen1 = strlen(data.ioc_inlbuf1) + 1;
46 if (obd_ioctl_pack(&data, &buf, max)) {
47 printf("ioctl_pack failed.\n");
51 rc = ioctl(fd, IOC_MDC_LOOKUP, buf);
53 printf("ioctl(%s/%s) error: %s\n", parent,
54 data.ioc_inlbuf1, strerror(errno));