[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Disk space
- To: "Sandro Pedrazzini" <sandro@idsia.ch>, info-mcl@cambridge.apple.com
- Subject: Re: Disk space
- From: e@flavors.com (Doug Currie, Flavors Technology, Inc.)
- Date: Wed, 2 Mar 1994 13:43:35 -0500
>In order to preview every time if the secondary storage is enought for such
>operations, we need a function which is able to read the amount of free-space
>in the hard-disk.
In the file ccl:library;interfaces.lisp is the function getvinfo, this may
be what you want:
? (defun volume-freesize (volume-name)
(%stack-block ((sz 4) (rn 4))
(traps::getvinfo -1 volume-name rn sz)
(%get-long sz)))
VOLUME-FREESIZE
? (volume-freesize "e")
3220992
?
Or use this funtion if you prefer not to load all of interfaces.lisp
(defun fti-GetVInfo (&key volName (vRefNum 0) (VolIndex -1))
(let ((dirname (if volName
(let* ((vol-pathname (truename (make-pathname :type nil
:name nil :defaults volName)))
(directory (pathname-directory vol-pathname)))
(assert (and directory (eq :absolute (car directory))))
(concatenate 'string (cadr directory) ":"))
"")))
(rlet ((paramBlock :hparamblockrec))
(with-returned-pstrs ((pname dirname))
(setf (pref paramblock :hparamblockrec.ioCompletion) (%null-ptr)
(pref paramblock :hparamblockrec.ioNamePtr) pname
(pref paramblock :hparamblockrec.ioVRefNum) vRefNum
(pref paramblock :hparamblockrec.ioVolIndex) VolIndex)
(let ((oserr (#_PBHGetVInfo paramBlock)))
(if (eql oserr 0)
(values
oserr
(* (pref paramblock :hparamblockrec.ioVAlBlkSiz)
(pref paramblock :hparamblockrec.ioVFrBlk))
(pref paramblock :hparamblockrec.ioVRefNum)
(%get-string (pref paramblock :hparamblockrec.ioNamePtr)))
oserr))))))
? (fti-GetVInfo :volname "e:")
0
3220992
-1
"e"
?
e