@@ -618,26 +618,6 @@ static int rpc_populate(struct dentry *parent,
618618 return err ;
619619}
620620
621- static struct dentry * rpc_mkdir_populate (struct dentry * parent ,
622- const char * name , umode_t mode , void * private ,
623- int (* populate )(struct dentry * , void * ), void * args_populate )
624- {
625- struct dentry * dentry ;
626- int error ;
627-
628- dentry = rpc_new_dir (parent , name , mode , private );
629- if (IS_ERR (dentry ))
630- return dentry ;
631- if (populate != NULL ) {
632- error = populate (dentry , args_populate );
633- if (error ) {
634- simple_recursive_removal (dentry , NULL );
635- return ERR_PTR (error );
636- }
637- }
638- return dentry ;
639- }
640-
641621/**
642622 * rpc_mkpipe_dentry - make an rpc_pipefs file for kernel<->userspace
643623 * communication
@@ -888,13 +868,6 @@ static const struct rpc_filelist authfiles[] = {
888868 },
889869};
890870
891- static int rpc_clntdir_populate (struct dentry * dentry , void * private )
892- {
893- return rpc_populate (dentry ,
894- authfiles , RPCAUTH_info , RPCAUTH_EOF ,
895- private );
896- }
897-
898871/**
899872 * rpc_create_client_dir - Create a new rpc_client directory in rpc_pipefs
900873 * @dentry: the parent of new directory
@@ -911,13 +884,19 @@ struct dentry *rpc_create_client_dir(struct dentry *dentry,
911884 struct rpc_clnt * rpc_client )
912885{
913886 struct dentry * ret ;
887+ int error ;
914888
915- ret = rpc_mkdir_populate (dentry , name , 0555 , NULL ,
916- rpc_clntdir_populate , rpc_client );
917- if (!IS_ERR (ret )) {
918- rpc_client -> cl_pipedir_objects .pdh_dentry = ret ;
919- rpc_create_pipe_dir_objects (& rpc_client -> cl_pipedir_objects );
889+ ret = rpc_new_dir (dentry , name , 0555 , NULL );
890+ if (IS_ERR (ret ))
891+ return ret ;
892+ error = rpc_populate (ret , authfiles , RPCAUTH_info , RPCAUTH_EOF ,
893+ rpc_client );
894+ if (unlikely (error )) {
895+ simple_recursive_removal (ret , NULL );
896+ return ERR_PTR (error );
920897 }
898+ rpc_client -> cl_pipedir_objects .pdh_dentry = ret ;
899+ rpc_create_pipe_dir_objects (& rpc_client -> cl_pipedir_objects );
921900 return ret ;
922901}
923902
@@ -955,18 +934,20 @@ static const struct rpc_filelist cache_pipefs_files[3] = {
955934 },
956935};
957936
958- static int rpc_cachedir_populate (struct dentry * dentry , void * private )
959- {
960- return rpc_populate (dentry ,
961- cache_pipefs_files , 0 , 3 ,
962- private );
963- }
964-
965937struct dentry * rpc_create_cache_dir (struct dentry * parent , const char * name ,
966938 umode_t umode , struct cache_detail * cd )
967939{
968- return rpc_mkdir_populate (parent , name , umode , NULL ,
969- rpc_cachedir_populate , cd );
940+ struct dentry * dentry ;
941+
942+ dentry = rpc_new_dir (parent , name , umode , NULL );
943+ if (!IS_ERR (dentry )) {
944+ int error = rpc_populate (dentry , cache_pipefs_files , 0 , 3 , cd );
945+ if (error ) {
946+ simple_recursive_removal (dentry , NULL );
947+ return ERR_PTR (error );
948+ }
949+ }
950+ return dentry ;
970951}
971952
972953void rpc_remove_cache_dir (struct dentry * dentry )
0 commit comments