History

fs: fix kernel_read prototype

Use proper ssize_t and size_t types for the return value and count argument, move the offset last and make it an in/out argument like all other read/write helpers, and make the buf argument a void pointer to get rid of lots of casts in the callers.

Christoph Hellwig committed 9 years ago

Commit bdd1d2d1 parent c41fbad17 files · +69 −71Browse files

Showing the changes to kernel/sysctl_binary.c (1 of 17 files). Show all

Unified · Split

kernel/sysctl_binary.c+8−4
@@ -986,8 +986,9 @@ static ssize_t bin_intvec(struct file *file, · 985 unmodified lines
986986 size_t length = oldlen / sizeof(*vec);
987987 char *str, *end;
988988 int i;
989+ loff_t pos = 0;
989990
990− result = kernel_read(file, 0, buffer, BUFSZ - 1);
991+ result = kernel_read(file, buffer, BUFSZ - 1, &pos);
991992 if (result < 0)
992993 goto out_kfree;
993994
@@ -1057,8 +1058,9 @@ static ssize_t bin_ulongvec(struct file *file, · 63 unmodified lines
10571058 size_t length = oldlen / sizeof(*vec);
10581059 char *str, *end;
10591060 int i;
1061+ loff_t pos = 0;
10601062
1061− result = kernel_read(file, 0, buffer, BUFSZ - 1);
1063+ result = kernel_read(file, buffer, BUFSZ - 1, &pos);
10621064 if (result < 0)
10631065 goto out_kfree;
10641066
@@ -1120,8 +1122,9 @@ static ssize_t bin_uuid(struct file *file, · 55 unmodified lines
11201122 if (oldval && oldlen) {
11211123 char buf[UUID_STRING_LEN + 1];
11221124 uuid_t uuid;
1125+ loff_t pos = 0;
11231126
1124− result = kernel_read(file, 0, buf, sizeof(buf) - 1);
1127+ result = kernel_read(file, buf, sizeof(buf) - 1, &pos);
11251128 if (result < 0)
11261129 goto out;
11271130
@@ -1154,8 +1157,9 @@ static ssize_t bin_dn_node_address(struct file *file, · 26 unmodified lines
11541157 char buf[15], *nodep;
11551158 unsigned long area, node;
11561159 __le16 dnaddr;
1160+ loff_t pos = 0;
11571161
1158− result = kernel_read(file, 0, buf, sizeof(buf) - 1);
1162+ result = kernel_read(file, buf, sizeof(buf) - 1, &pos);
11591163 if (result < 0)
11601164 goto out;
11611165