Call setxattr. */
| 99 | |
| 100 | /* Call setxattr. */ |
| 101 | static int io_uring_setxattr(struct io_uring *ring, const char *path, |
| 102 | const char *name, const void *value, size_t size, |
| 103 | int flags) |
| 104 | { |
| 105 | struct io_uring_sqe *sqe; |
| 106 | struct io_uring_cqe *cqe; |
| 107 | int ret; |
| 108 | |
| 109 | sqe = io_uring_get_sqe(ring); |
| 110 | if (!sqe) { |
| 111 | fprintf(stderr, "Error cannot get sqe\n"); |
| 112 | return -1; |
| 113 | } |
| 114 | |
| 115 | io_uring_prep_setxattr(sqe, name, value, path, flags, size); |
| 116 | |
| 117 | ret = io_uring_submit_and_wait(ring, 1); |
| 118 | if (ret != 1) { |
| 119 | fprintf(stderr, "Error io_uring_submit_and_wait: ret=%d\n", ret); |
| 120 | return -1; |
| 121 | } |
| 122 | |
| 123 | ret = io_uring_wait_cqe(ring, &cqe); |
| 124 | if (ret) { |
| 125 | fprintf(stderr, "Error io_uring_wait_cqe: ret=%d\n", ret); |
| 126 | return -1; |
| 127 | } |
| 128 | |
| 129 | ret = cqe->res; |
| 130 | if (ret < 0) { |
| 131 | if (ret == -EINVAL || ret == -EOPNOTSUPP) |
| 132 | no_xattr = 1; |
| 133 | } |
| 134 | io_uring_cqe_seen(ring, cqe); |
| 135 | return ret; |
| 136 | } |
| 137 | |
| 138 | /* Submit getxattr request. */ |
| 139 | static int io_uring_getxattr(struct io_uring *ring, const char *path, |