strtok --> strsep in filesystem drivers (part 1)
Subsystems (8)
PATCH 1/1 strtok --> strsep in filesystem drivers (part 1)
Hello again,
patch below is for making most of the filesystem drivers strtok()-free. Part 2 will consist of some not so boring chunks.
As usual, the patch is untested. It survived a heavy staring-at-it, though. ;) Please, apply.
René
fs/adfs/super.c +3 -1
@@ -171,7 +171,9 @@if (!options)return 0 ; -for (opt =strtok (options,"," ); opt !=NULL ; opt =strtok (NULL ,"," )) { +while ((opt =strsep (&options,"," )) !=NULL ) { +if (!*opt) +continue ; value =strchr (opt,'=' );if (value) *value++ ='\0' ;
fs/affs/super.c +3 -1
@@ -109,7 +109,9 @@ *mount_opts =0 ;if (!options)return 1 ; -for (this_char =strtok (options,"," ); this_char; this_char =strtok (NULL ,"," )) { +while ((this_char =strsep (&options,"," )) !=NULL ) { +if (!*this_char) +continue ; f =0 ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;
fs/autofs/inode.c +3 -1
@@ -60,7 +60,9 @@ *pipefd =-1 ;if ( !options )return 1 ; -for (this_char =strtok (options,"," ); this_char; this_char =strtok (NULL ,"," )) { +while ((this_char =strsep (&options,"," )) !=NULL ) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"fd" )) {
fs/autofs4/inode.c +3 -1
@@ -112,7 +112,9 @@ *pipefd =-1 ;if ( !options )return 1 ; -for (this_char =strtok (options,"," ); this_char; this_char =strtok (NULL ,"," )) { +while ((this_char =strsep (&options,"," )) !=NULL ) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"fd" )) {
fs/devpts/inode.c +3 -4
@@ -66,10 +66,9 @@umode_t mode =0600 ;char *this_char, *value; - this_char =NULL ; -if ( options ) - this_char =strtok (options,"," ); -for ( ; this_char; this_char =strtok (NULL ,"," )) { +while ((this_char =strsep (&options,"," )) !=NULL ) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"uid" )) {
fs/ext2/super.c +3 -3
@@ -166,9 +166,9 @@if (!options)return 1 ; -for (this_char =strtok (options,"," ); - this_char !=NULL ; - this_char =strtok (NULL ,"," )) { +while ((this_char =strsep (&options,"," )) !=NULL ) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"bsddf" ))
fs/ext3/super.c +3 -3
@@ -505,9 +505,9 @@if (!options)return 1 ; -for (this_char =strtok (options,"," ); - this_char !=NULL ; - this_char =strtok (NULL ,"," )) { +while ((this_char =strsep (&options,"," )) !=NULL ) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"bsddf" ))
fs/hfs/super.c +3 -2
@@ -181,8 +181,9 @@if (!options) { goto done; } -for (this_char =strtok (options,"," ); this_char; - this_char =strtok (NULL ,"," )) { +while ((this_char =strsep (&options,"," )) !=NULL ) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) { *value++ =0 ; }
fs/hpfs/super.c +3 -1
@@ -176,7 +176,9 @@/*printk("Parsing opts: '%s'\n",opts);*/ -for (p =strtok (opts,"," ); p !=0 ; p =strtok (0 ,"," )) { +while ((p =strsep (&opts,"," )) !=NULL ) { +if (!*p) +continue ;if ((rhs =strchr (p,'=' )) !=0 ) *rhs++ ='\0' ;if (!strcmp (p,"help" ))return 2 ;
fs/intermezzo/super.c +3 -3
@@ -120,10 +120,10 @@store_opt (prestodev,NULL ,PRESTO_PSDEV_NAME "0" );CDEBUG (D_SUPER ,"parsing options\n" ); -for (this_char =strtok (options,"," ); - this_char !=NULL ; - this_char =strtok (NULL ,"," )) { +while ((this_char =strsep (&options,"," )) !=NULL ) {char *opt; +if (!*this_char) +continue ;CDEBUG (D_SUPER ,"this_char %s\n" , this_char);if ( (opt =read_opt ("fileset" , this_char)) ) {
fs/isofs/inode.c +3 -1
@@ -294,7 +294,9 @@ popt->session=-1 ; popt->sbsector=-1 ;if (!options)return 1 ; -for (this_char =strtok (options,"," ); this_char; this_char =strtok (NULL ,"," )) { +while ((this_char =strsep (&options,"," )) !=NULL ) { +if (!*this_char) +continue ;if (strncmp (this_char,"norock" ,6 ) ==0 ) { popt->rock ='n' ;continue ;
fs/proc/inode.c +3 -1
@@ -106,7 +106,9 @@ *uid = current->uid; *gid = current->gid;if (!options)return 1 ; -for (this_char =strtok (options,"," ); this_char; this_char =strtok (NULL ,"," )) { +while ((this_char =strsep (&options,"," )) !=NULL ) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"uid" )) {
fs/reiserfs/super.c +3 -1
@@ -153,7 +153,9 @@/* use default configuration: create tails, journaling on, no conversion to newest format */ return 1 ; -for (this_char =strtok (options,"," ); this_char !=NULL ; this_char =strtok (NULL ,"," )) { +while ((this_char =strsep (&options,"," )) !=NULL ) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"notail" )) {
fs/udf/super.c +3 -1
@@ -218,8 +218,10 @@if (!options)return 1 ; -for (opt =strtok (options,"," ); opt; opt =strtok (NULL ,"," )) +while ((opt =strsep (&options,"," )) !=NULL ) { +if (!*opt) +continue ;/* Make "opt=val" into two strings */ val =strchr (opt,'=' );if (val)
fs/ufs/super.c +3 -4
@@ -257,10 +257,9 @@if (!options)return 1 ; -for (this_char =strtok (options,"," ); - this_char !=NULL ; - this_char =strtok (NULL ,"," )) { - +while ((this_char =strsep (&options,"," )) !=NULL ) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"ufstype" )) {