11/*
2- * Copyright (c) 2008, 2022 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2008, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,7 @@ static jfieldID entry_name;
5050static jfieldID entry_dir ;
5151static jfieldID entry_fstype ;
5252static jfieldID entry_options ;
53+ static jfieldID entry_dev ;
5354
5455struct fsstat_iter {
5556 struct statfs * buf ;
@@ -85,6 +86,8 @@ Java_sun_nio_fs_BsdNativeDispatcher_initIDs(JNIEnv* env, jclass this)
8586 CHECK_NULL (entry_fstype );
8687 entry_options = (* env )-> GetFieldID (env , clazz , "opts" , "[B" );
8788 CHECK_NULL (entry_options );
89+ entry_dev = (* env )-> GetFieldID (env , clazz , "dev" , "J" );
90+ CHECK_NULL (entry_dev );
8891}
8992
9093JNIEXPORT jlong JNICALL
@@ -151,6 +154,8 @@ Java_sun_nio_fs_BsdNativeDispatcher_fsstatEntry(JNIEnv* env, jclass this,
151154 char * dir ;
152155 char * fstype ;
153156 char * options ;
157+ int32_t fsid_val [2 ];
158+ long dev ;
154159
155160 if (iter == NULL || iter -> pos >= iter -> nentries )
156161 return -1 ;
@@ -162,6 +167,8 @@ Java_sun_nio_fs_BsdNativeDispatcher_fsstatEntry(JNIEnv* env, jclass this,
162167 options = "ro" ;
163168 else
164169 options = "" ;
170+ fsid_val [0 ] = iter -> buf [iter -> pos ].f_fsid .val [0 ];
171+ fsid_val [1 ] = iter -> buf [iter -> pos ].f_fsid .val [1 ];
165172
166173 iter -> pos ++ ;
167174
@@ -193,6 +200,9 @@ Java_sun_nio_fs_BsdNativeDispatcher_fsstatEntry(JNIEnv* env, jclass this,
193200 (* env )-> SetByteArrayRegion (env , bytes , 0 , len , (jbyte * )options );
194201 (* env )-> SetObjectField (env , entry , entry_options , bytes );
195202
203+ dev = (((long )fsid_val [1 ]) << 32 ) | (long )fsid_val [0 ];
204+ (* env )-> SetLongField (env , entry , entry_dev , long_to_jlong (dev ));
205+
196206 return 0 ;
197207}
198208
0 commit comments