• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Difference between dvd and dmg
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Difference between dvd and dmg


  • Subject: Re: Difference between dvd and dmg
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Wed, 12 Oct 2005 10:35:53 +0200


On 11.10.2005, at 21:03, I wrote:

On 11.10.2005, at 15:04, Jonathon Mah wrote:

Gerriet,

On 2005-10-11, at 18:51, Gerriet M. Denkmann wrote:

I have mounted a data dvd and some dmg.

Both (in getfsstat) have:
fstypename = hfs
mntfromname = /dev/disk...

NSFileManager  fileExistsAtPath:isDirectory: reports an existing
directory for both cases.

Question:
How can I distinguish between an hfs-filesystem (as in the case of
dmg) and just a directory (as in the case of a data-dvd)?


Your final question is a bit confusing, as a mounted DVD has its own filesystem too (it's not "just a directory"). Anyway, one way to determine if a volume is an image or not is to use hdiutil. It shouldn't be hard to make an NSTask run "hdiutil info -plist" and get an NSDictionary from the result.

I have: /dev/rdisk1s2 = /Volumes/Security Update /dev/rdisk2s3 = /Volumes/Some dvd

hdiutil hfsanalyze /dev/rdisk... shows that both are (as you said)
valid HFS+ filesystems. The main difference is the block size: 4096
(dmg) versus 2048 (dvd).

In a program I do:

int a = open( "/dev/rdisk...", O_RDONLY, 0 ); // no problem here
ssize_t b = pread( a, ...);

Works for "Security Update" but gives errno = EINVAL for "Some dvd".

New questions:
Why does  pread() not like my "Some dvd" ?

Because pread() wants both nbr_of_bytes and byte_offset to be a multiple of the hardware value, which seems to be 512 in case of my hard disk, and 2048 for cds and dvds.
Somehow I failed to see this on the pread man page.


What can I do to make it work?
Use appropriate values (see above).

Or, if this is impossible: how can I recognize beforehand those filesystems which do not work with pread?

That now becomes a new question:
how to get this hardware value (hardware block-size?) before trying to read?


Kind regards,

Gerriet.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Difference between dvd and dmg
      • From: John Stiles <email@hidden>
  • Prev by Date: Re: Am I using NSConditionLock correctly?
  • Next by Date: Re: No Reference to Table Column
  • Previous by thread: Re: Difference between dvd and dmg
  • Next by thread: Re: Difference between dvd and dmg
  • Index(es):
    • Date
    • Thread