diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-10-19 15:29:49 -0400 |
---|---|---|
committer | Jeff Layton <jlayton@redhat.com> | 2011-10-19 15:29:49 -0400 |
commit | 44d22d846fdc7c3e688fc1ff5ae6d06d08bb5656 (patch) | |
tree | a7c55381c4eee74c2be9a4dc0728f0a927367d04 /fs/cifs/cifsglob.h | |
parent | e9097ab48978c89b9c0926e2ae5d49bf6ea91b18 (diff) |
cifs: add a callback function to receive the rest of the frame
In order to handle larger SMBs for readpages and other calls, we want
to be able to read into a preallocated set of buffers. Rather than
changing all of the existing code to preallocate buffers however, we
instead add a receive callback function to the MID.
cifsd will call this function once the mid_q_entry has been identified
in order to receive the rest of the SMB. If the mid can't be identified
or the receive pointer is unset, then the standard 3rd phase receive
function will be called.
Reviewed-and-Tested-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r-- | fs/cifs/cifsglob.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index a73dd1d5e7ef..d153d0b89d39 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -656,8 +656,24 @@ static inline void cifs_stats_bytes_read(struct cifs_tcon *tcon, | |||
656 | struct mid_q_entry; | 656 | struct mid_q_entry; |
657 | 657 | ||
658 | /* | 658 | /* |
659 | * This is the prototype for the mid callback function. When creating one, | 659 | * This is the prototype for the mid receive function. This function is for |
660 | * take special care to avoid deadlocks. Things to bear in mind: | 660 | * receiving the rest of the SMB frame, starting with the WordCount (which is |
661 | * just after the MID in struct smb_hdr). Note: | ||
662 | * | ||
663 | * - This will be called by cifsd, with no locks held. | ||
664 | * - The mid will still be on the pending_mid_q. | ||
665 | * - mid->resp_buf will point to the current buffer. | ||
666 | * | ||
667 | * Returns zero on a successful receive, or an error. The receive state in | ||
668 | * the TCP_Server_Info will also be updated. | ||
669 | */ | ||
670 | typedef int (mid_receive_t)(struct TCP_Server_Info *server, | ||
671 | struct mid_q_entry *mid); | ||
672 | |||
673 | /* | ||
674 | * This is the prototype for the mid callback function. This is called once the | ||
675 | * mid has been received off of the socket. When creating one, take special | ||
676 | * care to avoid deadlocks. Things to bear in mind: | ||
661 | * | 677 | * |
662 | * - it will be called by cifsd, with no locks held | 678 | * - it will be called by cifsd, with no locks held |
663 | * - the mid will be removed from any lists | 679 | * - the mid will be removed from any lists |
@@ -675,9 +691,10 @@ struct mid_q_entry { | |||
675 | unsigned long when_sent; /* time when smb send finished */ | 691 | unsigned long when_sent; /* time when smb send finished */ |
676 | unsigned long when_received; /* when demux complete (taken off wire) */ | 692 | unsigned long when_received; /* when demux complete (taken off wire) */ |
677 | #endif | 693 | #endif |
694 | mid_receive_t *receive; /* call receive callback */ | ||
678 | mid_callback_t *callback; /* call completion callback */ | 695 | mid_callback_t *callback; /* call completion callback */ |
679 | void *callback_data; /* general purpose pointer for callback */ | 696 | void *callback_data; /* general purpose pointer for callback */ |
680 | struct smb_hdr *resp_buf; /* response buffer */ | 697 | struct smb_hdr *resp_buf; /* pointer to received SMB header */ |
681 | int midState; /* wish this were enum but can not pass to wait_event */ | 698 | int midState; /* wish this were enum but can not pass to wait_event */ |
682 | __u8 command; /* smb command code */ | 699 | __u8 command; /* smb command code */ |
683 | bool largeBuf:1; /* if valid response, is pointer to large buf */ | 700 | bool largeBuf:1; /* if valid response, is pointer to large buf */ |