syscall_emul: [patch 10/22] refactor fdentry and add fdarray class
[gem5.git] / src / gpu-compute / cl_driver.cc
index 41ae3ab9a51b8199a5199332d33084ace9ecbe62..119091fc5eccc51540f9dc1766774134f784ee14 100644 (file)
@@ -35,6 +35,8 @@
 
 #include "gpu-compute/cl_driver.hh"
 
+#include <memory>
+
 #include "base/intmath.hh"
 #include "cpu/thread_context.hh"
 #include "gpu-compute/dispatcher.hh"
@@ -93,11 +95,10 @@ ClDriver::handshake(GpuDispatcher *_dispatcher)
 int
 ClDriver::open(Process *p, ThreadContext *tc, int mode, int flags)
 {
-    int fd = p->allocFD(-1, filename, 0, 0, false);
-    FDEntry *fde = p->getFDEntry(fd);
-    fde->driver = this;
-
-    return fd;
+    std::shared_ptr<DeviceFDEntry> fdp;
+    fdp = std::make_shared<DeviceFDEntry>(this, filename);
+    int tgt_fd = p->fds->allocFD(fdp);
+    return tgt_fd;
 }
 
 int