diff options
-rw-r--r-- | fs/nfs/client.c | 54 |
1 files changed, 6 insertions, 48 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index ccb455053ee4..a49f9feff776 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -1206,23 +1206,9 @@ static int nfs_server_list_open(struct inode *inode, struct file *file) | |||
1206 | */ | 1206 | */ |
1207 | static void *nfs_server_list_start(struct seq_file *m, loff_t *_pos) | 1207 | static void *nfs_server_list_start(struct seq_file *m, loff_t *_pos) |
1208 | { | 1208 | { |
1209 | struct list_head *_p; | ||
1210 | loff_t pos = *_pos; | ||
1211 | |||
1212 | /* lock the list against modification */ | 1209 | /* lock the list against modification */ |
1213 | spin_lock(&nfs_client_lock); | 1210 | spin_lock(&nfs_client_lock); |
1214 | 1211 | return seq_list_start_head(&nfs_client_list, *_pos); | |
1215 | /* allow for the header line */ | ||
1216 | if (!pos) | ||
1217 | return SEQ_START_TOKEN; | ||
1218 | pos--; | ||
1219 | |||
1220 | /* find the n'th element in the list */ | ||
1221 | list_for_each(_p, &nfs_client_list) | ||
1222 | if (!pos--) | ||
1223 | break; | ||
1224 | |||
1225 | return _p != &nfs_client_list ? _p : NULL; | ||
1226 | } | 1212 | } |
1227 | 1213 | ||
1228 | /* | 1214 | /* |
@@ -1230,14 +1216,7 @@ static void *nfs_server_list_start(struct seq_file *m, loff_t *_pos) | |||
1230 | */ | 1216 | */ |
1231 | static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos) | 1217 | static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos) |
1232 | { | 1218 | { |
1233 | struct list_head *_p; | 1219 | return seq_list_next(v, &nfs_client_list, pos); |
1234 | |||
1235 | (*pos)++; | ||
1236 | |||
1237 | _p = v; | ||
1238 | _p = (v == SEQ_START_TOKEN) ? nfs_client_list.next : _p->next; | ||
1239 | |||
1240 | return _p != &nfs_client_list ? _p : NULL; | ||
1241 | } | 1220 | } |
1242 | 1221 | ||
1243 | /* | 1222 | /* |
@@ -1256,7 +1235,7 @@ static int nfs_server_list_show(struct seq_file *m, void *v) | |||
1256 | struct nfs_client *clp; | 1235 | struct nfs_client *clp; |
1257 | 1236 | ||
1258 | /* display header on line 1 */ | 1237 | /* display header on line 1 */ |
1259 | if (v == SEQ_START_TOKEN) { | 1238 | if (v == &nfs_client_list) { |
1260 | seq_puts(m, "NV SERVER PORT USE HOSTNAME\n"); | 1239 | seq_puts(m, "NV SERVER PORT USE HOSTNAME\n"); |
1261 | return 0; | 1240 | return 0; |
1262 | } | 1241 | } |
@@ -1297,23 +1276,9 @@ static int nfs_volume_list_open(struct inode *inode, struct file *file) | |||
1297 | */ | 1276 | */ |
1298 | static void *nfs_volume_list_start(struct seq_file *m, loff_t *_pos) | 1277 | static void *nfs_volume_list_start(struct seq_file *m, loff_t *_pos) |
1299 | { | 1278 | { |
1300 | struct list_head *_p; | ||
1301 | loff_t pos = *_pos; | ||
1302 | |||
1303 | /* lock the list against modification */ | 1279 | /* lock the list against modification */ |
1304 | spin_lock(&nfs_client_lock); | 1280 | spin_lock(&nfs_client_lock); |
1305 | 1281 | return seq_list_start_head(&nfs_volume_list, *_pos); | |
1306 | /* allow for the header line */ | ||
1307 | if (!pos) | ||
1308 | return SEQ_START_TOKEN; | ||
1309 | pos--; | ||
1310 | |||
1311 | /* find the n'th element in the list */ | ||
1312 | list_for_each(_p, &nfs_volume_list) | ||
1313 | if (!pos--) | ||
1314 | break; | ||
1315 | |||
1316 | return _p != &nfs_volume_list ? _p : NULL; | ||
1317 | } | 1282 | } |
1318 | 1283 | ||
1319 | /* | 1284 | /* |
@@ -1321,14 +1286,7 @@ static void *nfs_volume_list_start(struct seq_file *m, loff_t *_pos) | |||
1321 | */ | 1286 | */ |
1322 | static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos) | 1287 | static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos) |
1323 | { | 1288 | { |
1324 | struct list_head *_p; | 1289 | return seq_list_next(v, &nfs_volume_list, pos); |
1325 | |||
1326 | (*pos)++; | ||
1327 | |||
1328 | _p = v; | ||
1329 | _p = (v == SEQ_START_TOKEN) ? nfs_volume_list.next : _p->next; | ||
1330 | |||
1331 | return _p != &nfs_volume_list ? _p : NULL; | ||
1332 | } | 1290 | } |
1333 | 1291 | ||
1334 | /* | 1292 | /* |
@@ -1349,7 +1307,7 @@ static int nfs_volume_list_show(struct seq_file *m, void *v) | |||
1349 | char dev[8], fsid[17]; | 1307 | char dev[8], fsid[17]; |
1350 | 1308 | ||
1351 | /* display header on line 1 */ | 1309 | /* display header on line 1 */ |
1352 | if (v == SEQ_START_TOKEN) { | 1310 | if (v == &nfs_volume_list) { |
1353 | seq_puts(m, "NV SERVER PORT DEV FSID\n"); | 1311 | seq_puts(m, "NV SERVER PORT DEV FSID\n"); |
1354 | return 0; | 1312 | return 0; |
1355 | } | 1313 | } |