Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rpc_pipe: expand the calls of rpc_mkdir_populate()

... and get rid of convoluted callbacks.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 805060a6 065e88fa

+22 -41
+22 -41
net/sunrpc/rpc_pipe.c
··· 618 618 return err; 619 619 } 620 620 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 - 641 621 /** 642 622 * rpc_mkpipe_dentry - make an rpc_pipefs file for kernel<->userspace 643 623 * communication ··· 868 888 }, 869 889 }; 870 890 871 - static int rpc_clntdir_populate(struct dentry *dentry, void *private) 872 - { 873 - return rpc_populate(dentry, 874 - authfiles, RPCAUTH_info, RPCAUTH_EOF, 875 - private); 876 - } 877 - 878 891 /** 879 892 * rpc_create_client_dir - Create a new rpc_client directory in rpc_pipefs 880 893 * @dentry: the parent of new directory ··· 884 911 struct rpc_clnt *rpc_client) 885 912 { 886 913 struct dentry *ret; 914 + int error; 887 915 888 - ret = rpc_mkdir_populate(dentry, name, 0555, NULL, 889 - rpc_clntdir_populate, rpc_client); 890 - if (!IS_ERR(ret)) { 891 - rpc_client->cl_pipedir_objects.pdh_dentry = ret; 892 - rpc_create_pipe_dir_objects(&rpc_client->cl_pipedir_objects); 916 + ret = rpc_new_dir(dentry, name, 0555, NULL); 917 + if (IS_ERR(ret)) 918 + return ret; 919 + error = rpc_populate(ret, authfiles, RPCAUTH_info, RPCAUTH_EOF, 920 + rpc_client); 921 + if (unlikely(error)) { 922 + simple_recursive_removal(ret, NULL); 923 + return ERR_PTR(error); 893 924 } 925 + rpc_client->cl_pipedir_objects.pdh_dentry = ret; 926 + rpc_create_pipe_dir_objects(&rpc_client->cl_pipedir_objects); 894 927 return ret; 895 928 } 896 929 ··· 934 955 }, 935 956 }; 936 957 937 - static int rpc_cachedir_populate(struct dentry *dentry, void *private) 938 - { 939 - return rpc_populate(dentry, 940 - cache_pipefs_files, 0, 3, 941 - private); 942 - } 943 - 944 958 struct dentry *rpc_create_cache_dir(struct dentry *parent, const char *name, 945 959 umode_t umode, struct cache_detail *cd) 946 960 { 947 - return rpc_mkdir_populate(parent, name, umode, NULL, 948 - rpc_cachedir_populate, cd); 961 + struct dentry *dentry; 962 + 963 + dentry = rpc_new_dir(parent, name, umode, NULL); 964 + if (!IS_ERR(dentry)) { 965 + int error = rpc_populate(dentry, cache_pipefs_files, 0, 3, cd); 966 + if (error) { 967 + simple_recursive_removal(dentry, NULL); 968 + return ERR_PTR(error); 969 + } 970 + } 971 + return dentry; 949 972 } 950 973 951 974 void rpc_remove_cache_dir(struct dentry *dentry)