[CIFS] Change notify support part 2
authorSteve French <sfrench@us.ibm.com>
Thu, 25 Aug 2005 00:10:36 +0000 (17:10 -0700)
committerSteve French <sfrench@us.ibm.com>
Thu, 25 Aug 2005 00:10:36 +0000 (17:10 -0700)
Signed-off-by: Asser Ferno <asser@diku.dk>
Signed-off-by: Steve French <sfrench@us.ibm.com> and lightly modified
fs/cifs/cifsglob.h
fs/cifs/cifspdu.h
fs/cifs/cifssmb.c

index 9a3c85b..92fba76 100644 (file)
@@ -391,6 +391,20 @@ struct oplock_q_entry {
        __u16 netfid;
 };
 
+/* for pending dnotify requests */
+struct dir_notify_req {
+       struct list_head lhead;
+       __le16 Pid;
+       __le16 PidHigh;
+       __u16 Mid;
+       __u16 Tid;
+       __u16 Uid;
+       __u16 netfid;
+       __u32 filter; /* CompletionFilter (for multishot) */
+       int multishot;
+       struct dentry * dentry;
+};
+
 #define   MID_FREE 0
 #define   MID_REQUEST_ALLOCATED 1
 #define   MID_REQUEST_SUBMITTED 2
@@ -459,6 +473,9 @@ GLOBAL_EXTERN rwlock_t GlobalSMBSeslock;  /* protects list inserts on 3 above */
 
 GLOBAL_EXTERN struct list_head GlobalOplock_Q;
 
+GLOBAL_EXTERN struct list_head GlobalDnotifyReqList; /* Outstanding dir notify requests */
+GLOBAL_EXTERN struct list_head GlobalDnotifyRsp_Q; /* Dir notify response queue */
+
 /*
  * Global transaction id (XID) information
  */
index 42c16cf..026c88f 100644 (file)
@@ -53,6 +53,7 @@
 #define SMB_COM_NT_TRANSACT           0xA0
 #define SMB_COM_NT_TRANSACT_SECONDARY 0xA1
 #define SMB_COM_NT_CREATE_ANDX        0xA2
+#define SMB_COM_NT_CANCEL             0xA4 /* no response */
 #define SMB_COM_NT_RENAME             0xA5 /* trivial response */
 
 /* Transact2 subcommand codes */
index 698cdce..36d45b1 100644 (file)
@@ -4015,6 +4015,22 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
                        (struct smb_hdr *) pSMBr, &bytes_returned, -1);
        if (rc) {
                cFYI(1, ("Error in Notify = %d", rc));
+       } else {
+               /* Add file to outstanding requests */
+               dnotify_req = (struct dir_notify_req *) kmalloc(
+                                               sizeof(struct dir_notify_req), GFP_KERNEL);
+               dnotify_req->Pid = pSMB->hdr.Pid;
+               dnotify_req->PidHigh = pSMB->hdr.PidHigh;
+               dnotify_req->Mid = pSMB->hdr.Mid;
+               dnotify_req->Tid = pSMB->hdr.Tid;
+               dnotify_req->Uid = pSMB->hdr.Uid;
+               dnotify_req->netfid = netfid;
+               dnotify_req->dentry = dentry;
+               dnotify_req->filter = filter;
+               dnotify_req->multishot = multishot;
+               spin_lock(&GlobalMid_Lock);
+               list_add_tail(&dnotify_req->lhead, &GlobalDnotifyReqList);
+               spin_unlock(&GlobalMid_Lock);
        }
        cifs_buf_release(pSMB);
        return rc;