MCPcopy Create free account
hub / github.com/apache/nuttx / rpmsgfs_client_ioctl

Function rpmsgfs_client_ioctl

fs/rpmsgfs/rpmsgfs_client.c:594–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592}
593
594int rpmsgfs_client_ioctl(FAR void *handle, int fd,
595 int request, unsigned long arg)
596{
597 ssize_t arglen = rpmsgfs_ioctl_arglen(request);
598 FAR struct rpmsgfs_s *priv = handle;
599 FAR struct rpmsgfs_ioctl_s *msg;
600 uint32_t space;
601 size_t len;
602 int ret;
603
604 if (arglen < 0)
605 {
606 return arglen;
607 }
608
609 len = sizeof(*msg) + arglen;
610
611 while (1)
612 {
613 msg = rpmsgfs_get_tx_payload_buffer(priv, &space);
614 if (msg == NULL)
615 {
616 return -ENOMEM;
617 }
618
619 DEBUGASSERT(len <= space);
620
621 msg->fd = fd;
622 msg->request = request == FIOC_SETLKW ? FIOC_SETLK : request;
623 msg->arg = arg;
624 msg->arglen = arglen;
625
626 if (arglen > 0)
627 {
628 memcpy(msg->buf, (FAR void *)(uintptr_t)arg, arglen);
629 }
630
631 ret = rpmsgfs_send_recv(handle, RPMSGFS_IOCTL, false,
632 (FAR struct rpmsgfs_header_s *)msg, len,
633 arglen > 0 ? (FAR void *)arg : NULL);
634 if (request != FIOC_SETLKW || ret != -EAGAIN)
635 {
636 break;
637 }
638
639 usleep(20000);
640 }
641
642 return ret;
643}
644
645void rpmsgfs_client_sync(FAR void *handle, int fd)
646{

Callers 1

rpmsgfs_ioctlFunction · 0.85

Calls 5

rpmsgfs_ioctl_arglenFunction · 0.85
rpmsgfs_send_recvFunction · 0.85
usleepFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected