Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > determining journalling state programaitically

determining journalling state programaitically
Thread Tools
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Nov 15, 2002, 08:34 PM
 
Im sure we shall soon see a flood of apps which enable disable journalling on a given volume. Im developing one of them. The part im kinda stuck on right now, is determining the state of journalling. Presently I have found two ways, both of which kinda suck.

1) NSTask with "mount"

lots of parsing required to beat the output into anything usefull. gotta break up the output into an array of lines, then compare each of those lines with an array that is made from :

[[NSWorkspace sharedWorkspace] mountedLocalVolumePaths]
minus
[[NSWorkspace sharedWorkspace] mountedRemovableMedia]

only then, can I associate the info from "mount" with a volume capable of being journalled.

2) NSTask with diskutil info <pathToVolume>

this is more straight forward, but really really slow. at least on my box, it takes 28 seconds to enumerate thru the strings of paths with an NSTask for each one. I have four drives where journalling is possible. So thats like 7 seconds for each loop of NSTask with the volume path. Also as an aside, when I run diskutil info <pathToVolume>, i get this everytime before the good stuff. Is this normal? Heres my terminal output:

[beardedllama:~] xaos01% diskutil info /
Couldn't open device /dev/rdisk2
Couldn't open device /dev/rdisk3
Couldn't open device /dev/rdisk3
Couldn't open device /dev/rdisk3
Couldn't open device /dev/rdisk3
Couldn't open device /dev/rdisk2
Couldn't open device /dev/rdisk2
Couldn't open device /dev/rdisk2
Timed out waiting for arbitration
Device Node: /dev/disk1s9
Device Identifier: disk1s9
Mount Point: /
Volume Name: MOBIUS

File System: HFS+
Partition Type: Apple_HFS
Media Type: Generic
Protocol: ATA

Total Size: 23.0 GB
Free Space: 480.1 MB

Read Only: No
Ejectable: No

So how do you guys think I should go about determining if journalling is enabled on a given volume? Is there some carbon (may as well be cunniform to me) way to do it? Anyone benevolent cocoaGods feel like writting a method like:

- (BOOL) journalStateOfVolume:(NSString *)thePath;
     
Professional Poster
Join Date: Apr 2001
Location: Long Beach, CA
Status: Offline
Reply With Quote
Nov 16, 2002, 10:24 AM
 
The df command gives a list of mounted volumes. You could parse that and then use diskutil to get info on each volume that's mounted.

Now, if we felt like writing it for you, we might just go ahead and write the entire app.

ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
     
3R1C  (op)
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Nov 16, 2002, 02:06 PM
 
NEWSFLASH! that was a joke.

also, your suggestion doesnt help at all. Its just a more difficult way of doing this:

[[NSWorkspace sharedWorkspace] mountedLocalVolumePaths]
minus
[[NSWorkspace sharedWorkspace] mountedRemovableMedia]

thanks anyway. I hope your sense of humor improves.
3R1C
     
eno
Banned
Join Date: Sep 2000
Location: Fightclub
Status: Offline
Reply With Quote
Nov 18, 2002, 03:53 AM
 
I hate apps which try to cash in on Apple OS features like this.

Same with all the apps which turn the screen effect on and off in the desktop.

People should learn how to use the CLI for **** like that. It's just not right to make a frickin' GUI app for it.
     
3R1C  (op)
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Nov 18, 2002, 09:37 AM
 
whos tryin to cash in? my app is free.

what makes you think that a user of an app that has a gui, doesnt know to do the same thing with the cli?

I suppose you eschew the aqua layer of osx alltogether? i suppose you browse these fora with only cli tools?

I hate it when others' elitist nature forces them to make themselves the arbitor of taste for others.

get over yourself. =)
3R1C
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:21 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2