summaryrefslogtreecommitdiffstats
path: root/sys/ofed/include/linux/file.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ofed/include/linux/file.h')
-rw-r--r--sys/ofed/include/linux/file.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/ofed/include/linux/file.h b/sys/ofed/include/linux/file.h
index b76a408..1f72822 100644
--- a/sys/ofed/include/linux/file.h
+++ b/sys/ofed/include/linux/file.h
@@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -119,6 +119,21 @@ get_unused_fd(void)
return fd;
}
+static inline int
+get_unused_fd_flags(int flags)
+{
+ struct file *file;
+ int error;
+ int fd;
+
+ error = falloc(curthread, &file, &fd, flags);
+ if (error)
+ return -error;
+ /* drop the extra reference */
+ fdrop(file, curthread);
+ return fd;
+}
+
static inline struct linux_file *
alloc_file(int mode, const struct file_operations *fops)
{
OpenPOWER on IntegriCloud