emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/net/tramp-smb.el


From: Kai Großjohann
Subject: [Emacs-diffs] Changes to emacs/lisp/net/tramp-smb.el
Date: Wed, 05 Feb 2003 16:03:38 -0500

Index: emacs/lisp/net/tramp-smb.el
diff -c emacs/lisp/net/tramp-smb.el:1.2 emacs/lisp/net/tramp-smb.el:1.3
*** emacs/lisp/net/tramp-smb.el:1.2     Tue Feb  4 08:17:16 2003
--- emacs/lisp/net/tramp-smb.el Wed Feb  5 16:03:36 2003
***************
*** 1,6 ****
  ;;; tramp-smb.el --- Tramp access functions for SMB servers -*- coding: 
iso-8859-1; -*-
  
! ;; Copyright (C) 2002 Free Software Foundation, Inc.
  
  ;; Author: Michael Albinus <address@hidden>
  ;; Keywords: comm, processes
--- 1,6 ----
  ;;; tramp-smb.el --- Tramp access functions for SMB servers -*- coding: 
iso-8859-1; -*-
  
! ;; Copyright (C) 2002, 2003 Free Software Foundation, Inc.
  
  ;; Author: Michael Albinus <address@hidden>
  ;; Keywords: comm, processes
***************
*** 50,56 ****
  ;; Add a default for `tramp-default-method-alist'. Rule: If there is
  ;; a domain in USER, it must be the SMB method.
  (add-to-list 'tramp-default-method-alist
!            '("%" "" tramp-smb-method))
  
  ;; Add completion function for SMB method.
  (tramp-set-completion-function
--- 50,56 ----
  ;; Add a default for `tramp-default-method-alist'. Rule: If there is
  ;; a domain in USER, it must be the SMB method.
  (add-to-list 'tramp-default-method-alist
!            (list "%" "" tramp-smb-method))
  
  ;; Add completion function for SMB method.
  (tramp-set-completion-function
***************
*** 108,113 ****
--- 108,116 ----
  This variable is local to each buffer.")
  (make-variable-buffer-local 'tramp-smb-process-running)
  
+ (defvar tramp-smb-inodes nil
+   "Keeps virtual inodes numbers for SMB files.")
+ 
  ;; New handlers should be added here.
  (defconst tramp-smb-file-name-handler-alist
    '(
***************
*** 118,124 ****
      (delete-directory . tramp-smb-handle-delete-directory)
      (delete-file . tramp-smb-handle-delete-file)
      ;; `diff-latest-backup-file' performed by default handler
!     ;; `directory-file-name' performed by default handler
      (directory-files . tramp-smb-handle-directory-files)
      (directory-files-and-attributes . 
tramp-smb-handle-directory-files-and-attributes)
      (dired-call-process . tramp-smb-not-handled)
--- 121,127 ----
      (delete-directory . tramp-smb-handle-delete-directory)
      (delete-file . tramp-smb-handle-delete-file)
      ;; `diff-latest-backup-file' performed by default handler
!     (directory-file-name . tramp-handle-directory-file-name)
      (directory-files . tramp-smb-handle-directory-files)
      (directory-files-and-attributes . 
tramp-smb-handle-directory-files-and-attributes)
      (dired-call-process . tramp-smb-not-handled)
***************
*** 342,348 ****
             (file (tramp-smb-get-path path nil))
             (entries (tramp-smb-get-file-entries user host share file))
             (entry (and entries
!                        (assoc (file-name-nondirectory file) entries))))
        ; check result
        (when entry
          (list (and (string-match "d" (nth 1 entry))
--- 345,354 ----
             (file (tramp-smb-get-path path nil))
             (entries (tramp-smb-get-file-entries user host share file))
             (entry (and entries
!                        (assoc (file-name-nondirectory file) entries)))
!            (inode (tramp-smb-get-inode share file))
!            (device (tramp-get-device nil tramp-smb-method user host)))
! 
        ; check result
        (when entry
          (list (and (string-match "d" (nth 1 entry))
***************
*** 350,363 ****
                -1              ;1 link count
                -1              ;2 uid
                -1              ;3 gid
!               (nth 3 entry)   ;4 atime
                (nth 3 entry)   ;5 mtime
!               (nth 3 entry)   ;6 ctime
                (nth 2 entry)   ;7 size
                (nth 1 entry)   ;8 mode
                nil             ;9 gid weird
!               -1              ;10 inode number
!               -1))))))        ;11 file system number
  
  (defun tramp-smb-handle-file-directory-p (filename)
    "Like `file-directory-p' for tramp files."
--- 356,369 ----
                -1              ;1 link count
                -1              ;2 uid
                -1              ;3 gid
!               '(0 0)          ;4 atime
                (nth 3 entry)   ;5 mtime
!               '(0 0)          ;6 ctime
                (nth 2 entry)   ;7 size
                (nth 1 entry)   ;8 mode
                nil             ;9 gid weird
!               inode           ;10 inode number
!               device))))))    ;11 file system number
  
  (defun tramp-smb-handle-file-directory-p (filename)
    "Like `file-directory-p' for tramp files."
***************
*** 532,538 ****
          (make-directory ldir parents))
        ;; Just do it
        (when (file-directory-p ldir)
!         (tramp-smb-handle-make-directory-internal dir))
        (unless (file-directory-p dir)
          (error "Couldn't make directory %s" dir))))))
  
--- 538,544 ----
          (make-directory ldir parents))
        ;; Just do it
        (when (file-directory-p ldir)
!         (make-directory-internal dir))
        (unless (file-directory-p dir)
          (error "Couldn't make directory %s" dir))))))
  
***************
*** 822,829 ****
  
        ;; size
        (if (string-match "\\([0-9]+\\)$" line)
!           (setq size (match-string 1 line)
!                 line (substring line 0 (- (max 8 (1+ (length size))))))
          (return))
  
        ;; mode
--- 828,837 ----
  
        ;; size
        (if (string-match "\\([0-9]+\\)$" line)
!           (setq
!            size (string-to-number (match-string 1 line))
!            line (substring
!                  line 0 (- (max 8 (1+ (length (match-string 1 line)))))))
          (return))
  
        ;; mode
***************
*** 853,858 ****
--- 861,880 ----
                 year)
              '(0 0)))
        (list path mode size mtime))))
+ 
+ ;; Inodes don't exist for SMB files.  Therefore we must generate virtual ones.
+ ;; Used in `find-buffer-visiting'.
+ ;; The method applied might be not so efficient (Ange-FTP uses hashes). But
+ ;; performance isn't the major issue given that file transfer will take time.
+ 
+ (defun tramp-smb-get-inode (share file)
+   "Returns the virtual inode number.
+ If it doesn't exist, generate a new one."
+   (let ((string (concat share "/" (directory-file-name file))))
+     (unless (assoc string tramp-smb-inodes)
+       (add-to-list 'tramp-smb-inodes
+                  (list string (length tramp-smb-inodes))))
+     (nth 1 (assoc string tramp-smb-inodes))))
  
  
  ;; Connection functions




reply via email to

[Prev in Thread] Current Thread [Next in Thread]