xref: /openbmc/linux/fs/fuse/dax.c (revision 1dd53957)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * dax: direct host memory access
4  * Copyright (C) 2020 Red Hat, Inc.
5  */
6 
7 #include "fuse_i.h"
8 
9 #include <linux/dax.h>
10 
11 struct fuse_conn_dax {
12 	/* DAX device */
13 	struct dax_device *dev;
14 };
15 
16 void fuse_dax_conn_free(struct fuse_conn *fc)
17 {
18 	kfree(fc->dax);
19 }
20 
21 int fuse_dax_conn_alloc(struct fuse_conn *fc, struct dax_device *dax_dev)
22 {
23 	struct fuse_conn_dax *fcd;
24 
25 	if (!dax_dev)
26 		return 0;
27 
28 	fcd = kzalloc(sizeof(*fcd), GFP_KERNEL);
29 	if (!fcd)
30 		return -ENOMEM;
31 
32 	fcd->dev = dax_dev;
33 
34 	fc->dax = fcd;
35 	return 0;
36 }
37