8 #include <linux/lustre_lib.h>
11 int main(int argc, char **argv)
13 struct obd_ioctl_data data;
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 memset(&data, 0, sizeof(data));
39 data.ioc_version = OBD_IOCTL_VERSION;
40 data.ioc_len = sizeof(data);
42 data.ioc_inlbuf1 = base + offset + 2;
44 data.ioc_inlbuf1 = base;
45 data.ioc_inllen1 = strlen(data.ioc_inlbuf1) + 1;
47 if (obd_ioctl_pack(&data, &buf, max)) {
48 printf("ioctl_pack failed.\n");
52 rc = ioctl(fd, IOC_MDC_LOOKUP, buf);
54 printf("ioctl(%s/%s) error: %s\n", parent,
55 data.ioc_inlbuf1, strerror(errno));