4242#define NULLFS_MAGIC 0x19980123
4343#define NULLFS_DEFAULT_MODE 0755
4444#define NULLFS_SYSFS_MODE 0644
45- #define NULLFS_VERSION "0.17 "
45+ #define NULLFS_VERSION "0.18 "
4646
4747MODULE_AUTHOR ("Michael Ablassmeier" );
4848MODULE_LICENSE ("GPL" );
4949MODULE_VERSION (NULLFS_VERSION );
5050
51+ struct inode * nullfs_get_inode (struct super_block * , const struct inode * , umode_t , dev_t , struct dentry * );
52+ int nullfs_statfs (struct dentry * , struct kstatfs * );
53+ int nullfs_fill_super (struct super_block * , void * , int );
54+
5155/*
5256 * POSIX ACL
5357 * setfacl is possible, but acls are not stored, of course
@@ -101,7 +105,7 @@ static ssize_t exclude_store(struct kobject *kobj, struct kobj_attribute *attr,
101105 if (p )
102106 * p = '\0' ;
103107 strncpy (exclude , buf , sizeof (exclude ));
104- printk (KERN_INFO "nullfs: will keep data for files matching: [%s]" ,
108+ printk (KERN_INFO "nullfs: will keep data for files matching: [%s]\n " ,
105109 exclude );
106110 return count ;
107111}
@@ -323,7 +327,7 @@ static int nullfs_parse_options(char *data, struct nullfs_mount_opts *opts)
323327 }
324328 }
325329 if (opts -> write != NULL )
326- printk (KERN_INFO "nullfs: will keep data for files matching: [%s]" ,
330+ printk (KERN_INFO "nullfs: will keep data for files matching: [%s]\n " ,
327331 opts -> write );
328332 return 0 ;
329333}
@@ -402,6 +406,8 @@ struct inode *nullfs_get_inode(struct super_block *sb,
402406 case S_IFDIR :
403407 inode -> i_op = & nullfs_dir_inode_operations ;
404408 inode -> i_fop = & simple_dir_operations ;
409+
410+ /* directory inodes start off with i_nlink == 2 (for "." entry) */
405411 inc_nlink (inode );
406412 break ;
407413 case S_IFLNK :
@@ -455,7 +461,10 @@ static int nullfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
455461 return error ;
456462}
457463
458- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 3 , 0 )
464+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 15 , 0 )
465+ static struct dentry * nullfs_mkdir (struct mnt_idmap * idmap ,
466+ struct inode * dir , struct dentry * dentry , umode_t mode )
467+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 3 , 0 )
459468static int nullfs_mkdir (struct mnt_idmap * idmap ,
460469 struct inode * dir , struct dentry * dentry , umode_t mode )
461470#elif LINUX_VERSION_CODE >= KERNEL_VERSION (5 , 12 , 0 )
@@ -476,7 +485,12 @@ static int nullfs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode
476485
477486 if (!retval )
478487 inc_nlink (dir );
488+
489+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 15 , 0 )
490+ return ERR_PTR (retval );
491+ #else
479492 return retval ;
493+ #endif
480494}
481495
482496#if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 3 , 0 )
@@ -501,7 +515,7 @@ static int nullfs_symlink(struct inode * dir, struct dentry *dentry, const char
501515 dget (dentry );
502516#ifndef CURRENT_TIME
503517#if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
504- inode_set_mtime_to_ts (dir , inode_set_ctime_current (dir ));
518+ inode_set_mtime_to_ts (dir , inode_set_ctime_current (dir ));
505519#elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
506520 dir -> i_mtime = inode_set_ctime_current (dir );
507521#else
@@ -559,7 +573,7 @@ static int nullfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode
559573#else
560574 d_tmpfile (dentry , inode );
561575#endif
562- return 0 ;
576+ return finish_open_simple ( file , 0 ) ;
563577}
564578#endif
565579
@@ -675,7 +689,7 @@ static int __init nullfs_init(void)
675689 kobject_put (exclude_kobj );
676690
677691 register_filesystem (& nullfs_type );
678- printk (KERN_INFO "nullfs: version [%s] initialized" , NULLFS_VERSION );
692+ printk (KERN_INFO "nullfs: version [%s] initialized\n " , NULLFS_VERSION );
679693 return 0 ;
680694}
681695
0 commit comments