From ab752cafbde3755e7a09b3ecae021a6727cb7112 Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Thu, 25 Jun 2026 11:19:54 +0200 Subject: Project hierarchy overhaul --- src/drm.cpp | 4 ++-- src/gem.cpp | 4 ++-- src/helper/ioctl.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/ioctl.cpp | 47 ----------------------------------------------- src/syncobject.cpp | 4 ++-- 5 files changed, 53 insertions(+), 53 deletions(-) create mode 100644 src/helper/ioctl.cpp delete mode 100644 src/ioctl.cpp (limited to 'src') diff --git a/src/drm.cpp b/src/drm.cpp index 6bb0a3a..3046412 100644 --- a/src/drm.cpp +++ b/src/drm.cpp @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: MIT */ #include "drm++/drm.hpp" -#include "drm++/helper.hpp" -#include "drm++/ioctl.hpp" +#include "drm++/helper/ioctl.hpp" +#include "drm++/helper/types.hpp" #include diff --git a/src/gem.cpp b/src/gem.cpp index b6b3d38..82a459d 100644 --- a/src/gem.cpp +++ b/src/gem.cpp @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: MIT */ #include "drm++/gem.hpp" -#include "drm++/helper.hpp" -#include "drm++/ioctl.hpp" +#include "drm++/helper/ioctl.hpp" +#include "drm++/helper/types.hpp" #include #include diff --git a/src/helper/ioctl.cpp b/src/helper/ioctl.cpp new file mode 100644 index 0000000..21a1ccb --- /dev/null +++ b/src/helper/ioctl.cpp @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: MIT */ + +#include "drm++/helper/ioctl.hpp" + +#include +#include + +#include + +using namespace drm::ioctl; + +Exception::Exception(int fd, unsigned long op) + : m_fd(fd), m_op(op), m_syserrno(errno) { + switch (errno) { + case EBADF: + this->m_code = Error::BadFileDescriptor; + this->m_what = std::format( + "ioctl({}, 0x{:x}) failed: Invalid file descriptor", + this->m_fd, this->m_op + ); + break; + case EINVAL: + case ENOTTY: + this->m_code = Error::InvalidArgument; + this->m_what = std::format( + "ioctl({}, 0x{:x}) failed: Invalid argument (errno {})", + this->m_fd, this->m_op, this->m_syserrno + ); + break; + case ENOTSUP: + this->m_code = Error::NotSupported; + this->m_what = std::format( + "ioctl({}, 0x{:x}) failed: Operation not supported", + this->m_fd, this->m_op + ); + break; + default: + this->m_code = Error::Other; + this->m_what = std::format( + "ioctl({}, 0x{:x}) failed: Unknown error (errno {})", + this->m_fd, this->m_op, this->m_syserrno + ); + } +} + + +Exception::~Exception() = default; diff --git a/src/ioctl.cpp b/src/ioctl.cpp deleted file mode 100644 index 8b4962f..0000000 --- a/src/ioctl.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* SPDX-License-Identifier: MIT */ - -#include "drm++/ioctl.hpp" - -#include -#include - -#include - -using namespace drm::ioctl; - -Exception::Exception(int fd, unsigned long op) - : m_fd(fd), m_op(op), m_syserrno(errno) { - switch (errno) { - case EBADF: - this->m_code = Error::BadFileDescriptor; - this->m_what = std::format( - "ioctl({}, 0x{:x}) failed: Invalid file descriptor", - this->m_fd, this->m_op - ); - break; - case EINVAL: - case ENOTTY: - this->m_code = Error::InvalidArgument; - this->m_what = std::format( - "ioctl({}, 0x{:x}) failed: Invalid argument (errno {})", - this->m_fd, this->m_op, this->m_syserrno - ); - break; - case ENOTSUP: - this->m_code = Error::NotSupported; - this->m_what = std::format( - "ioctl({}, 0x{:x}) failed: Operation not supported", - this->m_fd, this->m_op - ); - break; - default: - this->m_code = Error::Other; - this->m_what = std::format( - "ioctl({}, 0x{:x}) failed: Unknown error (errno {})", - this->m_fd, this->m_op, this->m_syserrno - ); - } -} - - -Exception::~Exception() = default; diff --git a/src/syncobject.cpp b/src/syncobject.cpp index 4ec1a9c..6d7f68e 100644 --- a/src/syncobject.cpp +++ b/src/syncobject.cpp @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: MIT */ #include "drm++/syncobject.hpp" -#include "drm++/helper.hpp" -#include "drm++/ioctl.hpp" +#include "drm++/helper/ioctl.hpp" +#include "drm++/helper/types.hpp" #include #include -- cgit v1.3.1