Closed
Bug 32942
Opened 24 years ago
Closed 24 years ago
[RFE] Impliment UNIX nsLocalFile::GetDiskSpaceAvailabl
Categories
(Core :: XPCOM, enhancement, P3)
Tracking
()
VERIFIED
FIXED
People
(Reporter: jce2, Assigned: blizzard)
References
Details
Attachments
(3 files)
4.15 KB,
patch
|
Details | Diff | Splinter Review | |
4.98 KB,
patch
|
Details | Diff | Splinter Review | |
2.89 KB,
patch
|
Details | Diff | Splinter Review |
Currently, we have: NS_IMETHODIMP nsLocalFile::GetDiskSpaceAvailable(PRInt64 *aDiskSpaceAvailable) { NS_ENSURE_ARG_POINTER(aDiskSpaceAvailable); return NS_ERROR_NOT_IMPLEMENTED; } That would tend to explain our crappy error handling around out of disk space conditions. :P Is this something that no one ever got around to doing? (as in, could I just do an obvious implimentation?) Or is this something that is sadistically difficult to do in a cross-platform manner?
Comment 2•24 years ago
|
||
Chris, can you assist? I believe the code in nsFileSpec just needs to be massaged into nsLocalFile.
Assignee: dougt → blizzard
Summary: [RFE] Impliment nsLocalFile::GetDiskSpaceAvailable already! → [RFE] Impliment UNIX nsLocalFile::GetDiskSpaceAvailabl
Reporter | ||
Comment 3•24 years ago
|
||
Reporter | ||
Comment 4•24 years ago
|
||
Please note my opinion comment at the beginning of the function that this function should have two parameters, the directory(->Filesystem) to determine free disk space of should be one of the parameters. Making this change would simplify this procedure dramatically.
nsLocalFile represents a path, so it shouldn't be too hard. mPath holds the path in question, so you probably just want to use that. Also, there are some strange indentation things here; the convention in that file is 4-char indent, and tabs are verboten (as in the rest of the Mozilla tree).
Reporter | ||
Comment 6•24 years ago
|
||
Assignee | ||
Comment 7•24 years ago
|
||
Adding dougt
Assignee | ||
Comment 8•24 years ago
|
||
Assignee | ||
Comment 9•24 years ago
|
||
Thanks so much for doing the work, Jason! I've cleaned up the patch a little bit and it seems to work well. Here's the script that I'm using to test it: const nsILocalFile = Components.interfaces.nsILocalFile; const nsILocalFile_PROGID = "component://mozilla/file/local"; var file = Components.classes[nsILocalFile_PROGID].createInstance(nsILocalFile); var file2 = Components.classes[nsILocalFile_PROGID].createInstance(nsILocalFile); file.initWithPath("/tmp/6706.patch"); dump("free space is " + file.diskSpaceAvailable + "\n"); file2.initWithPath("/boot/boot.b"); dump("free space is " + file2.diskSpaceAvailable + "\n"); dougt, can you review and if you don't have any comments approve checking it in please? Thanks!
Status: NEW → ASSIGNED
Comment 10•24 years ago
|
||
Why are you initializing bytesFree to all the space in the world? Should this be zero instead?
Assignee | ||
Comment 11•24 years ago
|
||
Good question. I'll set it to zero. Any other comments?
Comment 12•24 years ago
|
||
nope. check it in. :-)
Reporter | ||
Comment 13•24 years ago
|
||
NO NO, DON'T set free space to zero..that hides bugs! Since we no longer need to worry about passing a dummy value back that works when this function fails, lets initalize bytesFree to something like 0xCCCC, something where it becomes obvious that bytesFree wasn't initalized after it was declared.
Reporter | ||
Comment 14•24 years ago
|
||
It looks like the patch was already checked in...in fact, I got: "Conflicts found in mozilla/xpcom/io/nsLocalFileUnix.cpp" and the conflict marks appear to be in my code, so I assume you checked in my patch. Should we set this to "FIXED" now that the patch has been checked in? Anyways, I'm off to fix bug# 32443.
Whiteboard: Patch appears to be checked in..is this now "FIXED"?
Comment 15•24 years ago
|
||
jce2@po.cwru.edu, how would setting the space to zero hide bugs?
Assignee | ||
Comment 16•24 years ago
|
||
Yeah, initializing to zero is the right way to do this in my opinion. If there's a problem then people will definitely know because it will always showing up as out of disk space. Your way, there might be a chance that a size will be returned when there isn't actually any space, causing the program using it to try and write to disk when there isn't any space. If there is an error, and the program does something wrong that it end up doing the safe thing. Oh, yes. It's checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 17•24 years ago
|
||
Please ignore the spam. Changing address.
Assignee: blizzard → blizzard
Status: RESOLVED → NEW
Assignee | ||
Comment 18•24 years ago
|
||
busted from my reassign
Status: NEW → RESOLVED
Closed: 24 years ago → 24 years ago
Assignee | ||
Comment 19•24 years ago
|
||
clearing status whiteboard while I'm at it
Whiteboard: Patch appears to be checked in..is this now "FIXED"?
Comment 20•24 years ago
|
||
- Per last comments, age of bug, and no reopen - Marking Verified/Fixed. Please reopen if still a problem.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•