aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2009-01-06 17:42:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 18:59:23 -0500
commit730c9eeca9808fc2cfb506cc68c90aa330da17b0 (patch)
tree95de85ecf2ee6c071af151ba4e33f1017868a776 /fs
parentf70f582f0072f37790d2984647198deb3e7782a3 (diff)
autofs4: improve parameter usage
The parameter usage in the device node ioctl code uses arg1 and arg2 as parameter names. This patch redefines the parameter names to reflect what they actually are in an effort to make the code more readable. Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/autofs4/dev-ioctl.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
index 63b7c7afe8df..054d6d9ad9ba 100644
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -180,7 +180,7 @@ static int autofs_dev_ioctl_protover(struct file *fp,
180 struct autofs_sb_info *sbi, 180 struct autofs_sb_info *sbi,
181 struct autofs_dev_ioctl *param) 181 struct autofs_dev_ioctl *param)
182{ 182{
183 param->arg1 = sbi->version; 183 param->protover.version = sbi->version;
184 return 0; 184 return 0;
185} 185}
186 186
@@ -189,7 +189,7 @@ static int autofs_dev_ioctl_protosubver(struct file *fp,
189 struct autofs_sb_info *sbi, 189 struct autofs_sb_info *sbi,
190 struct autofs_dev_ioctl *param) 190 struct autofs_dev_ioctl *param)
191{ 191{
192 param->arg1 = sbi->sub_version; 192 param->protosubver.sub_version = sbi->sub_version;
193 return 0; 193 return 0;
194} 194}
195 195
@@ -335,13 +335,13 @@ static int autofs_dev_ioctl_openmount(struct file *fp,
335 int err, fd; 335 int err, fd;
336 336
337 /* param->path has already been checked */ 337 /* param->path has already been checked */
338 if (!param->arg1) 338 if (!param->openmount.devid)
339 return -EINVAL; 339 return -EINVAL;
340 340
341 param->ioctlfd = -1; 341 param->ioctlfd = -1;
342 342
343 path = param->path; 343 path = param->path;
344 devid = param->arg1; 344 devid = param->openmount.devid;
345 345
346 err = 0; 346 err = 0;
347 fd = autofs_dev_ioctl_open_mountpoint(path, devid); 347 fd = autofs_dev_ioctl_open_mountpoint(path, devid);
@@ -373,7 +373,7 @@ static int autofs_dev_ioctl_ready(struct file *fp,
373{ 373{
374 autofs_wqt_t token; 374 autofs_wqt_t token;
375 375
376 token = (autofs_wqt_t) param->arg1; 376 token = (autofs_wqt_t) param->ready.token;
377 return autofs4_wait_release(sbi, token, 0); 377 return autofs4_wait_release(sbi, token, 0);
378} 378}
379 379
@@ -388,8 +388,8 @@ static int autofs_dev_ioctl_fail(struct file *fp,
388 autofs_wqt_t token; 388 autofs_wqt_t token;
389 int status; 389 int status;
390 390
391 token = (autofs_wqt_t) param->arg1; 391 token = (autofs_wqt_t) param->fail.token;
392 status = param->arg2 ? param->arg2 : -ENOENT; 392 status = param->fail.status ? param->fail.status : -ENOENT;
393 return autofs4_wait_release(sbi, token, status); 393 return autofs4_wait_release(sbi, token, status);
394} 394}
395 395
@@ -412,10 +412,10 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
412 int pipefd; 412 int pipefd;
413 int err = 0; 413 int err = 0;
414 414
415 if (param->arg1 == -1) 415 if (param->setpipefd.pipefd == -1)
416 return -EINVAL; 416 return -EINVAL;
417 417
418 pipefd = param->arg1; 418 pipefd = param->setpipefd.pipefd;
419 419
420 mutex_lock(&sbi->wq_mutex); 420 mutex_lock(&sbi->wq_mutex);
421 if (!sbi->catatonic) { 421 if (!sbi->catatonic) {
@@ -457,8 +457,8 @@ static int autofs_dev_ioctl_timeout(struct file *fp,
457{ 457{
458 unsigned long timeout; 458 unsigned long timeout;
459 459
460 timeout = param->arg1; 460 timeout = param->timeout.timeout;
461 param->arg1 = sbi->exp_timeout / HZ; 461 param->timeout.timeout = sbi->exp_timeout / HZ;
462 sbi->exp_timeout = timeout * HZ; 462 sbi->exp_timeout = timeout * HZ;
463 return 0; 463 return 0;
464} 464}
@@ -489,7 +489,7 @@ static int autofs_dev_ioctl_requester(struct file *fp,
489 path = param->path; 489 path = param->path;
490 devid = sbi->sb->s_dev; 490 devid = sbi->sb->s_dev;
491 491
492 param->arg1 = param->arg2 = -1; 492 param->requester.uid = param->requester.gid = -1;
493 493
494 /* Get nameidata of the parent directory */ 494 /* Get nameidata of the parent directory */
495 err = path_lookup(path, LOOKUP_PARENT, &nd); 495 err = path_lookup(path, LOOKUP_PARENT, &nd);
@@ -505,8 +505,8 @@ static int autofs_dev_ioctl_requester(struct file *fp,
505 err = 0; 505 err = 0;
506 autofs4_expire_wait(nd.path.dentry); 506 autofs4_expire_wait(nd.path.dentry);
507 spin_lock(&sbi->fs_lock); 507 spin_lock(&sbi->fs_lock);
508 param->arg1 = ino->uid; 508 param->requester.uid = ino->uid;
509 param->arg2 = ino->gid; 509 param->requester.gid = ino->gid;
510 spin_unlock(&sbi->fs_lock); 510 spin_unlock(&sbi->fs_lock);
511 } 511 }
512 512
@@ -529,7 +529,7 @@ static int autofs_dev_ioctl_expire(struct file *fp,
529 int err = -EAGAIN; 529 int err = -EAGAIN;
530 int how; 530 int how;
531 531
532 how = param->arg1; 532 how = param->expire.how;
533 mnt = fp->f_path.mnt; 533 mnt = fp->f_path.mnt;
534 534
535 if (sbi->type & AUTOFS_TYPE_TRIGGER) 535 if (sbi->type & AUTOFS_TYPE_TRIGGER)
@@ -565,9 +565,9 @@ static int autofs_dev_ioctl_askumount(struct file *fp,
565 struct autofs_sb_info *sbi, 565 struct autofs_sb_info *sbi,
566 struct autofs_dev_ioctl *param) 566 struct autofs_dev_ioctl *param)
567{ 567{
568 param->arg1 = 0; 568 param->askumount.may_umount = 0;
569 if (may_umount(fp->f_path.mnt)) 569 if (may_umount(fp->f_path.mnt))
570 param->arg1 = 1; 570 param->askumount.may_umount = 1;
571 return 0; 571 return 0;
572} 572}
573 573
@@ -600,6 +600,7 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
600 struct nameidata nd; 600 struct nameidata nd;
601 const char *path; 601 const char *path;
602 unsigned int type; 602 unsigned int type;
603 unsigned int devid, magic;
603 int err = -ENOENT; 604 int err = -ENOENT;
604 605
605 if (param->size <= sizeof(*param)) { 606 if (param->size <= sizeof(*param)) {
@@ -608,10 +609,10 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
608 } 609 }
609 610
610 path = param->path; 611 path = param->path;
611 type = param->arg1; 612 type = param->ismountpoint.in.type;
612 613
613 param->arg1 = 0; 614 param->ismountpoint.out.devid = devid = 0;
614 param->arg2 = 0; 615 param->ismountpoint.out.magic = magic = 0;
615 616
616 if (!fp || param->ioctlfd == -1) { 617 if (!fp || param->ioctlfd == -1) {
617 if (type == AUTOFS_TYPE_ANY) { 618 if (type == AUTOFS_TYPE_ANY) {
@@ -622,7 +623,7 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
622 goto out; 623 goto out;
623 624
624 sb = nd.path.dentry->d_sb; 625 sb = nd.path.dentry->d_sb;
625 param->arg1 = new_encode_dev(sb->s_dev); 626 devid = new_encode_dev(sb->s_dev);
626 } else { 627 } else {
627 struct autofs_info *ino; 628 struct autofs_info *ino;
628 629
@@ -635,14 +636,14 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
635 goto out_release; 636 goto out_release;
636 637
637 ino = autofs4_dentry_ino(nd.path.dentry); 638 ino = autofs4_dentry_ino(nd.path.dentry);
638 param->arg1 = autofs4_get_dev(ino->sbi); 639 devid = autofs4_get_dev(ino->sbi);
639 } 640 }
640 641
641 err = 0; 642 err = 0;
642 if (nd.path.dentry->d_inode && 643 if (nd.path.dentry->d_inode &&
643 nd.path.mnt->mnt_root == nd.path.dentry) { 644 nd.path.mnt->mnt_root == nd.path.dentry) {
644 err = 1; 645 err = 1;
645 param->arg2 = nd.path.dentry->d_inode->i_sb->s_magic; 646 magic = nd.path.dentry->d_inode->i_sb->s_magic;
646 } 647 }
647 } else { 648 } else {
648 dev_t devid = new_encode_dev(sbi->sb->s_dev); 649 dev_t devid = new_encode_dev(sbi->sb->s_dev);
@@ -655,18 +656,21 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
655 if (err) 656 if (err)
656 goto out_release; 657 goto out_release;
657 658
658 param->arg1 = autofs4_get_dev(sbi); 659 devid = autofs4_get_dev(sbi);
659 660
660 err = have_submounts(nd.path.dentry); 661 err = have_submounts(nd.path.dentry);
661 662
662 if (nd.path.mnt->mnt_mountpoint != nd.path.mnt->mnt_root) { 663 if (nd.path.mnt->mnt_mountpoint != nd.path.mnt->mnt_root) {
663 if (follow_down(&nd.path.mnt, &nd.path.dentry)) { 664 if (follow_down(&nd.path.mnt, &nd.path.dentry)) {
664 struct inode *inode = nd.path.dentry->d_inode; 665 struct inode *inode = nd.path.dentry->d_inode;
665 param->arg2 = inode->i_sb->s_magic; 666 magic = inode->i_sb->s_magic;
666 } 667 }
667 } 668 }
668 } 669 }
669 670
671 param->ismountpoint.out.devid = devid;
672 param->ismountpoint.out.magic = magic;
673
670out_release: 674out_release:
671 path_put(&nd.path); 675 path_put(&nd.path);
672out: 676out: