This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: flushall


> >Not sure what an "hdf5" is, but in general it is not possible to do
> >sync-to-backing-storage from an arbitrary account in Windows.  Not
> >even on
> >removable media, which of course is where you often need it most.
> >Microsoft's rationale behind this escapes me, but there it is.
> >Furthermore,
> >even when you can do it, the method is completely different in Win9x
> >and the NT series.
> 
> Gary
> Are you saying this can be done with admin privs?

Yep.

>  Where would I find
> out how to do this on NT?
> 

I think you have to look in the Windows DDK documentation, under mass
storage IOCTLs.  You essentially have to do the following:

1.  Get a handle to the physical disk.  IIRC this is the real trick, because
for some reason it's almost impossible to map a volume back to a physical
disk or disks.  But I was trying to commit volumes to backing store; if
you're really trying to emulate sync() you might just be able to enumerate
all physical disks and commit them.
2.  Lock the disk.  This is what requires the admin privs.
3.  Send the sync message.
4.  Unlock the disk.
5.  Close the handle.

This is all done (again, on the NT->XP series) by sending IOCTLs.  I don't
recall the exact details unfortunately; I did this quite a while ago, and am
still suffering from PTSD ;-).  IIRC, once you get it figured out (no thanks
to Microsoft), it's not that big a deal, but like everything else it's the
figuring-out part that's the problem.

Keep in mind though that neither sync() nor the sync command (as I
understand it) are actually guaranteed to do *anything at all*, even on
Unii.  To wit:

http://www.opengroup.org/onlinepubs/007908799/xsh/sync.html
"The sync() function causes all information in memory that updates file
systems to be scheduled for writing out to all file systems. 
The writing, although scheduled, is not necessarily complete upon return
from sync()."

Since this scheduling must by definition be done at the end of every call
that is intended to modified the disk (e.g. the modification is either
complete or scheduled to be completed when write() returns), Cygwin's stub
is a conforming implementation.  And since FWICT the sync command is only
required to call sync, it isn't actually required to do anything either.

What I'm getting at here is, make sure you really truly need to sync to the
physical media before spending all kinds of time fighting this one.  What
does hdf5 use this for?

> Thanks,
> david

HTH,

-- 
Gary R. Van Sickle


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]