Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249126
b: refs/heads/master
c: ea50245
h: refs/heads/master
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Apr 25, 2011
1 parent 9198560 commit 6d6e921
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 74 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7b04cd089e516af8431e4d475fa51ea074108c01
refs/heads/master: ea50245ffa5cf5b5ae27ddc920c50d33cbeecb49
84 changes: 11 additions & 73 deletions trunk/drivers/staging/hv/blkvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,82 +278,20 @@ static int blkvsc_open(struct block_device *bdev, fmode_t mode)

static int blkvsc_getgeo(struct block_device *bd, struct hd_geometry *hg)
{
sector_t total_sectors = get_capacity(bd->bd_disk);
sector_t cylinder_times_heads = 0;
sector_t temp = 0;
sector_t nsect = get_capacity(bd->bd_disk);
sector_t cylinders = nsect;

int sectors_per_track = 0;
int heads = 0;
int cylinders = 0;
int rem = 0;

if (total_sectors > (65535 * 16 * 255))
total_sectors = (65535 * 16 * 255);

if (total_sectors >= (65535 * 16 * 63)) {
sectors_per_track = 255;
heads = 16;

cylinder_times_heads = total_sectors;
/* sector_div stores the quotient in cylinder_times_heads */
rem = sector_div(cylinder_times_heads, sectors_per_track);
} else {
sectors_per_track = 17;

cylinder_times_heads = total_sectors;
/* sector_div stores the quotient in cylinder_times_heads */
rem = sector_div(cylinder_times_heads, sectors_per_track);

temp = cylinder_times_heads + 1023;
/* sector_div stores the quotient in temp */
rem = sector_div(temp, 1024);

heads = temp;

if (heads < 4)
heads = 4;


if (cylinder_times_heads >= (heads * 1024) || (heads > 16)) {
sectors_per_track = 31;
heads = 16;

cylinder_times_heads = total_sectors;
/*
* sector_div stores the quotient in
* cylinder_times_heads
*/
rem = sector_div(cylinder_times_heads,
sectors_per_track);
}

if (cylinder_times_heads >= (heads * 1024)) {
sectors_per_track = 63;
heads = 16;

cylinder_times_heads = total_sectors;
/*
* sector_div stores the quotient in
* cylinder_times_heads
*/
rem = sector_div(cylinder_times_heads,
sectors_per_track);
}
}

temp = cylinder_times_heads;
/* sector_div stores the quotient in temp */
rem = sector_div(temp, heads);
cylinders = temp;

hg->heads = heads;
hg->sectors = sectors_per_track;
/*
* We are making up these values; let us keep it simple.
*/
hg->heads = 0xff;
hg->sectors = 0x3f;
sector_div(cylinders, hg->heads * hg->sectors);
hg->cylinders = cylinders;

DPRINT_INFO(BLKVSC_DRV, "CHS (%d, %d, %d)", cylinders, heads,
sectors_per_track);

if ((sector_t)(hg->cylinders + 1) * hg->heads * hg->sectors < nsect)
hg->cylinders = 0xffff;
return 0;

}


Expand Down

0 comments on commit 6d6e921

Please sign in to comment.