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

SUNRPC: Change return value type of .pc_encode

Returning an undecorated integer is an age-old trope, but it's
not clear (even to previous experts in this code) that the only
valid return values are 1 and 0. These functions do not return
a negative errno, rpc_stat value, or a positive length.

Document there are only two valid return values by having
.pc_encode return only true or false.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Chuck Lever and committed by
J. Bruce Fields
130e2054 fda49441

+183 -183
+9 -9
fs/lockd/xdr.c
··· 313 313 * Encode Reply results 314 314 */ 315 315 316 - int 316 + bool 317 317 nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr) 318 318 { 319 - return 1; 319 + return true; 320 320 } 321 321 322 - int 322 + bool 323 323 nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 324 324 { 325 325 struct nlm_res *resp = rqstp->rq_resp; ··· 328 328 svcxdr_encode_testrply(xdr, resp); 329 329 } 330 330 331 - int 331 + bool 332 332 nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr) 333 333 { 334 334 struct nlm_res *resp = rqstp->rq_resp; ··· 337 337 svcxdr_encode_stats(xdr, resp->status); 338 338 } 339 339 340 - int 340 + bool 341 341 nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 342 342 { 343 343 struct nlm_res *resp = rqstp->rq_resp; 344 344 345 345 if (!svcxdr_encode_cookie(xdr, &resp->cookie)) 346 - return 0; 346 + return false; 347 347 if (!svcxdr_encode_stats(xdr, resp->status)) 348 - return 0; 348 + return false; 349 349 /* sequence */ 350 350 if (xdr_stream_encode_u32(xdr, 0) < 0) 351 - return 0; 351 + return false; 352 352 353 - return 1; 353 + return true; 354 354 }
+9 -9
fs/lockd/xdr4.c
··· 312 312 * Encode Reply results 313 313 */ 314 314 315 - int 315 + bool 316 316 nlm4svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr) 317 317 { 318 - return 1; 318 + return true; 319 319 } 320 320 321 - int 321 + bool 322 322 nlm4svc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 323 323 { 324 324 struct nlm_res *resp = rqstp->rq_resp; ··· 327 327 svcxdr_encode_testrply(xdr, resp); 328 328 } 329 329 330 - int 330 + bool 331 331 nlm4svc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr) 332 332 { 333 333 struct nlm_res *resp = rqstp->rq_resp; ··· 336 336 svcxdr_encode_stats(xdr, resp->status); 337 337 } 338 338 339 - int 339 + bool 340 340 nlm4svc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 341 341 { 342 342 struct nlm_res *resp = rqstp->rq_resp; 343 343 344 344 if (!svcxdr_encode_cookie(xdr, &resp->cookie)) 345 - return 0; 345 + return false; 346 346 if (!svcxdr_encode_stats(xdr, resp->status)) 347 - return 0; 347 + return false; 348 348 /* sequence */ 349 349 if (xdr_stream_encode_u32(xdr, 0) < 0) 350 - return 0; 350 + return false; 351 351 352 - return 1; 352 + return true; 353 353 }
+2 -2
fs/nfs/callback_xdr.c
··· 67 67 * svc_process_common() looks for an XDR encoder to know when 68 68 * not to drop a Reply. 69 69 */ 70 - static int nfs4_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr) 70 + static bool nfs4_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr) 71 71 { 72 - return 1; 72 + return true; 73 73 } 74 74 75 75 static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len,
+2 -2
fs/nfsd/nfs2acl.c
··· 240 240 */ 241 241 242 242 /* GETACL */ 243 - static int 243 + static bool 244 244 nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 245 245 { 246 246 struct nfsd3_getaclres *resp = rqstp->rq_resp; ··· 280 280 } 281 281 282 282 /* ACCESS */ 283 - static int 283 + static bool 284 284 nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 285 285 { 286 286 struct nfsd3_accessres *resp = rqstp->rq_resp;
+9 -9
fs/nfsd/nfs3acl.c
··· 166 166 */ 167 167 168 168 /* GETACL */ 169 - static int 169 + static bool 170 170 nfs3svc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 171 171 { 172 172 struct nfsd3_getaclres *resp = rqstp->rq_resp; ··· 178 178 int w; 179 179 180 180 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 181 - return 0; 181 + return false; 182 182 switch (resp->status) { 183 183 case nfs_ok: 184 184 inode = d_inode(dentry); 185 185 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 186 - return 0; 186 + return false; 187 187 if (xdr_stream_encode_u32(xdr, resp->mask) < 0) 188 - return 0; 188 + return false; 189 189 190 190 base = (char *)xdr->p - (char *)head->iov_base; 191 191 ··· 194 194 (resp->mask & NFS_DFACL) ? resp->acl_default : NULL); 195 195 while (w > 0) { 196 196 if (!*(rqstp->rq_next_page++)) 197 - return 0; 197 + return false; 198 198 w -= PAGE_SIZE; 199 199 } 200 200 ··· 207 207 resp->mask & NFS_DFACL, 208 208 NFS_ACL_DEFAULT); 209 209 if (n <= 0) 210 - return 0; 210 + return false; 211 211 break; 212 212 default: 213 213 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 214 - return 0; 214 + return false; 215 215 } 216 216 217 - return 1; 217 + return true; 218 218 } 219 219 220 220 /* SETACL */ 221 - static int 221 + static bool 222 222 nfs3svc_encode_setaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 223 223 { 224 224 struct nfsd3_attrstat *resp = rqstp->rq_resp;
+83 -83
fs/nfsd/nfs3xdr.c
··· 812 812 */ 813 813 814 814 /* GETATTR */ 815 - int 815 + bool 816 816 nfs3svc_encode_getattrres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 817 817 { 818 818 struct nfsd3_attrstat *resp = rqstp->rq_resp; 819 819 820 820 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 821 - return 0; 821 + return false; 822 822 switch (resp->status) { 823 823 case nfs_ok: 824 824 lease_get_mtime(d_inode(resp->fh.fh_dentry), &resp->stat.mtime); 825 825 if (!svcxdr_encode_fattr3(rqstp, xdr, &resp->fh, &resp->stat)) 826 - return 0; 826 + return false; 827 827 break; 828 828 } 829 829 830 - return 1; 830 + return true; 831 831 } 832 832 833 833 /* SETATTR, REMOVE, RMDIR */ 834 - int 834 + bool 835 835 nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr) 836 836 { 837 837 struct nfsd3_attrstat *resp = rqstp->rq_resp; ··· 841 841 } 842 842 843 843 /* LOOKUP */ 844 - int 844 + bool 845 845 nfs3svc_encode_lookupres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 846 846 { 847 847 struct nfsd3_diropres *resp = rqstp->rq_resp; 848 848 849 849 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 850 - return 0; 850 + return false; 851 851 switch (resp->status) { 852 852 case nfs_ok: 853 853 if (!svcxdr_encode_nfs_fh3(xdr, &resp->fh)) 854 - return 0; 854 + return false; 855 855 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 856 - return 0; 856 + return false; 857 857 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->dirfh)) 858 - return 0; 858 + return false; 859 859 break; 860 860 default: 861 861 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->dirfh)) 862 - return 0; 862 + return false; 863 863 } 864 864 865 - return 1; 865 + return true; 866 866 } 867 867 868 868 /* ACCESS */ 869 - int 869 + bool 870 870 nfs3svc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 871 871 { 872 872 struct nfsd3_accessres *resp = rqstp->rq_resp; 873 873 874 874 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 875 - return 0; 875 + return false; 876 876 switch (resp->status) { 877 877 case nfs_ok: 878 878 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 879 - return 0; 879 + return false; 880 880 if (xdr_stream_encode_u32(xdr, resp->access) < 0) 881 - return 0; 881 + return false; 882 882 break; 883 883 default: 884 884 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 885 - return 0; 885 + return false; 886 886 } 887 887 888 - return 1; 888 + return true; 889 889 } 890 890 891 891 /* READLINK */ 892 - int 892 + bool 893 893 nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 894 894 { 895 895 struct nfsd3_readlinkres *resp = rqstp->rq_resp; 896 896 struct kvec *head = rqstp->rq_res.head; 897 897 898 898 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 899 - return 0; 899 + return false; 900 900 switch (resp->status) { 901 901 case nfs_ok: 902 902 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 903 - return 0; 903 + return false; 904 904 if (xdr_stream_encode_u32(xdr, resp->len) < 0) 905 - return 0; 905 + return false; 906 906 xdr_write_pages(xdr, resp->pages, 0, resp->len); 907 907 if (svc_encode_result_payload(rqstp, head->iov_len, resp->len) < 0) 908 - return 0; 908 + return false; 909 909 break; 910 910 default: 911 911 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 912 - return 0; 912 + return false; 913 913 } 914 914 915 - return 1; 915 + return true; 916 916 } 917 917 918 918 /* READ */ 919 - int 919 + bool 920 920 nfs3svc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 921 921 { 922 922 struct nfsd3_readres *resp = rqstp->rq_resp; 923 923 struct kvec *head = rqstp->rq_res.head; 924 924 925 925 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 926 - return 0; 926 + return false; 927 927 switch (resp->status) { 928 928 case nfs_ok: 929 929 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 930 - return 0; 930 + return false; 931 931 if (xdr_stream_encode_u32(xdr, resp->count) < 0) 932 - return 0; 932 + return false; 933 933 if (xdr_stream_encode_bool(xdr, resp->eof) < 0) 934 - return 0; 934 + return false; 935 935 if (xdr_stream_encode_u32(xdr, resp->count) < 0) 936 - return 0; 936 + return false; 937 937 xdr_write_pages(xdr, resp->pages, rqstp->rq_res.page_base, 938 938 resp->count); 939 939 if (svc_encode_result_payload(rqstp, head->iov_len, resp->count) < 0) 940 - return 0; 940 + return false; 941 941 break; 942 942 default: 943 943 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 944 - return 0; 944 + return false; 945 945 } 946 946 947 - return 1; 947 + return true; 948 948 } 949 949 950 950 /* WRITE */ 951 - int 951 + bool 952 952 nfs3svc_encode_writeres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 953 953 { 954 954 struct nfsd3_writeres *resp = rqstp->rq_resp; 955 955 956 956 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 957 - return 0; 957 + return false; 958 958 switch (resp->status) { 959 959 case nfs_ok: 960 960 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh)) 961 - return 0; 961 + return false; 962 962 if (xdr_stream_encode_u32(xdr, resp->count) < 0) 963 - return 0; 963 + return false; 964 964 if (xdr_stream_encode_u32(xdr, resp->committed) < 0) 965 - return 0; 965 + return false; 966 966 if (!svcxdr_encode_writeverf3(xdr, resp->verf)) 967 - return 0; 967 + return false; 968 968 break; 969 969 default: 970 970 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh)) 971 - return 0; 971 + return false; 972 972 } 973 973 974 - return 1; 974 + return true; 975 975 } 976 976 977 977 /* CREATE, MKDIR, SYMLINK, MKNOD */ 978 - int 978 + bool 979 979 nfs3svc_encode_createres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 980 980 { 981 981 struct nfsd3_diropres *resp = rqstp->rq_resp; 982 982 983 983 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 984 - return 0; 984 + return false; 985 985 switch (resp->status) { 986 986 case nfs_ok: 987 987 if (!svcxdr_encode_post_op_fh3(xdr, &resp->fh)) 988 - return 0; 988 + return false; 989 989 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 990 - return 0; 990 + return false; 991 991 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->dirfh)) 992 - return 0; 992 + return false; 993 993 break; 994 994 default: 995 995 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->dirfh)) 996 - return 0; 996 + return false; 997 997 } 998 998 999 - return 1; 999 + return true; 1000 1000 } 1001 1001 1002 1002 /* RENAME */ 1003 - int 1003 + bool 1004 1004 nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1005 1005 { 1006 1006 struct nfsd3_renameres *resp = rqstp->rq_resp; ··· 1011 1011 } 1012 1012 1013 1013 /* LINK */ 1014 - int 1014 + bool 1015 1015 nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1016 1016 { 1017 1017 struct nfsd3_linkres *resp = rqstp->rq_resp; ··· 1022 1022 } 1023 1023 1024 1024 /* READDIR */ 1025 - int 1025 + bool 1026 1026 nfs3svc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1027 1027 { 1028 1028 struct nfsd3_readdirres *resp = rqstp->rq_resp; 1029 1029 struct xdr_buf *dirlist = &resp->dirlist; 1030 1030 1031 1031 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 1032 - return 0; 1032 + return false; 1033 1033 switch (resp->status) { 1034 1034 case nfs_ok: 1035 1035 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 1036 - return 0; 1036 + return false; 1037 1037 if (!svcxdr_encode_cookieverf3(xdr, resp->verf)) 1038 - return 0; 1038 + return false; 1039 1039 xdr_write_pages(xdr, dirlist->pages, 0, dirlist->len); 1040 1040 /* no more entries */ 1041 1041 if (xdr_stream_encode_item_absent(xdr) < 0) 1042 - return 0; 1042 + return false; 1043 1043 if (xdr_stream_encode_bool(xdr, resp->common.err == nfserr_eof) < 0) 1044 - return 0; 1044 + return false; 1045 1045 break; 1046 1046 default: 1047 1047 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 1048 - return 0; 1048 + return false; 1049 1049 } 1050 1050 1051 - return 1; 1051 + return true; 1052 1052 } 1053 1053 1054 1054 static __be32 ··· 1275 1275 } 1276 1276 1277 1277 /* FSSTAT */ 1278 - int 1278 + bool 1279 1279 nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1280 1280 { 1281 1281 struct nfsd3_fsstatres *resp = rqstp->rq_resp; 1282 1282 1283 1283 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 1284 - return 0; 1284 + return false; 1285 1285 switch (resp->status) { 1286 1286 case nfs_ok: 1287 1287 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1288 - return 0; 1288 + return false; 1289 1289 if (!svcxdr_encode_fsstat3resok(xdr, resp)) 1290 - return 0; 1290 + return false; 1291 1291 break; 1292 1292 default: 1293 1293 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1294 - return 0; 1294 + return false; 1295 1295 } 1296 1296 1297 - return 1; 1297 + return true; 1298 1298 } 1299 1299 1300 1300 static bool ··· 1321 1321 } 1322 1322 1323 1323 /* FSINFO */ 1324 - int 1324 + bool 1325 1325 nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1326 1326 { 1327 1327 struct nfsd3_fsinfores *resp = rqstp->rq_resp; 1328 1328 1329 1329 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 1330 - return 0; 1330 + return false; 1331 1331 switch (resp->status) { 1332 1332 case nfs_ok: 1333 1333 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1334 - return 0; 1334 + return false; 1335 1335 if (!svcxdr_encode_fsinfo3resok(xdr, resp)) 1336 - return 0; 1336 + return false; 1337 1337 break; 1338 1338 default: 1339 1339 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1340 - return 0; 1340 + return false; 1341 1341 } 1342 1342 1343 - return 1; 1343 + return true; 1344 1344 } 1345 1345 1346 1346 static bool ··· 1363 1363 } 1364 1364 1365 1365 /* PATHCONF */ 1366 - int 1366 + bool 1367 1367 nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1368 1368 { 1369 1369 struct nfsd3_pathconfres *resp = rqstp->rq_resp; 1370 1370 1371 1371 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 1372 - return 0; 1372 + return false; 1373 1373 switch (resp->status) { 1374 1374 case nfs_ok: 1375 1375 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1376 - return 0; 1376 + return false; 1377 1377 if (!svcxdr_encode_pathconf3resok(xdr, resp)) 1378 - return 0; 1378 + return false; 1379 1379 break; 1380 1380 default: 1381 1381 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1382 - return 0; 1382 + return false; 1383 1383 } 1384 1384 1385 - return 1; 1385 + return true; 1386 1386 } 1387 1387 1388 1388 /* COMMIT */ 1389 - int 1389 + bool 1390 1390 nfs3svc_encode_commitres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1391 1391 { 1392 1392 struct nfsd3_commitres *resp = rqstp->rq_resp; 1393 1393 1394 1394 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 1395 - return 0; 1395 + return false; 1396 1396 switch (resp->status) { 1397 1397 case nfs_ok: 1398 1398 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh)) 1399 - return 0; 1399 + return false; 1400 1400 if (!svcxdr_encode_writeverf3(xdr, resp->verf)) 1401 - return 0; 1401 + return false; 1402 1402 break; 1403 1403 default: 1404 1404 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh)) 1405 - return 0; 1405 + return false; 1406 1406 } 1407 1407 1408 - return 1; 1408 + return true; 1409 1409 } 1410 1410 1411 1411 /*
+2 -2
fs/nfsd/nfs4xdr.c
··· 5426 5426 return nfsd4_decode_compound(args); 5427 5427 } 5428 5428 5429 - int 5429 + bool 5430 5430 nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 5431 5431 { 5432 5432 struct nfsd4_compoundres *resp = rqstp->rq_resp; ··· 5452 5452 *p++ = htonl(resp->opcnt); 5453 5453 5454 5454 nfsd4_sequence_done(resp); 5455 - return 1; 5455 + return true; 5456 5456 }
+1 -1
fs/nfsd/nfsd.h
··· 80 80 struct nfsd_voidres { }; 81 81 bool nfssvc_decode_voidarg(struct svc_rqst *rqstp, 82 82 struct xdr_stream *xdr); 83 - int nfssvc_encode_voidres(struct svc_rqst *rqstp, 83 + bool nfssvc_encode_voidres(struct svc_rqst *rqstp, 84 84 struct xdr_stream *xdr); 85 85 86 86 /*
+4 -4
fs/nfsd/nfssvc.c
··· 1078 1078 * @xdr: XDR stream into which to encode results 1079 1079 * 1080 1080 * Return values: 1081 - * %0: Local error while encoding 1082 - * %1: Encoding was successful 1081 + * %false: Local error while encoding 1082 + * %true: Encoding was successful 1083 1083 */ 1084 - int nfssvc_encode_voidres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1084 + bool nfssvc_encode_voidres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1085 1085 { 1086 - return 1; 1086 + return true; 1087 1087 } 1088 1088 1089 1089 int nfsd_pool_stats_open(struct inode *inode, struct file *file)
+30 -30
fs/nfsd/nfsxdr.c
··· 414 414 * XDR encode functions 415 415 */ 416 416 417 - int 417 + bool 418 418 nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 419 419 { 420 420 struct nfsd_stat *resp = rqstp->rq_resp; ··· 422 422 return svcxdr_encode_stat(xdr, resp->status); 423 423 } 424 424 425 - int 425 + bool 426 426 nfssvc_encode_attrstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 427 427 { 428 428 struct nfsd_attrstat *resp = rqstp->rq_resp; 429 429 430 430 if (!svcxdr_encode_stat(xdr, resp->status)) 431 - return 0; 431 + return false; 432 432 switch (resp->status) { 433 433 case nfs_ok: 434 434 if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat)) 435 - return 0; 435 + return false; 436 436 break; 437 437 } 438 438 439 - return 1; 439 + return true; 440 440 } 441 441 442 - int 442 + bool 443 443 nfssvc_encode_diropres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 444 444 { 445 445 struct nfsd_diropres *resp = rqstp->rq_resp; 446 446 447 447 if (!svcxdr_encode_stat(xdr, resp->status)) 448 - return 0; 448 + return false; 449 449 switch (resp->status) { 450 450 case nfs_ok: 451 451 if (!svcxdr_encode_fhandle(xdr, &resp->fh)) 452 - return 0; 452 + return false; 453 453 if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat)) 454 - return 0; 454 + return false; 455 455 break; 456 456 } 457 457 458 - return 1; 458 + return true; 459 459 } 460 460 461 - int 461 + bool 462 462 nfssvc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 463 463 { 464 464 struct nfsd_readlinkres *resp = rqstp->rq_resp; 465 465 struct kvec *head = rqstp->rq_res.head; 466 466 467 467 if (!svcxdr_encode_stat(xdr, resp->status)) 468 - return 0; 468 + return false; 469 469 switch (resp->status) { 470 470 case nfs_ok: 471 471 if (xdr_stream_encode_u32(xdr, resp->len) < 0) 472 - return 0; 472 + return false; 473 473 xdr_write_pages(xdr, &resp->page, 0, resp->len); 474 474 if (svc_encode_result_payload(rqstp, head->iov_len, resp->len) < 0) 475 - return 0; 475 + return false; 476 476 break; 477 477 } 478 478 479 - return 1; 479 + return true; 480 480 } 481 481 482 - int 482 + bool 483 483 nfssvc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 484 484 { 485 485 struct nfsd_readres *resp = rqstp->rq_resp; 486 486 struct kvec *head = rqstp->rq_res.head; 487 487 488 488 if (!svcxdr_encode_stat(xdr, resp->status)) 489 - return 0; 489 + return false; 490 490 switch (resp->status) { 491 491 case nfs_ok: 492 492 if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat)) 493 - return 0; 493 + return false; 494 494 if (xdr_stream_encode_u32(xdr, resp->count) < 0) 495 - return 0; 495 + return false; 496 496 xdr_write_pages(xdr, resp->pages, rqstp->rq_res.page_base, 497 497 resp->count); 498 498 if (svc_encode_result_payload(rqstp, head->iov_len, resp->count) < 0) 499 - return 0; 499 + return false; 500 500 break; 501 501 } 502 502 503 - return 1; 503 + return true; 504 504 } 505 505 506 - int 506 + bool 507 507 nfssvc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 508 508 { 509 509 struct nfsd_readdirres *resp = rqstp->rq_resp; 510 510 struct xdr_buf *dirlist = &resp->dirlist; 511 511 512 512 if (!svcxdr_encode_stat(xdr, resp->status)) 513 - return 0; 513 + return false; 514 514 switch (resp->status) { 515 515 case nfs_ok: 516 516 xdr_write_pages(xdr, dirlist->pages, 0, dirlist->len); 517 517 /* no more entries */ 518 518 if (xdr_stream_encode_item_absent(xdr) < 0) 519 - return 0; 519 + return false; 520 520 if (xdr_stream_encode_bool(xdr, resp->common.err == nfserr_eof) < 0) 521 - return 0; 521 + return false; 522 522 break; 523 523 } 524 524 525 - return 1; 525 + return true; 526 526 } 527 527 528 - int 528 + bool 529 529 nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 530 530 { 531 531 struct nfsd_statfsres *resp = rqstp->rq_resp; ··· 533 533 __be32 *p; 534 534 535 535 if (!svcxdr_encode_stat(xdr, resp->status)) 536 - return 0; 536 + return false; 537 537 switch (resp->status) { 538 538 case nfs_ok: 539 539 p = xdr_reserve_space(xdr, XDR_UNIT * 5); 540 540 if (!p) 541 - return 0; 541 + return false; 542 542 *p++ = cpu_to_be32(NFSSVC_MAXBLKSIZE_V2); 543 543 *p++ = cpu_to_be32(stat->f_bsize); 544 544 *p++ = cpu_to_be32(stat->f_blocks); ··· 547 547 break; 548 548 } 549 549 550 - return 1; 550 + return true; 551 551 } 552 552 553 553 /**
+7 -7
fs/nfsd/xdr.h
··· 152 152 bool nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 153 153 bool nfssvc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 154 154 155 - int nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 156 - int nfssvc_encode_attrstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 157 - int nfssvc_encode_diropres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 158 - int nfssvc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 159 - int nfssvc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 160 - int nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 161 - int nfssvc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 155 + bool nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 156 + bool nfssvc_encode_attrstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 157 + bool nfssvc_encode_diropres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 158 + bool nfssvc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 159 + bool nfssvc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 160 + bool nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 161 + bool nfssvc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 162 162 163 163 void nfssvc_encode_nfscookie(struct nfsd_readdirres *resp, u32 offset); 164 164 int nfssvc_encode_entry(void *data, const char *name, int namlen,
+15 -15
fs/nfsd/xdr3.h
··· 281 281 bool nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 282 282 bool nfs3svc_decode_commitargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 283 283 284 - int nfs3svc_encode_getattrres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 285 - int nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr); 286 - int nfs3svc_encode_lookupres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 287 - int nfs3svc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 288 - int nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 289 - int nfs3svc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 290 - int nfs3svc_encode_writeres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 291 - int nfs3svc_encode_createres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 292 - int nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 293 - int nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 294 - int nfs3svc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 295 - int nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 296 - int nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, struct xdr_stream *xdr); 297 - int nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 298 - int nfs3svc_encode_commitres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 284 + bool nfs3svc_encode_getattrres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 285 + bool nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr); 286 + bool nfs3svc_encode_lookupres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 287 + bool nfs3svc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 288 + bool nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 289 + bool nfs3svc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 290 + bool nfs3svc_encode_writeres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 291 + bool nfs3svc_encode_createres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 292 + bool nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 293 + bool nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 294 + bool nfs3svc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 295 + bool nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 296 + bool nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, struct xdr_stream *xdr); 297 + bool nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 298 + bool nfs3svc_encode_commitres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 299 299 300 300 void nfs3svc_release_fhandle(struct svc_rqst *); 301 301 void nfs3svc_release_fhandle2(struct svc_rqst *);
+1 -1
fs/nfsd/xdr4.h
··· 758 758 759 759 bool nfsd4_mach_creds_match(struct nfs4_client *cl, struct svc_rqst *rqstp); 760 760 bool nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 761 - int nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 761 + bool nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 762 762 __be32 nfsd4_check_resp_size(struct nfsd4_compoundres *, u32); 763 763 void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *); 764 764 void nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op);
+4 -4
include/linux/lockd/xdr.h
··· 106 106 bool nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 107 107 bool nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr); 108 108 109 - int nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 110 - int nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr); 111 - int nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); 112 - int nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 109 + bool nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 110 + bool nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr); 111 + bool nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); 112 + bool nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 113 113 114 114 #endif /* LOCKD_XDR_H */
+4 -4
include/linux/lockd/xdr4.h
··· 32 32 bool nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 33 33 bool nlm4svc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr); 34 34 35 - int nlm4svc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 36 - int nlm4svc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr); 37 - int nlm4svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); 38 - int nlm4svc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 35 + bool nlm4svc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 36 + bool nlm4svc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr); 37 + bool nlm4svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); 38 + bool nlm4svc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 39 39 40 40 extern const struct rpc_version nlm_version4; 41 41
+1 -1
include/linux/sunrpc/svc.h
··· 457 457 bool (*pc_decode)(struct svc_rqst *rqstp, 458 458 struct xdr_stream *xdr); 459 459 /* XDR encode result: */ 460 - int (*pc_encode)(struct svc_rqst *rqstp, 460 + bool (*pc_encode)(struct svc_rqst *rqstp, 461 461 struct xdr_stream *xdr); 462 462 /* XDR free result: */ 463 463 void (*pc_release)(struct svc_rqst *);