Function: tramp-sh-handle-file-system-info

tramp-sh-handle-file-system-info is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-sh-handle-file-system-info FILENAME)

Documentation

Like file-system-info for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-sh-handle-file-system-info (filename)
  "Like `file-system-info' for Tramp files."
  (ignore-errors
    (with-parsed-tramp-file-name (expand-file-name filename) nil
      (when (tramp-get-remote-df v)
	(tramp-message v 5 "file system info: %s" localname)
	(tramp-send-command
	 v (format
	    "%s %s"
	    (tramp-get-remote-df v) (tramp-shell-quote-argument localname)))
	(with-current-buffer (tramp-get-connection-buffer v)
	  (goto-char (point-min))
	  (forward-line)
	  (when (looking-at
		 (concat "\\(?:^/[^[:space:]]*[[:space:]]\\)?"
			 "[[:space:]]*\\([[:digit:]]+\\)"
			 "[[:space:]]+\\([[:digit:]]+\\)"
			 "[[:space:]]+\\([[:digit:]]+\\)"))
	    (mapcar
	     (lambda (d)
	       (* d (tramp-get-connection-property v "df-blocksize" 0)))
	     (list (string-to-number (match-string 1))
		   ;; The second value is the used size.  We need the
		   ;; free size.
		   (- (string-to-number (match-string 1))
		      (string-to-number (match-string 2)))
		   (string-to-number (match-string 3))))))))))