aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2006-10-31 01:07:05 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-31 11:06:59 -0500
commit7d314e346d6081e8013a96206e601a48528d8f60 (patch)
tree1c763245715d917fc48f0fdbc89fbeaeb7ffa59f
parent2a9d32f682b2b4928dcd4680bc99e98a3d096816 (diff)
[PATCH] uml ubd driver: var renames
Rename the ubd_dev array to ubd_devs and then call any "struct ubd" ubd_dev instead of dev, which doesn't make clear what we're treating (and no, it's not hungarian notation - not any more than calling all vm_area_struct vma or all inodes inode). Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Cc: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/um/drivers/ubd_kern.c196
1 files changed, 98 insertions, 98 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index e104f59ec519..761e3f9cac2d 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -195,14 +195,14 @@ struct ubd {
195 .cow = DEFAULT_COW, \ 195 .cow = DEFAULT_COW, \
196} 196}
197 197
198struct ubd ubd_dev[MAX_DEV] = { [ 0 ... MAX_DEV - 1 ] = DEFAULT_UBD }; 198struct ubd ubd_devs[MAX_DEV] = { [ 0 ... MAX_DEV - 1 ] = DEFAULT_UBD };
199 199
200static int ubd0_init(void) 200static int ubd0_init(void)
201{ 201{
202 struct ubd *dev = &ubd_dev[0]; 202 struct ubd *ubd_dev = &ubd_devs[0];
203 203
204 if(dev->file == NULL) 204 if(ubd_dev->file == NULL)
205 dev->file = "root_fs"; 205 ubd_dev->file = "root_fs";
206 return(0); 206 return(0);
207} 207}
208 208
@@ -290,7 +290,7 @@ static int parse_unit(char **ptr)
290 290
291static int ubd_setup_common(char *str, int *index_out) 291static int ubd_setup_common(char *str, int *index_out)
292{ 292{
293 struct ubd *dev; 293 struct ubd *ubd_dev;
294 struct openflags flags = global_openflags; 294 struct openflags flags = global_openflags;
295 char *backing_file; 295 char *backing_file;
296 int n, err, i; 296 int n, err, i;
@@ -345,8 +345,8 @@ static int ubd_setup_common(char *str, int *index_out)
345 err = 1; 345 err = 1;
346 spin_lock(&ubd_lock); 346 spin_lock(&ubd_lock);
347 347
348 dev = &ubd_dev[n]; 348 ubd_dev = &ubd_devs[n];
349 if(dev->file != NULL){ 349 if(ubd_dev->file != NULL){
350 printk(KERN_ERR "ubd_setup : device already configured\n"); 350 printk(KERN_ERR "ubd_setup : device already configured\n");
351 goto out; 351 goto out;
352 } 352 }
@@ -363,10 +363,10 @@ static int ubd_setup_common(char *str, int *index_out)
363 flags.s = 1; 363 flags.s = 1;
364 break; 364 break;
365 case 'd': 365 case 'd':
366 dev->no_cow = 1; 366 ubd_dev->no_cow = 1;
367 break; 367 break;
368 case 'c': 368 case 'c':
369 dev->shared = 1; 369 ubd_dev->shared = 1;
370 break; 370 break;
371 case '=': 371 case '=':
372 str++; 372 str++;
@@ -393,7 +393,7 @@ break_loop:
393 } 393 }
394 394
395 if(backing_file){ 395 if(backing_file){
396 if(dev->no_cow) 396 if(ubd_dev->no_cow)
397 printk(KERN_ERR "Can't specify both 'd' and a " 397 printk(KERN_ERR "Can't specify both 'd' and a "
398 "cow file\n"); 398 "cow file\n");
399 else { 399 else {
@@ -401,9 +401,9 @@ break_loop:
401 backing_file++; 401 backing_file++;
402 } 402 }
403 } 403 }
404 dev->file = str; 404 ubd_dev->file = str;
405 dev->cow.file = backing_file; 405 ubd_dev->cow.file = backing_file;
406 dev->boot_openflags = flags; 406 ubd_dev->boot_openflags = flags;
407out: 407out:
408 spin_unlock(&ubd_lock); 408 spin_unlock(&ubd_lock);
409 return(err); 409 return(err);
@@ -544,83 +544,83 @@ void kill_io_thread(void)
544 544
545__uml_exitcall(kill_io_thread); 545__uml_exitcall(kill_io_thread);
546 546
547static int ubd_file_size(struct ubd *dev, __u64 *size_out) 547static int ubd_file_size(struct ubd *ubd_dev, __u64 *size_out)
548{ 548{
549 char *file; 549 char *file;
550 550
551 file = dev->cow.file ? dev->cow.file : dev->file; 551 file = ubd_dev->cow.file ? ubd_dev->cow.file : ubd_dev->file;
552 return(os_file_size(file, size_out)); 552 return(os_file_size(file, size_out));
553} 553}
554 554
555static void ubd_close(struct ubd *dev) 555static void ubd_close(struct ubd *ubd_dev)
556{ 556{
557 os_close_file(dev->fd); 557 os_close_file(ubd_dev->fd);
558 if(dev->cow.file == NULL) 558 if(ubd_dev->cow.file == NULL)
559 return; 559 return;
560 560
561 os_close_file(dev->cow.fd); 561 os_close_file(ubd_dev->cow.fd);
562 vfree(dev->cow.bitmap); 562 vfree(ubd_dev->cow.bitmap);
563 dev->cow.bitmap = NULL; 563 ubd_dev->cow.bitmap = NULL;
564} 564}
565 565
566static int ubd_open_dev(struct ubd *dev) 566static int ubd_open_dev(struct ubd *ubd_dev)
567{ 567{
568 struct openflags flags; 568 struct openflags flags;
569 char **back_ptr; 569 char **back_ptr;
570 int err, create_cow, *create_ptr; 570 int err, create_cow, *create_ptr;
571 571
572 dev->openflags = dev->boot_openflags; 572 ubd_dev->openflags = ubd_dev->boot_openflags;
573 create_cow = 0; 573 create_cow = 0;
574 create_ptr = (dev->cow.file != NULL) ? &create_cow : NULL; 574 create_ptr = (ubd_dev->cow.file != NULL) ? &create_cow : NULL;
575 back_ptr = dev->no_cow ? NULL : &dev->cow.file; 575 back_ptr = ubd_dev->no_cow ? NULL : &ubd_dev->cow.file;
576 dev->fd = open_ubd_file(dev->file, &dev->openflags, dev->shared, 576 ubd_dev->fd = open_ubd_file(ubd_dev->file, &ubd_dev->openflags, ubd_dev->shared,
577 back_ptr, &dev->cow.bitmap_offset, 577 back_ptr, &ubd_dev->cow.bitmap_offset,
578 &dev->cow.bitmap_len, &dev->cow.data_offset, 578 &ubd_dev->cow.bitmap_len, &ubd_dev->cow.data_offset,
579 create_ptr); 579 create_ptr);
580 580
581 if((dev->fd == -ENOENT) && create_cow){ 581 if((ubd_dev->fd == -ENOENT) && create_cow){
582 dev->fd = create_cow_file(dev->file, dev->cow.file, 582 ubd_dev->fd = create_cow_file(ubd_dev->file, ubd_dev->cow.file,
583 dev->openflags, 1 << 9, PAGE_SIZE, 583 ubd_dev->openflags, 1 << 9, PAGE_SIZE,
584 &dev->cow.bitmap_offset, 584 &ubd_dev->cow.bitmap_offset,
585 &dev->cow.bitmap_len, 585 &ubd_dev->cow.bitmap_len,
586 &dev->cow.data_offset); 586 &ubd_dev->cow.data_offset);
587 if(dev->fd >= 0){ 587 if(ubd_dev->fd >= 0){
588 printk(KERN_INFO "Creating \"%s\" as COW file for " 588 printk(KERN_INFO "Creating \"%s\" as COW file for "
589 "\"%s\"\n", dev->file, dev->cow.file); 589 "\"%s\"\n", ubd_dev->file, ubd_dev->cow.file);
590 } 590 }
591 } 591 }
592 592
593 if(dev->fd < 0){ 593 if(ubd_dev->fd < 0){
594 printk("Failed to open '%s', errno = %d\n", dev->file, 594 printk("Failed to open '%s', errno = %d\n", ubd_dev->file,
595 -dev->fd); 595 -ubd_dev->fd);
596 return(dev->fd); 596 return(ubd_dev->fd);
597 } 597 }
598 598
599 if(dev->cow.file != NULL){ 599 if(ubd_dev->cow.file != NULL){
600 err = -ENOMEM; 600 err = -ENOMEM;
601 dev->cow.bitmap = (void *) vmalloc(dev->cow.bitmap_len); 601 ubd_dev->cow.bitmap = (void *) vmalloc(ubd_dev->cow.bitmap_len);
602 if(dev->cow.bitmap == NULL){ 602 if(ubd_dev->cow.bitmap == NULL){
603 printk(KERN_ERR "Failed to vmalloc COW bitmap\n"); 603 printk(KERN_ERR "Failed to vmalloc COW bitmap\n");
604 goto error; 604 goto error;
605 } 605 }
606 flush_tlb_kernel_vm(); 606 flush_tlb_kernel_vm();
607 607
608 err = read_cow_bitmap(dev->fd, dev->cow.bitmap, 608 err = read_cow_bitmap(ubd_dev->fd, ubd_dev->cow.bitmap,
609 dev->cow.bitmap_offset, 609 ubd_dev->cow.bitmap_offset,
610 dev->cow.bitmap_len); 610 ubd_dev->cow.bitmap_len);
611 if(err < 0) 611 if(err < 0)
612 goto error; 612 goto error;
613 613
614 flags = dev->openflags; 614 flags = ubd_dev->openflags;
615 flags.w = 0; 615 flags.w = 0;
616 err = open_ubd_file(dev->cow.file, &flags, dev->shared, NULL, 616 err = open_ubd_file(ubd_dev->cow.file, &flags, ubd_dev->shared, NULL,
617 NULL, NULL, NULL, NULL); 617 NULL, NULL, NULL, NULL);
618 if(err < 0) goto error; 618 if(err < 0) goto error;
619 dev->cow.fd = err; 619 ubd_dev->cow.fd = err;
620 } 620 }
621 return(0); 621 return(0);
622 error: 622 error:
623 os_close_file(dev->fd); 623 os_close_file(ubd_dev->fd);
624 return(err); 624 return(err);
625} 625}
626 626
@@ -645,13 +645,13 @@ static int ubd_new_disk(int major, u64 size, int unit,
645 645
646 /* sysfs register (not for ide fake devices) */ 646 /* sysfs register (not for ide fake devices) */
647 if (major == MAJOR_NR) { 647 if (major == MAJOR_NR) {
648 ubd_dev[unit].pdev.id = unit; 648 ubd_devs[unit].pdev.id = unit;
649 ubd_dev[unit].pdev.name = DRIVER_NAME; 649 ubd_devs[unit].pdev.name = DRIVER_NAME;
650 platform_device_register(&ubd_dev[unit].pdev); 650 platform_device_register(&ubd_devs[unit].pdev);
651 disk->driverfs_dev = &ubd_dev[unit].pdev.dev; 651 disk->driverfs_dev = &ubd_devs[unit].pdev.dev;
652 } 652 }
653 653
654 disk->private_data = &ubd_dev[unit]; 654 disk->private_data = &ubd_devs[unit];
655 disk->queue = ubd_queue; 655 disk->queue = ubd_queue;
656 add_disk(disk); 656 add_disk(disk);
657 657
@@ -663,25 +663,25 @@ static int ubd_new_disk(int major, u64 size, int unit,
663 663
664static int ubd_add(int n) 664static int ubd_add(int n)
665{ 665{
666 struct ubd *dev = &ubd_dev[n]; 666 struct ubd *ubd_dev = &ubd_devs[n];
667 int err; 667 int err;
668 668
669 err = -ENODEV; 669 err = -ENODEV;
670 if(dev->file == NULL) 670 if(ubd_dev->file == NULL)
671 goto out; 671 goto out;
672 672
673 err = ubd_file_size(dev, &dev->size); 673 err = ubd_file_size(ubd_dev, &ubd_dev->size);
674 if(err < 0) 674 if(err < 0)
675 goto out; 675 goto out;
676 676
677 dev->size = ROUND_BLOCK(dev->size); 677 ubd_dev->size = ROUND_BLOCK(ubd_dev->size);
678 678
679 err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]); 679 err = ubd_new_disk(MAJOR_NR, ubd_dev->size, n, &ubd_gendisk[n]);
680 if(err) 680 if(err)
681 goto out; 681 goto out;
682 682
683 if(fake_major != MAJOR_NR) 683 if(fake_major != MAJOR_NR)
684 ubd_new_disk(fake_major, dev->size, n, 684 ubd_new_disk(fake_major, ubd_dev->size, n,
685 &fake_gendisk[n]); 685 &fake_gendisk[n]);
686 686
687 /* perhaps this should also be under the "if (fake_major)" above */ 687 /* perhaps this should also be under the "if (fake_major)" above */
@@ -713,7 +713,7 @@ static int ubd_config(char *str)
713 spin_lock(&ubd_lock); 713 spin_lock(&ubd_lock);
714 err = ubd_add(n); 714 err = ubd_add(n);
715 if(err) 715 if(err)
716 ubd_dev[n].file = NULL; 716 ubd_devs[n].file = NULL;
717 spin_unlock(&ubd_lock); 717 spin_unlock(&ubd_lock);
718 718
719 return(err); 719 return(err);
@@ -721,7 +721,7 @@ static int ubd_config(char *str)
721 721
722static int ubd_get_config(char *name, char *str, int size, char **error_out) 722static int ubd_get_config(char *name, char *str, int size, char **error_out)
723{ 723{
724 struct ubd *dev; 724 struct ubd *ubd_dev;
725 int n, len = 0; 725 int n, len = 0;
726 726
727 n = parse_unit(&name); 727 n = parse_unit(&name);
@@ -730,19 +730,19 @@ static int ubd_get_config(char *name, char *str, int size, char **error_out)
730 return(-1); 730 return(-1);
731 } 731 }
732 732
733 dev = &ubd_dev[n]; 733 ubd_dev = &ubd_devs[n];
734 spin_lock(&ubd_lock); 734 spin_lock(&ubd_lock);
735 735
736 if(dev->file == NULL){ 736 if(ubd_dev->file == NULL){
737 CONFIG_CHUNK(str, size, len, "", 1); 737 CONFIG_CHUNK(str, size, len, "", 1);
738 goto out; 738 goto out;
739 } 739 }
740 740
741 CONFIG_CHUNK(str, size, len, dev->file, 0); 741 CONFIG_CHUNK(str, size, len, ubd_dev->file, 0);
742 742
743 if(dev->cow.file != NULL){ 743 if(ubd_dev->cow.file != NULL){
744 CONFIG_CHUNK(str, size, len, ",", 0); 744 CONFIG_CHUNK(str, size, len, ",", 0);
745 CONFIG_CHUNK(str, size, len, dev->cow.file, 1); 745 CONFIG_CHUNK(str, size, len, ubd_dev->cow.file, 1);
746 } 746 }
747 else CONFIG_CHUNK(str, size, len, "", 1); 747 else CONFIG_CHUNK(str, size, len, "", 1);
748 748
@@ -763,7 +763,7 @@ static int ubd_id(char **str, int *start_out, int *end_out)
763 763
764static int ubd_remove(int n) 764static int ubd_remove(int n)
765{ 765{
766 struct ubd *dev; 766 struct ubd *ubd_dev;
767 int err = -ENODEV; 767 int err = -ENODEV;
768 768
769 spin_lock(&ubd_lock); 769 spin_lock(&ubd_lock);
@@ -771,14 +771,14 @@ static int ubd_remove(int n)
771 if(ubd_gendisk[n] == NULL) 771 if(ubd_gendisk[n] == NULL)
772 goto out; 772 goto out;
773 773
774 dev = &ubd_dev[n]; 774 ubd_dev = &ubd_devs[n];
775 775
776 if(dev->file == NULL) 776 if(ubd_dev->file == NULL)
777 goto out; 777 goto out;
778 778
779 /* you cannot remove a open disk */ 779 /* you cannot remove a open disk */
780 err = -EBUSY; 780 err = -EBUSY;
781 if(dev->count > 0) 781 if(ubd_dev->count > 0)
782 goto out; 782 goto out;
783 783
784 del_gendisk(ubd_gendisk[n]); 784 del_gendisk(ubd_gendisk[n]);
@@ -791,8 +791,8 @@ static int ubd_remove(int n)
791 fake_gendisk[n] = NULL; 791 fake_gendisk[n] = NULL;
792 } 792 }
793 793
794 platform_device_unregister(&dev->pdev); 794 platform_device_unregister(&ubd_dev->pdev);
795 *dev = ((struct ubd) DEFAULT_UBD); 795 *ubd_dev = ((struct ubd) DEFAULT_UBD);
796 err = 0; 796 err = 0;
797out: 797out:
798 spin_unlock(&ubd_lock); 798 spin_unlock(&ubd_lock);
@@ -870,7 +870,7 @@ int ubd_driver_init(void){
870 return(0); 870 return(0);
871 } 871 }
872 err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr, 872 err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr,
873 IRQF_DISABLED, "ubd", ubd_dev); 873 IRQF_DISABLED, "ubd", ubd_devs);
874 if(err != 0) 874 if(err != 0)
875 printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err); 875 printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err);
876 return 0; 876 return 0;
@@ -881,24 +881,24 @@ device_initcall(ubd_driver_init);
881static int ubd_open(struct inode *inode, struct file *filp) 881static int ubd_open(struct inode *inode, struct file *filp)
882{ 882{
883 struct gendisk *disk = inode->i_bdev->bd_disk; 883 struct gendisk *disk = inode->i_bdev->bd_disk;
884 struct ubd *dev = disk->private_data; 884 struct ubd *ubd_dev = disk->private_data;
885 int err = 0; 885 int err = 0;
886 886
887 if(dev->count == 0){ 887 if(ubd_dev->count == 0){
888 err = ubd_open_dev(dev); 888 err = ubd_open_dev(ubd_dev);
889 if(err){ 889 if(err){
890 printk(KERN_ERR "%s: Can't open \"%s\": errno = %d\n", 890 printk(KERN_ERR "%s: Can't open \"%s\": errno = %d\n",
891 disk->disk_name, dev->file, -err); 891 disk->disk_name, ubd_dev->file, -err);
892 goto out; 892 goto out;
893 } 893 }
894 } 894 }
895 dev->count++; 895 ubd_dev->count++;
896 set_disk_ro(disk, !dev->openflags.w); 896 set_disk_ro(disk, !ubd_dev->openflags.w);
897 897
898 /* This should no more be needed. And it didn't work anyway to exclude 898 /* This should no more be needed. And it didn't work anyway to exclude
899 * read-write remounting of filesystems.*/ 899 * read-write remounting of filesystems.*/
900 /*if((filp->f_mode & FMODE_WRITE) && !dev->openflags.w){ 900 /*if((filp->f_mode & FMODE_WRITE) && !ubd_dev->openflags.w){
901 if(--dev->count == 0) ubd_close(dev); 901 if(--ubd_dev->count == 0) ubd_close(ubd_dev);
902 err = -EROFS; 902 err = -EROFS;
903 }*/ 903 }*/
904 out: 904 out:
@@ -908,10 +908,10 @@ static int ubd_open(struct inode *inode, struct file *filp)
908static int ubd_release(struct inode * inode, struct file * file) 908static int ubd_release(struct inode * inode, struct file * file)
909{ 909{
910 struct gendisk *disk = inode->i_bdev->bd_disk; 910 struct gendisk *disk = inode->i_bdev->bd_disk;
911 struct ubd *dev = disk->private_data; 911 struct ubd *ubd_dev = disk->private_data;
912 912
913 if(--dev->count == 0) 913 if(--ubd_dev->count == 0)
914 ubd_close(dev); 914 ubd_close(ubd_dev);
915 return(0); 915 return(0);
916} 916}
917 917
@@ -979,12 +979,12 @@ static void cowify_req(struct io_thread_req *req, unsigned long *bitmap,
979static int prepare_request(struct request *req, struct io_thread_req *io_req) 979static int prepare_request(struct request *req, struct io_thread_req *io_req)
980{ 980{
981 struct gendisk *disk = req->rq_disk; 981 struct gendisk *disk = req->rq_disk;
982 struct ubd *dev = disk->private_data; 982 struct ubd *ubd_dev = disk->private_data;
983 __u64 offset; 983 __u64 offset;
984 int len; 984 int len;
985 985
986 /* This should be impossible now */ 986 /* This should be impossible now */
987 if((rq_data_dir(req) == WRITE) && !dev->openflags.w){ 987 if((rq_data_dir(req) == WRITE) && !ubd_dev->openflags.w){
988 printk("Write attempted on readonly ubd device %s\n", 988 printk("Write attempted on readonly ubd device %s\n",
989 disk->disk_name); 989 disk->disk_name);
990 end_request(req, 0); 990 end_request(req, 0);
@@ -994,8 +994,8 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req)
994 offset = ((__u64) req->sector) << 9; 994 offset = ((__u64) req->sector) << 9;
995 len = req->current_nr_sectors << 9; 995 len = req->current_nr_sectors << 9;
996 996
997 io_req->fds[0] = (dev->cow.file != NULL) ? dev->cow.fd : dev->fd; 997 io_req->fds[0] = (ubd_dev->cow.file != NULL) ? ubd_dev->cow.fd : ubd_dev->fd;
998 io_req->fds[1] = dev->fd; 998 io_req->fds[1] = ubd_dev->fd;
999 io_req->cow_offset = -1; 999 io_req->cow_offset = -1;
1000 io_req->offset = offset; 1000 io_req->offset = offset;
1001 io_req->length = len; 1001 io_req->length = len;
@@ -1004,13 +1004,13 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req)
1004 1004
1005 io_req->op = (rq_data_dir(req) == READ) ? UBD_READ : UBD_WRITE; 1005 io_req->op = (rq_data_dir(req) == READ) ? UBD_READ : UBD_WRITE;
1006 io_req->offsets[0] = 0; 1006 io_req->offsets[0] = 0;
1007 io_req->offsets[1] = dev->cow.data_offset; 1007 io_req->offsets[1] = ubd_dev->cow.data_offset;
1008 io_req->buffer = req->buffer; 1008 io_req->buffer = req->buffer;
1009 io_req->sectorsize = 1 << 9; 1009 io_req->sectorsize = 1 << 9;
1010 1010
1011 if(dev->cow.file != NULL) 1011 if(ubd_dev->cow.file != NULL)
1012 cowify_req(io_req, dev->cow.bitmap, dev->cow.bitmap_offset, 1012 cowify_req(io_req, ubd_dev->cow.bitmap, ubd_dev->cow.bitmap_offset,
1013 dev->cow.bitmap_len); 1013 ubd_dev->cow.bitmap_len);
1014 1014
1015 return(0); 1015 return(0);
1016} 1016}
@@ -1048,18 +1048,18 @@ static void do_ubd_request(request_queue_t *q)
1048 1048
1049static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo) 1049static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
1050{ 1050{
1051 struct ubd *dev = bdev->bd_disk->private_data; 1051 struct ubd *ubd_dev = bdev->bd_disk->private_data;
1052 1052
1053 geo->heads = 128; 1053 geo->heads = 128;
1054 geo->sectors = 32; 1054 geo->sectors = 32;
1055 geo->cylinders = dev->size / (128 * 32 * 512); 1055 geo->cylinders = ubd_dev->size / (128 * 32 * 512);
1056 return 0; 1056 return 0;
1057} 1057}
1058 1058
1059static int ubd_ioctl(struct inode * inode, struct file * file, 1059static int ubd_ioctl(struct inode * inode, struct file * file,
1060 unsigned int cmd, unsigned long arg) 1060 unsigned int cmd, unsigned long arg)
1061{ 1061{
1062 struct ubd *dev = inode->i_bdev->bd_disk->private_data; 1062 struct ubd *ubd_dev = inode->i_bdev->bd_disk->private_data;
1063 struct hd_driveid ubd_id = { 1063 struct hd_driveid ubd_id = {
1064 .cyls = 0, 1064 .cyls = 0,
1065 .heads = 128, 1065 .heads = 128,
@@ -1069,7 +1069,7 @@ static int ubd_ioctl(struct inode * inode, struct file * file,
1069 switch (cmd) { 1069 switch (cmd) {
1070 struct cdrom_volctrl volume; 1070 struct cdrom_volctrl volume;
1071 case HDIO_GET_IDENTITY: 1071 case HDIO_GET_IDENTITY:
1072 ubd_id.cyls = dev->size / (128 * 32 * 512); 1072 ubd_id.cyls = ubd_dev->size / (128 * 32 * 512);
1073 if(copy_to_user((char __user *) arg, (char *) &ubd_id, 1073 if(copy_to_user((char __user *) arg, (char *) &ubd_id,
1074 sizeof(ubd_id))) 1074 sizeof(ubd_id)))
1075 return(-EFAULT); 1075 return(-EFAULT);