< prev index next >

src/java.base/unix/classes/sun/nio/fs/UnixChannelFactory.java

Print this page

        

@@ -62,10 +62,11 @@
         boolean create;
         boolean createNew;
         boolean deleteOnClose;
         boolean sync;
         boolean dsync;
+        boolean direct;
 
         static Flags toFlags(Set<? extends OpenOption> options) {
             Flags flags = new Flags();
             for (OpenOption option: options) {
                 if (option instanceof StandardOpenOption) {

@@ -86,10 +87,16 @@
                 }
                 if (option == LinkOption.NOFOLLOW_LINKS && O_NOFOLLOW != 0) {
                     flags.noFollowLinks = true;
                     continue;
                 }
+
+                if (ExtendedOptions.DIRECT.matches(option)) {
+                    flags.direct = true;
+                    continue;
+                }
+
                 if (option == null)
                     throw new NullPointerException();
                throw new UnsupportedOperationException(option + " not supported");
             }
             return flags;

@@ -234,10 +241,13 @@
         if (flags.dsync)
             oflags |= O_DSYNC;
         if (flags.sync)
             oflags |= O_SYNC;
 
+        if (flags.direct)
+            oflags |= O_DIRECT;
+
         // permission check before we open the file
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             if (pathForPermissionCheck == null)
                 pathForPermissionCheck = path.getPathForPermissionCheck();

@@ -287,8 +297,9 @@
 
         // create java.io.FileDescriptor
         FileDescriptor fdObj = new FileDescriptor();
         fdAccess.set(fdObj, fd);
         fdAccess.setAppend(fdObj, flags.append);
+        fdAccess.setDirect(fdObj, flags.direct);
         return fdObj;
     }
 }
< prev index next >