+ case 'E':
+ commands++;
+ if (*commands != '-' && *commands != '+')
+ errx(-1, "unknown mode: %c\n", *commands);
+
+ rc = ioctl(fd, LL_IOC_GET_LEASE);
+ if (rc > 0) {
+ const char *str = "Unknown";
+
+ if (rc == FMODE_READ)
+ str = "FMODE_READ";
+ else if (rc == FMODE_WRITE)
+ str = "FMODE_WRITE";
+ fprintf(stdout, "%s lease(%d) has applied.\n",
+ str, rc);
+ if (*commands == '-')
+ errx(-1, "expect lease to not exist");
+ } else if (rc == 0) {
+ fprintf(stdout, "no lease applied.\n");
+ if (*commands == '+')
+ errx(-1, "expect lease exists");
+ } else {
+ err(errno, "free lease error");
+ }
+ break;
+ case 'f':
+ if (statfs(fname, &stfs) == -1)
+ errx(-1, "statfs()");
+ break;
+ case 'F':
+ if (fd == -1)
+ rc = llapi_path2fid(fname, &fid);
+ else
+ rc = llapi_fd2fid(fd, &fid);
+ if (rc != 0)
+ fprintf(stderr,
+ "llapi_path/fd2fid() on %d, rc=%d\n",
+ fd, rc);
+ else
+ printf(DFID"\n", PFID(&fid));
+ break;
+ case 'G':
+ gid = atoi(commands+1);
+ if (ioctl(fd, LL_IOC_GROUP_LOCK, gid) == -1) {
+ save_errno = errno;
+ perror("ioctl(GROUP_LOCK)");
+ exit(save_errno);
+ }
+ break;
+ case 'g':
+ gid = atoi(commands+1);
+ if (ioctl(fd, LL_IOC_GROUP_UNLOCK, gid) == -1) {
+ save_errno = errno;
+ perror("ioctl(GROUP_UNLOCK)");
+ exit(save_errno);
+ }
+ break;
+ case 'H':
+ len = atoi(commands+1);
+ fd = llapi_file_open(fname, O_CREAT | O_WRONLY,
+ 0644, 0, 0, len,
+ LOV_PATTERN_RAID0 | LOV_PATTERN_F_RELEASED);
+ if (fd == -1) {
+ save_errno = errno;
+ perror("create stripe file");
+ exit(save_errno);