public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Phillip Susi <psusi@cfl.rr.com>
To: "Jeff V. Merkey" <jmerkey@wolfmountaingroup.com>
Cc: "linux-os (Dick Johnson)" <linux-os@analogic.com>,
	Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: C/H/S from user space
Date: Fri, 17 Feb 2006 14:59:25 -0500	[thread overview]
Message-ID: <43F62B1D.7090907@cfl.rr.com> (raw)
In-Reply-To: <43F617FA.2030609@wolfmountaingroup.com>

Other than generate CHS addresses that are invalid due to having S > 62, 
what is this code supposed to do?


Jeff V. Merkey wrote:
> 
> Dick,
> 
> The model Netware uses for large drives for calculating C/H/S addressed 
> this problem years ago and
> provides more useful output, since C/H/S is converted into a hieristic 
> which acts almost like an MD5 hash
> and for a given dimension, does provide unique output for even very 
> large drives.
> 
> Code Attached.
> 
> Jeff
> 
> 
> 
> ULONG SetPartitionTableGeometry(BYTE *hd, BYTE *sec, BYTE *cyl,
>                ULONG LBA, ULONG TracksPerCylinder,
>                ULONG SectorsPerTrack)
> {
>    ULONG offset, cylinders, head, sector;
> 
>    if (!cyl || !hd || !sec)
>       return -1;
> 
>    cylinders = (LBA / (TracksPerCylinder * SectorsPerTrack));
>    offset = LBA % (TracksPerCylinder * SectorsPerTrack);
>    head = (WORD)(offset / SectorsPerTrack);
>    sector = (WORD)(offset % SectorsPerTrack) + 1;
> 
>    if (cylinders < 1023)
>    {
>       *sec = (BYTE)sector;
>       *hd = (BYTE)head;
>       *cyl = (BYTE)(cylinders & 0xff);
>       *sec |= (BYTE)((cylinders >> 2) & 0xC0);
>    }
>    else
>    {
>    *sec = (BYTE)(SectorsPerTrack | 0xC0);
>    *hd = (BYTE)(TracksPerCylinder - 1);
>    *cyl = (BYTE)0xFE;
>    }
> 
>    return 0;
> }
> 
> ULONG SetPartitionTableValues(struct PartitionTableEntry *Part,
>                  ULONG Type,
>                  ULONG StartingLBA,
>                  ULONG EndingLBA,
>                  ULONG Flag,
>                  ULONG TracksPerCylinder,
>                  ULONG SectorsPerTrack)
> {
> 
>    Part->SysFlag = (BYTE) Type;
>    Part->fBootable = (BYTE) Flag;
>    Part->StartLBA = StartingLBA;
>    Part->nSectorsTotal = (EndingLBA - StartingLBA) + 1;
> 
>    SetPartitionTableGeometry(&Part->HeadStart, &Part->SecStart, 
> &Part->CylStart,
>                  StartingLBA, TracksPerCylinder, SectorsPerTrack);
> 
>    SetPartitionTableGeometry(&Part->HeadEnd, &Part->SecEnd, &Part->CylEnd,
>                  EndingLBA, TracksPerCylinder, SectorsPerTrack);
> 
>    return 0;
> 
> }
> 
> 


  reply	other threads:[~2006-02-17 20:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-17 17:01 C/H/S from user space linux-os (Dick Johnson)
2006-02-17 18:37 ` Jeff V. Merkey
2006-02-17 19:59   ` Phillip Susi [this message]
2006-02-17 20:04   ` linux-os (Dick Johnson)
2006-02-17 20:24     ` Nick Warne
2006-02-17 20:39       ` linux-os (Dick Johnson)
2006-02-17 21:04     ` Phillip Susi
2006-02-17 21:22       ` linux-os (Dick Johnson)
2006-02-17 22:20         ` Phillip Susi
2006-02-18  3:42           ` Marcin Dalecki
2006-02-18 16:20             ` Phillip Susi
2006-02-17 22:24         ` Jeff V. Merkey
2006-02-17 22:22       ` Jeff V. Merkey
  -- strict thread matches above, loose matches on Subject: below --
2006-02-17 20:30 Seewer Philippe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43F62B1D.7090907@cfl.rr.com \
    --to=psusi@cfl.rr.com \
    --cc=jmerkey@wolfmountaingroup.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox