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 {
                /*
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to