10 #include <lustre/lustreapi.h>
12 int main(int argc, char **argv)
16 char *xval = "UUID@UUID";
18 struct lov_foreign_md *lfm;
20 __u32 type = LU_FOREIGN_TYPE_DAOS, flags = 0xda08;
22 while ((c = getopt(argc, argv, "f:x:t:F:")) != -1) {
31 type = strtoul(optarg, &end, 0);
34 "%s: invalid type '%s'\n", argv[0],
40 flags = strtoul(optarg, &end, 0);
43 "%s: invalid flags '%s'\n", argv[0],
50 "Usage: %s -f <filename> -x <LOV EA content>\n",
57 if (len > XATTR_SIZE_MAX || len <= 0) {
59 "invalid LOV EA length %zu > XATTR_SIZE_MAX (%u)\n",
64 fd = open(fname, O_WRONLY|O_CREAT|O_LOV_DELAY_CREATE, 0644);
70 lfm = malloc(len + offsetof(struct lov_foreign_md, lfm_value));
76 lfm->lfm_magic = LOV_USER_MAGIC_FOREIGN;
77 lfm->lfm_length = len;
79 lfm->lfm_flags = flags;
80 memcpy(lfm->lfm_value, xval, len);
82 if (ioctl(fd, LL_IOC_LOV_SETSTRIPE, lfm) != 0) {
83 perror("ioctl(LL_IOC_LOV_SETSTRIPE)");