****LBA Calculation

Is the method of calculating the LBA correct??

//Obtain the read/write length

Sectors =
irpStack->Parameters.Write(Read).ByteOffset.LowPart;
LBA = Sectors>>9;

//Do encryption of first sector with LBA as offset.

//Number of iterations …
EncLength = ( ULONG )
ptrStkLocation->Parameters.Write.Length;

Iterations = EncLength /512;

//Thus, for sectors after first i do
LBA = LBA+1;

Is this correct?

V.S.


Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

Forgot to mention in earlier mail…
this is an upper disk drive filter driver.

V.S.


Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail

You should really retrive the disk geomety from the lower driver and use
the block size listed in there rather than assuming it will be 512
bytes.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of vartika Singh
Sent: Thursday, August 05, 2004 11:54 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] ****LBA Calculation

Forgot to mention in earlier mail…
this is an upper disk drive filter driver.

V.S.


Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi Peter,
From what i have seen and observed and read so far, (
for Windows 2K onwards ), the sector size is 512
bytes.I have been trying to look around whther one can
change the sector size.Even during the formatting, the
user is given the option to select the Cluster size
and not the sector size.And Cluster size is used as a
parameter for the smallest file size which can be kept
unfragmented, right?
Im talking bt the NTFS.
Im still not sure bt this point because system always
seems to take 512 bytes as the sector size.
Still, I will make my driver as generic as possible as
u suggest.

Thanx and Regards
V.S.


Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

We had a problem with early versions of 2K (and this ‘feature’ may still be
there) that if you connected a scsi drive with any sector size other than
512 bytes, the system would realize you made a mistake and automatically
reformat it to 512 bytes for you. We weren’t real happy when we brought 2K
up for the first time and got about 200 drives reformatted from our
proprietary format.

Loren

----- Original Message -----
From: “vartika Singh”
To: “Windows System Software Devs Interest List”
Sent: Sunday, August 08, 2004 11:22 PM
Subject: RE: [ntdev] **** LBA Calculation

> Hi Peter,
> >From what i have seen and observed and read so far, (
> for Windows 2K onwards ), the sector size is 512
> bytes.I have been trying to look around whther one can
> change the sector size.Even during the formatting, the
> user is given the option to select the Cluster size
> and not the sector size.And Cluster size is used as a
> parameter for the smallest file size which can be kept
> unfragmented, right?
> Im talking bt the NTFS.
> Im still not sure bt this point because system always
> seems to take 512 bytes as the sector size.
> Still, I will make my driver as generic as possible as
> u suggest.
>
> Thanx and Regards
> V.S.
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> http://promotions.yahoo.com/new_mail
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@earthlink.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Not sure exactly what you are referring to. Windows does not issue the
SCSI FORMAT UNIT command (i.e., we do not low level format a drive). I
can’t verify for sure whether there was briefly some code prior to
shipping Win2K that did this, but we don’t have any code that does this
in shipping OSes (Win2K, XP, Server 2003).

As to the real “facts” about sector size - in general, NTFS doesn’t
really care much (well, let’s limit the discussion today to 512, 1024,
2048, 4096), and certainly CDFS uses 2K sectors, but there are some
nasty issues that can bite you if you go over 4K. There are also a
number of places that have hardcoded 512 bytes though - such as the
loader, and others that have placed assumptions on sector size at least
temporarily, such as the logical volume manager. A more benign example
is a SQL log file - you can use non-512 byte sectors but then you can’t
restore that log to a different sector size. All told, there are more
than a dozen areas (maybe thousands of instances) that we are aware of
with “sensitivity” to sector size. That’s just Windows; you’d be amazed
at how many apps think they need to know all about the hardware. And
then hardcode stuff like sector size or use the phony geometry.

We’d like to clean up all of this going forward because there are
devices coming that won’t be able to support 512 byte sectors, or at
least not efficiently. So when we have this conversation 3 years from
now, the answer can be sure, why not. The sector size information is
readily available; we’d like to make sure everyone use it - even in
sample code - from now on.

As to the format options on NTFS, that has nothing to do with low-level
format. That’s why you don’t see any options for sector size.

-----Original Message-----
From: Loren Wilton [mailto:xxxxx@earthlink.net]
Sent: Sunday, August 08, 2004 11:36 PM
Subject: Re: ****LBA Calculation

We had a problem with early versions of 2K (and this ‘feature’ may still
be
there) that if you connected a scsi drive with any sector size other
than
512 bytes, the system would realize you made a mistake and automatically
reformat it to 512 bytes for you. We weren’t real happy when we brought
2K
up for the first time and got about 200 drives reformatted from our
proprietary format.

Loren

----- Original Message -----
From: “vartika Singh”
To: “Windows System Software Devs Interest List”
Sent: Sunday, August 08, 2004 11:22 PM
Subject: RE: [ntdev] **** LBA Calculation

> Hi Peter,
> >From what i have seen and observed and read so far, (
> for Windows 2K onwards ), the sector size is 512
> bytes.I have been trying to look around whther one can
> change the sector size.Even during the formatting, the
> user is given the option to select the Cluster size
> and not the sector size.And Cluster size is used as a
> parameter for the smallest file size which can be kept
> unfragmented, right?
> Im talking bt the NTFS.
> Im still not sure bt this point because system always
> seems to take 512 bytes as the sector size.
> Still, I will make my driver as generic as possible as
> u suggest.
>
> Thanx and Regards
> V.S.
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> http://promotions.yahoo.com/new_mail
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@earthlink.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>