@@ -57,10 +57,10 @@ impl Dentry {
57
57
/// # Errors
58
58
/// Currently, this function does not return any error. However, this may change
59
59
/// in the future.
60
- pub fn open ( & self , flags : OpenFlags ) -> Result < File , OpenError > {
60
+ pub fn open ( self : & Arc < Self > , flags : OpenFlags ) -> Result < File , OpenError > {
61
61
Ok ( file:: File :: new ( FileCreateInfo {
62
62
operation : self . inode . file_ops . clone ( ) ,
63
- inode : Some ( self . inode . clone ( ) ) ,
63
+ dentry : Some ( self . clone ( ) ) ,
64
64
open_flags : flags,
65
65
data : Box :: new ( ( ) ) ,
66
66
} ) )
@@ -190,12 +190,12 @@ impl Dentry {
190
190
/// if this function fails to connect the created dentry to this dentry. This should
191
191
/// never happen and is a serious kernel bug.
192
192
pub fn create_and_fetch_file (
193
- dentry : Arc < Self > ,
193
+ dentry : & Arc < Self > ,
194
194
name : Name ,
195
195
) -> Result < Arc < Self > , CreateFetchError > {
196
196
// Search for the file in the dentry cache and in the underlying filesystem.
197
197
// If a file with the same name already exists, return an error.
198
- match Self :: fetch ( & dentry, & name) {
198
+ match Self :: fetch ( dentry, & name) {
199
199
Err ( FetchError :: NotFound ) => { }
200
200
Err ( FetchError :: NotADirectory ) => return Err ( CreateFetchError :: NotADirectory ) ,
201
201
Err ( FetchError :: IoError ) => return Err ( CreateFetchError :: IoError ) ,
@@ -219,10 +219,10 @@ impl Dentry {
219
219
220
220
// If an entry with the same name was created in the meantime, we
221
221
// simply return an error.
222
- match Self :: connect_child ( & dentry, child) {
222
+ match Self :: connect_child ( dentry, Arc :: clone ( & child) ) {
223
223
Err ( ConnectError :: AlreadyConnected | ConnectError :: NotADirectory ) => unreachable ! ( ) ,
224
224
Err ( ConnectError :: AlreadyExists ) => Err ( CreateFetchError :: AlreadyExists ) ,
225
- Ok ( _) => Ok ( dentry ) ,
225
+ Ok ( _) => Ok ( child ) ,
226
226
}
227
227
}
228
228
@@ -349,12 +349,6 @@ impl Dentry {
349
349
}
350
350
}
351
351
352
- impl Drop for Dentry {
353
- fn drop ( & mut self ) {
354
- log:: debug!( "Dentry dropped: {:?}" , self . name( ) ) ;
355
- }
356
- }
357
-
358
352
/// Represents a dentry in the filesystem tree. This structure is used to
359
353
/// contains fields that can be modified by the filesystem driver, like the
360
354
/// children list or the dentr name. The [`Dentry`] structure contains fields
0 commit comments