strtok --> strsep in filesystem drivers
Subsystems (13)
PATCH 1/1 strtok --> strsep in filesystem drivers
Hi,
here comes another strtok related patch. This time all strtok calls in filesystem drivers are converted to strsep calls.
This patch is made against kernel 2.4.13 and applies, with some offsets, against kernel 2.4.12-ac6, too.
As usual, I did NOT test this patch. ;) It compiles, 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,"," )) { +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,"," )) { +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,"," )) { +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,"," )) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"fd" )) {
fs/devpts/inode.c +6 -4
@@ -66,10 +66,11 @@umode_t mode =0600 ;char *this_char, *value; - this_char =NULL ; -if ( options ) - this_char =strtok (options,"," ); -for ( ; this_char; this_char =strtok (NULL ,"," )) { +if (!options) + goto default_settings; +while ( this_char =strsep (&options,"," ) ) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"uid" )) {
@@ -98,6 +99,7 @@else return 1 ; } +default_settings: sbi->setuid = setuid; sbi->setgid = setgid; sbi->uid = 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,"," )) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"bsddf" ))
fs/fat/inode.c +2 -3
@@ -210,7 +210,7 @@ char *cvf_format, char *cvf_options) { char *this_char,*value,save,*savep; -char *p; +char *p,*options_p = options;int ret =1 , len; opts->name_check ='n' ;
@@ -230,8 +230,7 @@ goto out; save =0 ; savep =NULL ; -for (this_char =strtok (options,"," ); this_char; - this_char =strtok (NULL ,"," )) { +while (this_char =strsep (&options_p,"," )) {if ((value =strchr (this_char,'=' )) !=NULL ) { save = *value; savep = value;
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,"," )) { +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,"," )) { +if (!*p) +continue ;if ((rhs =strchr (p,'=' )) !=0 ) *rhs++ ='\0' ;if (!strcmp (p,"help" ))return 2 ;
fs/isofs/inode.c +3 -1
@@ -290,7 +290,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,"," )) { +if (!*this_char) +continue ;if (strncmp (this_char,"norock" ,6 ) ==0 ) { popt->rock ='n' ;continue ;
fs/nfs/nfsroot.c +3 -3
@@ -202,8 +202,9 @@if ((options =strchr (name,',' ))) { *options++ =0 ; - cp =strtok (options,"," ); -while (cp) { +while (cp =strsep (&options,"," )) { +if (!*cp) +continue ;if ((val =strchr (cp,'=' ))) {struct nfs_int_opts *opts = root_int_opts; *val++ ='\0' ;
@@ -220,7 +221,6 @@ nfs_data.flags |= opts->or_mask; } } - cp =strtok (NULL ,"," ); } }if (name[0 ] &&strcmp (name,"default" )) {
fs/ntfs/fs.c +4 -1
@@ -365,10 +365,13 @@int use_utf8 =-1 ;/* If no NLS specified and loading the default NLS failed use utf8. */ int mft_zone_mul =-1 ;/* 1 */ +char *options = opt;if (!opt) goto done; -for (opt =strtok (opt,"," ); opt; opt =strtok (NULL ,"," )) { +while (opt =strsep (&options,"," )) { +if (!*opt) +continue ;if ((value =strchr (opt,'=' )) !=NULL ) *value ++='\0' ;if (strcmp (opt,"uid" ) ==0 ) {
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,"," )) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"uid" )) {
fs/reiserfs/super.c +3 -1
@@ -144,7 +144,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,"," )) { +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,"," )) { +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,"," )) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) *value++ =0 ;if (!strcmp (this_char,"ufstype" )) {
fs/vfat/namei.c +2 -1
@@ -104,6 +104,7 @@ {char *this_char,*value,save,*savep;int ret, val; +char *options_p = options; opts->unicode_xlate = opts->posixfs =0 ; opts->numtail =1 ;
@@ -120,7 +121,7 @@ save =0 ; savep =NULL ; ret =1 ; -for (this_char =strtok (options,"," ); this_char; this_char =strtok (NULL ,"," )) { +while (this_char =strsep (&options_p,"," )) {if ((value =strchr (this_char,'=' )) !=NULL ) { save = *value; savep = value;
mm/shmem.c +5 -4
@@ -1237,10 +1237,11 @@ {char *this_char, *value, *rest; - this_char =NULL ; -if ( options ) - this_char =strtok (options,"," ); -for ( ; this_char; this_char =strtok (NULL ,"," )) { +if (!options) +return 0 ; +while (this_char =strsep (&options,"," )) { +if (!*this_char) +continue ;if ((value =strchr (this_char,'=' )) !=NULL ) { *value++ =0 ; }else {