linux: add IORING_OP_OPENAT support (#3963)
This commit is contained in:
parent
3ba75f1300
commit
5ca5e475bb
@ -2001,6 +2001,9 @@ int uv_fs_open(uv_loop_t* loop,
|
||||
PATH;
|
||||
req->flags = flags;
|
||||
req->mode = mode;
|
||||
if (cb != NULL)
|
||||
if (uv__iou_fs_open(loop, req))
|
||||
return 0;
|
||||
POST;
|
||||
}
|
||||
|
||||
|
||||
@ -334,6 +334,7 @@ int uv__random_sysctl(void* buf, size_t buflen);
|
||||
int uv__iou_fs_fsync_or_fdatasync(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
uint32_t fsync_flags);
|
||||
int uv__iou_fs_open(uv_loop_t* loop, uv_fs_t* req);
|
||||
int uv__iou_fs_read_or_write(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
int is_read);
|
||||
@ -343,6 +344,7 @@ int uv__iou_fs_statx(uv_loop_t* loop,
|
||||
int is_lstat);
|
||||
#else
|
||||
#define uv__iou_fs_fsync_or_fdatasync(loop, req, fsync_flags) 0
|
||||
#define uv__iou_fs_open(loop, req) 0
|
||||
#define uv__iou_fs_read_or_write(loop, req, is_read) 0
|
||||
#define uv__iou_fs_statx(loop, req, is_fstat, is_lstat) 0
|
||||
#endif
|
||||
|
||||
@ -146,6 +146,7 @@ enum {
|
||||
UV__IORING_OP_READV = 1,
|
||||
UV__IORING_OP_WRITEV = 2,
|
||||
UV__IORING_OP_FSYNC = 3,
|
||||
UV__IORING_OP_OPENAT = 18,
|
||||
UV__IORING_OP_STATX = 21,
|
||||
};
|
||||
|
||||
@ -208,6 +209,7 @@ struct uv__io_uring_sqe {
|
||||
union {
|
||||
uint32_t rw_flags;
|
||||
uint32_t fsync_flags;
|
||||
uint32_t open_flags;
|
||||
uint32_t statx_flags;
|
||||
};
|
||||
uint64_t user_data;
|
||||
@ -673,6 +675,28 @@ int uv__iou_fs_fsync_or_fdatasync(uv_loop_t* loop,
|
||||
}
|
||||
|
||||
|
||||
int uv__iou_fs_open(uv_loop_t* loop, uv_fs_t* req) {
|
||||
struct uv__io_uring_sqe* sqe;
|
||||
struct uv__iou* iou;
|
||||
|
||||
iou = &uv__get_internal_fields(loop)->iou;
|
||||
|
||||
sqe = uv__iou_get_sqe(iou, loop, req);
|
||||
if (sqe == NULL)
|
||||
return 0;
|
||||
|
||||
sqe->addr = (uintptr_t) req->path;
|
||||
sqe->fd = AT_FDCWD;
|
||||
sqe->len = req->mode;
|
||||
sqe->opcode = UV__IORING_OP_OPENAT;
|
||||
sqe->open_flags = req->flags | O_CLOEXEC;
|
||||
|
||||
uv__iou_submit(iou);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int uv__iou_fs_read_or_write(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
int is_read) {
|
||||
|
||||
@ -98,6 +98,7 @@ static int known_broken(uv_req_t* req) {
|
||||
case UV_FS_FSTAT:
|
||||
case UV_FS_FSYNC:
|
||||
case UV_FS_LSTAT:
|
||||
case UV_FS_OPEN:
|
||||
case UV_FS_READ:
|
||||
case UV_FS_STAT:
|
||||
case UV_FS_WRITE:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user