Re: reading/writing files from mounted device directly
Re: reading/writing files from mounted device directly
- Subject: Re: reading/writing files from mounted device directly
- From: Brian Bergstrand <email@hidden>
- Date: Tue, 29 Aug 2006 15:54:02 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You cannot reliably read data from a device with a mounted FS and
attempting to write to one is 99.99999% guaranteed to cause
filesystem corruption. There's no way around either of these. Why
can't you just use standard files on the filesystem? You can bypass
caching on a file level (but not file system level) with fcntl
(F_NOCACHE).
On Aug 29, 2006, at 3:10 PM, Dave Hackenyos wrote:
Hello,
I am developing a product for the Macintosh platform
that requires I read and write files from a mounted device.
Information on the mounted device is being updated in real time but
I am unable to detect the changes due to the operating system
(Darwin?) caching the contents of the device into a buffer which
remains static until I unmount the drive with a “diskutil unmount”
command. Continually mounting and unmounting the device to see
changes in a file is not desirable.
Using the IOKit to obtain a handle to the device and
then using POSIX funtions to open/read/write does allow access to
the raw disk, but I can only access bytes. Reading the entire
device and programmatically reproducing the file structure to
locate the file I am interested in reading is prohibitive. Changing
a file and writing the entire contents of the drive back into it
would take 30 seconds or more, also bad. I need a way to read and
write to the file system on the mounted device not just access the
bytes.
Is there a no-cache option on mounting what is
effectively a USB storage device? Or how do I bypass the cached
buffer?
Please let me know if there is a more appropriate forum
for asking this question.
Thank you for your time,
Dave Hackenyos
email@hidden
This message has been scanned by Symantec Mail Security for SMTP.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40classicalguitar.net
This email sent to email@hidden
Brian Bergstrand
<http://www.bergstrand.org/brian/> PGP Key ID: 0xB6C7B6A2
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFE9KlvedHYW7bHtqIRAllHAKCN/kGHplUzd3ZMAUovtcsH8tH7YACfeS4B
LnCJGkFqsF4CkAab5OmdNBQ=
=iumI
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden