Skip to contentSkip to conversation

dma-buf: pass flags into dma_buf_fd.

PATCH In review Dave Airlie 3 participants 3 messages Mar 16, 2012 – Mar 18, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma-buf: pass flags into dma_buf_fd.

From: Dave Airlie <[email protected]>

We need to pass the flags into dma_buf_fd at this point, so the flags end up doing the right thing for O_CLOEXEC.

---
 drivers/base/dma-buf.c  |    5 +++--
 include/linux/dma-buf.h |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/base/dma-buf.c +3 -2
index c9a945f..3c8c023 100644
@@ -107,17 +107,18 @@ EXPORT_SYMBOL_GPL(dma_buf_export);
 /**
  * dma_buf_fd - returns a file descriptor for the given dma_buf
  * @dmabuf:	[in]	pointer to dma_buf for which fd is required.
+ * @flags:      [in]    flags to give to fd
  *
  * On success, returns an associated 'fd'. Else, returns error.
  */
-int dma_buf_fd(struct dma_buf *dmabuf)
+int dma_buf_fd(struct dma_buf *dmabuf, int flags)
 {
 	int error, fd;
 
 	if (!dmabuf || !dmabuf->file)
 		return -EINVAL;
 
-	error = get_unused_fd();
+	error = get_unused_fd_flags(flags);
 	if (error < 0)
 		return error;
 	fd = error;
include/linux/dma-buf.h +1 -1
index a885b26..891457a 100644
@@ -117,7 +117,7 @@ void dma_buf_detach(struct dma_buf *dmabuf,
 				struct dma_buf_attachment *dmabuf_attach);
 struct dma_buf *dma_buf_export(void *priv, const struct dma_buf_ops *ops,
 			       size_t size, int flags);
-int dma_buf_fd(struct dma_buf *dmabuf);
+int dma_buf_fd(struct dma_buf *dmabuf, int flags);
 struct dma_buf *dma_buf_get(int fd);
 void dma_buf_put(struct dma_buf *dmabuf);
 
Signature · 1 line
1.7.6
#1 lore raw
Quoted 6 lines · Dave Airlie

From: Dave Airlie <[email protected]>

We need to pass the flags into dma_buf_fd at this point, so the flags end up doing the right thing for O_CLOEXEC.

Quoted 50 lines

---
 drivers/base/dma-buf.c  |    5 +++--
 include/linux/dma-buf.h |    2 +-

 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/base/dma-buf.c +3 -2
index c9a945f..3c8c023 100644
@@ -107,17 +107,18 @@ EXPORT_SYMBOL_GPL(dma_buf_export);
  /**
  * dma_buf_fd - returns a file descriptor for the given dma_buf
  * @dmabuf:    [in]    pointer to dma_buf for which fd is required.
+ * @flags:      [in]    flags to give to fd
  *
  * On success, returns an associated 'fd'. Else, returns error.
  */
-int dma_buf_fd(struct dma_buf *dmabuf)
+int dma_buf_fd(struct dma_buf *dmabuf, int flags)
  {
        int error, fd;
 
        if (!dmabuf || !dmabuf->file)
                return -EINVAL;
 
-       error = get_unused_fd();
+       error = get_unused_fd_flags(flags);
        if (error < 0)
                return error;
        fd = error;
include/linux/dma-buf.h +1 -2
index a885b26..891457a 100644
@@ -117,7 +117,7 @@ void dma_buf_detach(struct dma_buf *dmabuf,
                                struct dma_buf_attachment *dmabuf_attach);
  struct dma_buf *dma_buf_export(void *priv, const struct dma_buf_ops *ops,
                               size_t size, int flags);
-int dma_buf_fd(struct dma_buf *dmabuf);
+int dma_buf_fd(struct dma_buf *dmabuf, int flags);
  struct dma_buf *dma_buf_get(int fd);
  void dma_buf_put(struct dma_buf *dmabuf);
 
--

1.7.6

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel