Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Jul 2017 20:11:06 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320813 - in head/sys/compat/linuxkpi/common: include/linux src
Message-ID:  <201707082011.v68KB6hY078410@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Sat Jul  8 20:11:06 2017
New Revision: 320813
URL: https://svnweb.freebsd.org/changeset/base/320813

Log:
  Add some helper definitions to fs.h in the LinuxKPI.
  
  Add a field to struct linux_file to allow the creation of anonymous
  shmem objects.
  
  MFC after:	1 week

Modified:
  head/sys/compat/linuxkpi/common/include/linux/fs.h
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/fs.h	Sat Jul  8 19:22:29 2017	(r320812)
+++ head/sys/compat/linuxkpi/common/include/linux/fs.h	Sat Jul  8 20:11:06 2017	(r320813)
@@ -80,8 +80,12 @@ struct linux_file {
 	struct selinfo	f_selinfo;
 	struct sigio	*f_sigio;
 	struct vnode	*f_vnode;
+#define	f_inode	f_vnode
 	volatile u_int	f_count;
 
+	/* anonymous shmem object */
+	vm_object_t	f_shmem;
+
 	/* kqfilter support */
 	int		f_kqflags;
 #define	LINUX_KQ_FLAG_HAS_READ (1 << 0)
@@ -156,7 +160,8 @@ struct file_operations {
 	int (*setlease)(struct file *, long, struct file_lock **);
 #endif
 };
-#define	fops_get(fops)	(fops)
+#define	fops_get(fops)		(fops)
+#define	replace_fops(f, fops)	((f)->f_op = (fops))
 
 #define	FMODE_READ	FREAD
 #define	FMODE_WRITE	FWRITE

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_compat.c	Sat Jul  8 19:22:29 2017	(r320812)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c	Sat Jul  8 20:11:06 2017	(r320813)
@@ -463,6 +463,8 @@ void
 linux_file_free(struct linux_file *filp)
 {
 	if (filp->_file == NULL) {
+		if (filp->f_shmem != NULL)
+			vm_object_deallocate(filp->f_shmem);
 		kfree(filp);
 	} else {
 		/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707082011.v68KB6hY078410>