Changeset 8070 in project


Ignore:
Timestamp:
02/02/08 19:22:12 (12 years ago)
Author:
sjamaan
Message:

Prefix some things that ought to be visible outside 9p-lolevel with 9p:
Add some TODOs
Fix race condition in 9p:file-open where the walk would succeed but the open would fail

Location:
release/3/9p/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/3/9p/trunk/9p-client.scm

    r8069 r8070  
    3737; this will be hard and very error-prone to do, at least in the case of directories.
    3838; Something for another time :)
     39;
     40; TODO: Wstat interface (9p:change-file-owner, 9p:change-file-mode)
     41; Using this interface we can implement a partially correct rename-file: the
     42; filename can be changed, but not the rest of the path.
     43; Beware: the "spec" says changing the owner is illegal, except when the fs was
     44; configed to allow it?  File length can be changed too...
     45;
     46; TODO: Think about how to expose non-POSIX things from 9p properly
    3947
    4048(use 9p-lolevel srfi-13 iset)
     
    8896        ;;
    8997        ;; Allocate the root fid using alloc-handle so we automatically get a finalizer set
    90         (9p:request con 'Tattach (9p:handle-fid (9p:alloc-handle con)) nofid user mountpoint)
     98        (9p:request con 'Tattach (9p:handle-fid (9p:alloc-handle con)) 9p:nofid user mountpoint)
    9199        con)))))
    92100
     
    119127     ((bit-vector-full? fids (add1 highest))
    120128      (loop fids (add1 highest)))
    121      ((>= highest nofid)
     129     ((>= highest 9p:nofid)
    122130      (error "Out of file ids"))
    123131     (else
     
    174182    ((exn 9p-server-error) #f)))
    175183
    176 ; XXX What if walk succeeds but open fails?
    177184(define (9p:file-open con name mode)
    178   (let* ((h (9p:path-walk con name))
    179          (response (9p:request con 'Topen (9p:handle-fid h) mode))
    180          (iounit (second (9p:message-contents response))))
    181     (9p:initialize-iounit! h iounit)
    182     h))
     185  (let ((h (9p:path-walk con name)))
     186    (handle-exceptions exn (begin (9p:file-close h) (signal exn))
     187     (let* ((response (9p:request con 'Topen (9p:handle-fid h) mode))
     188            (iounit (second (9p:message-contents response))))
     189       (9p:initialize-iounit! h iounit)
     190       h))))
    183191
    184192;; This duplicates much of with-handle-to, but 9p isn't very consistent here: the
  • release/3/9p/trunk/9p-lolevel.scm

    r8068 r8070  
    7979(define-constant 9p:qttmp    #x04)
    8080
    81 (define-constant notag #xffff)      ;; For Tversion
    82 (define-constant nofid #xffffffff)  ;; For Tattach
     81(define-constant 9p:notag #xffff)      ;; For Tversion
     82(define-constant 9p:nofid #xffffffff)  ;; For Tattach
    8383
    8484;; For Twstat messages, when the server should keep the current value (aka "don't touch" in the manpage)
     
    234234                                   template
    235235                                   (if (eq? (9p:message-type message) 'Tversion)
    236                                        notag
     236                                       9p:notag
    237237                                       (9p:message-tag message))
    238238                                   (9p:message-contents message)))))
Note: See TracChangeset for help on using the changeset viewer.