Re: [PATCH 03/16] CIFS: Check for SMB2 vs CIFS in find_tcp_session

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

 



On Sun, 6 May 2012 10:01:29 -0400
Jeff Layton <jlayton@xxxxxxxxxx> wrote:


> >  
> > +#ifdef CONFIG_CIFS_SMB2
> > +	if (volume_info->use_smb2)
> > +		tcp_ses->is_smb2 = true;
> > +#endif /* CONFIG_CIFS_SMB2 */
> > +
> 
> The above should instead set a pointer to a "struct
> protocol_operations" or something. That struct could have a version
> field within it and it would give you a mechanism to allow for
> protocol-version specific behavior without resorting to sprinkling
> "is_smb2" checks all over the code.
> 

Steve had some confusion about the above statement, so I've hacked out
a small patchset to demonstrate what I'm been talking about. It's in
the "smb2-ops" branch of my git tree if you'd like to take a look.

http://git.samba.org/?p=jlayton/linux.git;a=shortlog;h=refs/heads/smb2-ops

The basic idea is to declare a smb_version_operations struct for each
ver= option that we want to support, and then set a pointer to that in
the TCP_Server_Info. We'll then have fields in there that are smb
version specific. Some might be populated in every one (like the
version_string field). Others not, (like the send_cancel function). In
the cases where they're not, the caller will need to deal with it.

In any case, this allows us to add SMB2 support without sprinkling
"is_smb2" checks all over the place, and more importantly gets rid of
the #ifdefs inside most of the code too. Whereever you have a "is_smb2"
check wrapped inside an ifdef now, you'd add a new ops vector to this
struct and populate it accordingly.

Thoughts?
-- 
Jeff Layton <jlayton@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux