From nobody Sun Feb 8 21:28:02 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 406FA34B438 for ; Mon, 22 Dec 2025 22:31:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766442692; cv=none; b=AQUutZCu8S585dAZ/wQ2a2MfmfB6XhwcVOgT8KgbIJ2PbFCBidxjfwSLdbOYoZLDQiL9/h/RB42TVUsWV2xpdibBsyXW6Dwdcr5HTE1FYStr/7WViZZ2Y143iDAWJ01MaylVdv1WWZl2fkC+TcstTWvAP5yjAjoTJUM/c4AtlXc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766442692; c=relaxed/simple; bh=LeLIq/QHZ44uBDvxiluuFK7hS2uE1G1QrRz3KH3gEvo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AAqgvhMq83d4UgeGUb+0jjjuynv5HzM1GozMCMeutf5FZTDXbUVHL1y0IdhYlpPjcPYnqlRBjbVGNSAdVW0gWlafq4U1OPnza2vRgsX9Te7hcHQQl1ybzKhH441fOpD1vs+hHqWZY6ZoWlVnGHRGwZ1QDt8o0le39jWsNbNvNEg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=EwcgENY5; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EwcgENY5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766442684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CGZgtxmqftJyuRzKpmrt1rXSK3SeIWsuV+CAaik6rSI=; b=EwcgENY5hX6peMNnmxBtbmSKgdzQ917BAXscN75k0JLsi2mkLmOu8UliRAUtw7gT3xVWWH K2eglHr338zbofc/WQ4tAKZXPka/KkgQIJGhj18US/SWCU/nKqIrNAOwIabSaSX0o0u4FN fVGi5xT4PVj4Y8hbsKGTfvKhLumINnY= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-112-IQPp_qo7PkaVJ6D2it_zNQ-1; Mon, 22 Dec 2025 17:31:18 -0500 X-MC-Unique: IQPp_qo7PkaVJ6D2it_zNQ-1 X-Mimecast-MFC-AGG-ID: IQPp_qo7PkaVJ6D2it_zNQ_1766442677 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 58EA318002C1; Mon, 22 Dec 2025 22:31:17 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.4]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 42177180049F; Mon, 22 Dec 2025 22:31:15 +0000 (UTC) From: David Howells To: Steve French Cc: David Howells , Paulo Alcantara , Enzo Matsumiya , linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 21/37] cifs: SMB1 split: Separate out SMB1 decls into smb1proto.h Date: Mon, 22 Dec 2025 22:29:46 +0000 Message-ID: <20251222223006.1075635-22-dhowells@redhat.com> In-Reply-To: <20251222223006.1075635-1-dhowells@redhat.com> References: <20251222223006.1075635-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Separate out SMB1 declarations scriptedly into smb1proto.h. Script below: #!/usr/bin/perl -w use strict; unless (@ARGV) { die "Usage: $0 [ ...]\n"; } # Data tracking my %funcs =3D (); # Func name =3D> { func prototype } my %headers =3D (); # Header filename =3D> { header content } my %c_files =3D (); # C filename =3D> { ordered func list, header pref } my %cmarkers =3D (); # C filename marker =3D> { header filename it's in } # Parse state my $pathname =3D "-"; my $lineno =3D 0; sub error(@) { print STDERR $pathname, ":", $lineno, ": ", @_, "\n"; exit(1); } sub pad($) { # Reindent the function arguments to line the arguments up with the ch= ar # after the opening bracket on the func argument list my ($lines) =3D @_; return $lines if ($#{$lines} <=3D 0); my $has_empty =3D 0; for (my $i =3D 0; $i <=3D $#{$lines}; $i++) { $lines->[$i] =3D~ s/^[ \t]+//; $has_empty =3D 1 if ($lines->[$i] eq ""); } if ($has_empty) { my @clean =3D grep /.+/, @{$lines}; $lines =3D \@clean; } my $indlen =3D index($lines->[0], "("); return $lines if ($indlen < 0); my $indent =3D ""; $indlen++; $indent .=3D "\t" x ($indlen / 8); $indent .=3D " " x ($indlen % 8); my @padded =3D (); my $acc =3D ""; my $len =3D -$indlen; for (my $i =3D 0; $i <=3D $#{$lines}; $i++) { my $argument =3D $lines->[$i]; my $arglen =3D length($argument); my $last =3D ($i =3D=3D $#{$lines} ? 1 : 0); if ($i =3D=3D 0 || $i =3D=3D 1) { $acc .=3D $argument; $acc .=3D ";" if ($last); $len +=3D $arglen + $last; next; } if (!$acc) { $acc =3D $indent . $argument; $acc .=3D ";" if ($last); $len +=3D $arglen + $last; next; } if ($indlen + $len + 1 + $arglen + $last > 79) { push @padded, $acc; $acc =3D $indent . $argument; $acc .=3D ";" if ($last); $len =3D $arglen + $last; next; } $acc .=3D " " . $argument; $acc .=3D ";" if ($last); $len +=3D 1 + $arglen + $last; } push @padded, $acc if ($acc); return \@padded; } sub earliest(@) { my $ret =3D -1; foreach (@_) { $ret =3D $_ if ($ret < 0 || ($_ >=3D 0 && $_ < $ret)); } return $ret; } foreach my $file (@ARGV) { # Open the file for reading. next if $file =3D~ /trace[.]h$/; next if $file =3D~ /smbdirect[.][ch]$/; open my $fh, "<$file" or die "Could not open file '$file'"; $pathname =3D $file; $lineno =3D 0; my $filename; my @file_content =3D (); my @copy =3D (); my $state =3D 0; my $qual =3D ""; my $type =3D ""; my $funcname =3D ""; my @funcdef =3D (); my $bracket =3D 0; my $comment =3D 0; my $smb1 =3D 0; my $header =3D 0; my $inline =3D 0; my $file_marker =3D ""; my $config =3D ""; my $c_file =3D 0; $filename =3D $pathname; $filename =3D~ s!.*/!!; if ($file =3D~ m!.h$!) { my %new_h_file =3D ( path =3D> $pathname, fname =3D> $filename, content =3D> [], ); $header =3D \%new_h_file; $headers{$filename} =3D \%new_h_file; } elsif ($file =3D~ m!.c$!) { my %new_c_file =3D ( path =3D> $pathname, fname =3D> $filename, funcs =3D> [], ); $c_file =3D \%new_c_file; $c_files{$filename} =3D \%new_c_file; } else { warn("Ignoring unexpected file $file\n"); next; } $smb1 =3D 1 if ($file =3D~ m!/smb1ops.c|/cifssmb.c|/cifstransport.c!); foreach my $line (<$fh>) { $lineno++; chomp($line); push @copy, $line; if (!$line) { # Blank line push @file_content, @copy; @copy =3D (); next; } # Handle continuation or end of block comment. Look for C file # prototype insertion point markers. if ($comment) { if ($line =3D~ m![*]/!) { if ($comment =3D=3D 2 && $file_marker) { $cmarkers{$file_marker} =3D $file_marker; push @copy, "#C_MARKER " . $file_marker; $file_marker =3D 0; } $comment =3D 0; } else { $comment++; if ($comment =3D=3D 2 && $line =3D~ m! [*] ([a-z][a-z_0-9]*[.][c])$!) { $file_marker =3D $1; print("Found file marker ", $file_marker, " in ", $filename, "\n"); } } push @file_content, @copy; @copy =3D (); next; } # Check cpp directives, particularly looking for SMB1 bits if ($line =3D~ /^[#]/) { if ($header) { if ($line =3D~ /ifdef.*(CONFIG_[A-Z0-9_])/) { error("multiconfig") if $config; $config =3D $1; $smb1++ if ($config eq "CONFIG_CIFS_ALLOW_INSECURE_LEGACY"); } elsif ($line =3D~ /endif/) { $smb1-- if ($config eq "CONFIG_CIFS_ALLOW_INSECURE_LEGACY"); $config =3D ""; } } push @file_content, @copy; @copy =3D (); next; } # Exclude interference in finding func names and return types if ($line =3D~ /^[{]/ || $line =3D~ /##/ || $line =3D~ /^[_a-z0-9A-Z]+:$/ || # goto label $line =3D~ /^do [{]/ || $line =3D~ m!^//!) { push @file_content, @copy; @copy =3D (); next; } # Start of a block comment if ($line =3D~ m!^/[*]!) { $comment =3D 1 unless ($line =3D~ m![*]/!); push @file_content, @copy; @copy =3D (); next; } # End of a braced section, such as a function implementation if ($line =3D~ /^[}]/) { $type =3D ""; $qual =3D ""; $funcname =3D ""; @funcdef =3D (); push @file_content, @copy; @copy =3D (); next; } if ($line =3D~ /^typedef/) { $type =3D ""; $qual =3D ""; $funcname =3D ""; @funcdef =3D (); push @file_content, @copy; @copy =3D (); next; } # Extract function qualifiers. There may be multiple of these in more # or less any order. Some of them cause the func to be skipped (e.g. inl= ine). if ($line =3D~ /^(static|extern|inline|noinline|noinline_for_stack|__alwa= ys_inline)\W/ || $line =3D~ /^(static|extern|inline|noinline|noinline_for_stack|__alwa= ys_inline)$/) { error("Unexpected qualifier '$1'") if ($state !=3D 0); while ($line =3D~ /^(static|extern|inline|noinline|noinline_for_stack= |__always_inline)\W/ || $line =3D~ /^(static|extern|inline|noinline|noinline_for_stack|__alwa= ys_inline)$/) { $qual .=3D " " if ($qual); $qual .=3D $1; $inline =3D 1 if ($1 eq "inline"); $inline =3D 1 if ($1 eq "__always_inline"); $line =3D substr($line, length($1)); $line =3D~ s/^\s+//; } } if ($state =3D=3D 0) { # Extract what we assume to be the return type if ($line =3D~ /^\s/) { push @file_content, @copy; @copy =3D (); next; } while ($line =3D~ /^(unsigned|signed|bool|char|short|int|long|void|co= nst|volatile|(struct|union|enum)\s+[_a-zA-Z][_a-zA-Z0-9]*|[*]|__init|__exit= |__le16|__le32|__le64|__be16|__be32|__be64)/) { $type .=3D " " if $type; $type .=3D $1; $line =3D substr($line, length($1)); $line =3D~ s/^\s+//; } if ($line =3D~ /^struct [{]/) { # Ignore structure definitions $type =3D ""; $qual =3D ""; $funcname =3D ""; @funcdef =3D (); push @file_content, @copy; @copy =3D (); next; } if (index($line, "=3D") >=3D 0) { # Ignore assignments $type =3D ""; $qual =3D ""; $funcname =3D ""; @funcdef =3D ""; push @file_content, @copy; @copy =3D (); next; } # Try and extract a function's type and name while ($line =3D~ /(^[_a-zA-Z][_a-zA-Z0-9]*)/) { my $name =3D $1; $line =3D substr($line, length($name)); next if ($line =3D~ /^[{]/); $line =3D~ s/^\s+//; my $ch =3D substr($line, 0, 1); last if ($ch eq "[" || $ch eq ";"); # Global variables if ($ch eq "(") { # Found the function name $state =3D 1; $line =3D substr($line, 1); $funcname =3D $name; my $tmp =3D $qual . $type . " " . $funcname . "("; $tmp =3D~ s/[*] /*/; push @funcdef, $tmp; $bracket =3D 1; last; } if ($type) { last if (index($line, ";") >=3D 0 && index($line, "(") =3D=3D -1); error("Unexpected name '$name' after '$type'"); } $type .=3D " " if $type; $type .=3D $name; if ($line =3D~ /^(\s*[*]+)/) { my $ptr =3D $1; $type .=3D $ptr; $line =3D substr($line, length($ptr)); } } } # Try and extract a function's argument list my $from =3D 0; if ($state =3D=3D 1) { while (1) { my $o =3D index($line, "(", $from); my $c =3D index($line, ")", $from); my $m =3D index($line, ",", $from); my $b =3D earliest($o, $c, $m); if ($b < 0) { push @funcdef, $line unless ($line eq ""); last; } my $ch =3D substr($line, $b, 1); # Push the arguments separately on to the list if ($ch eq ",") { push @funcdef, substr($line, 0, $b + 1); $line =3D substr($line, $b + 1); $from =3D 0; } elsif ($ch eq "(") { # Handle brackets in the argument list (e.g. function # pointers) $bracket++; $from =3D $b + 1; } elsif ($ch eq ")") { $bracket--; if ($bracket =3D=3D 0) { push @funcdef, substr($line, 0, $b + 1); $line =3D substr($line, $b + 1); $state =3D 2; last; } $from =3D $b + 1; } } } if ($state =3D=3D 2) { $inline =3D 1 if ($qual =3D~ /inline/); #print("QUAL $qual $type $funcname $inline ", $#funcdef, "\n"); if (!$header && $qual !~ /static/ && $funcname ne "__acquires" && $funcname ne "__releases" && $funcname ne "module_init" && $funcname ne "module_exit" && $funcname ne "module_param" && $funcname ne "module_param_call" && $funcname ne "PROC_FILE_DEFINE" && $funcname !~ /MODULE_/ && $funcname !~ /DEFINE_/) { # Okay, we appear to have a function implementation my $func; my $dup =3D 0; if (exists($funcs{$funcname})) { $func =3D $funcs{$funcname}; if (exists $func->{body}) { print("dup $funcname\n"); $dup =3D 1; } } else { my %new_func =3D ( name =3D> $funcname, cond =3D> "", legacy =3D> 0, ); $func =3D \%new_func; $funcs{$funcname} =3D $func; $func->{body} =3D pad(\@funcdef); } $func->{body} =3D pad(\@funcdef); $func->{legacy} =3D 1 if $smb1; if ($funcname eq "cifs_inval_name_dfs_link_error") { $func->{cond} =3D "#ifdef CONFIG_CIFS_DFS_UPCALL"; } elsif ($funcname eq "cifs_listxattr") { $func->{cond} =3D "#ifdef CONFIG_CIFS_XATTR"; } push @{$c_file->{funcs}}, $func unless $dup; } elsif (!$header || $inline) { # Ignore inline function implementations and other weirdies push @file_content, @copy; } elsif ($header && !$inline) { push @file_content, "#FUNCPROTO " . $funcname; my $func; if (exists($funcs{$funcname})) { $func =3D $funcs{$funcname}; $func->{lineno} =3D $lineno; $func->{pathname} =3D $pathname; } else { my %new_func =3D ( name =3D> $funcname, cond =3D> "", lineno =3D> $lineno, pathname =3D> $pathname, legacy =3D> 0, ); $func =3D \%new_func; $funcs{$funcname} =3D $func; } $func->{legacy} =3D 1 if $smb1; } @funcdef =3D (); $type =3D ""; $qual =3D ""; $funcname =3D ""; $inline =3D 0; $state =3D 0; @copy =3D (); } if ($line =3D~ /;/) { $type =3D ""; $qual =3D ""; $funcname =3D ""; @funcdef =3D (); $state =3D 0; push @file_content, @copy; @copy =3D (); } } close($fh); if ($header) { $header->{content} =3D \@file_content; } } sub write_header($) { my ($header) =3D @_; my $path =3D $header->{path}; my $legacy =3D 0; $legacy =3D 1 if ($path =3D~ m!smb1proto[.]h!); my @output =3D (); foreach my $line (@{$header->{content}}) { if ($line =3D~ "^[#]C_MARKER (.*)") { my $file_marker =3D $cmarkers{$1}; my $c_file =3D $c_files{$file_marker}; print("Found $line\n"); foreach my $func (@{$c_file->{funcs}}) { print("func ", $func->{name}, "\n"); push @output, @{$func->{body}}; } next; } elsif ($line =3D~ "^[#]FUNCPROTO ([_a-zA-Z0-9]+)") { my $funcname =3D $1; my $func =3D $funcs{$funcname}; if (!$func->{body}) { print($func->{pathname}, ":", $func->{lineno}, ": '", $funcname, "' dead prototype\n"); next; } if ($func->{legacy} =3D=3D $legacy) { #push @output, $line; push @output, @{$func->{body}}; } } else { push @output, $line; } } open my $fh, ">$path" or die "Could not open file '$path' for writing"; foreach my $f (@output) { print($fh $f, "\n") or die $path; } close($fh) or die $path; } foreach my $h (keys(%headers)) { write_header($headers{$h}); } Signed-off-by: David Howells cc: Steve French cc: Paulo Alcantara cc: Enzo Matsumiya cc: linux-cifs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-kernel@vger.kernel.org --- fs/smb/client/cifsproto.h | 226 +++----------------------------------- fs/smb/client/fscache.h | 5 + fs/smb/client/smb1proto.h | 201 +++++++++++++++++++++++++++++++++ 3 files changed, 219 insertions(+), 213 deletions(-) diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h index 6454c5847724..b151796b3ba5 100644 --- a/fs/smb/client/cifsproto.h +++ b/fs/smb/client/cifsproto.h @@ -105,23 +105,10 @@ int compound_send_recv(const unsigned int xid, struct= cifs_ses *ses, struct TCP_Server_Info *server, const int flags, const int num_rqst, struct smb_rqst *rqst, int *resp_buf_type, struct kvec *resp_iov); -int SendReceive(const unsigned int xid, struct cifs_ses *ses, - struct smb_hdr *in_buf, unsigned int in_len, - struct smb_hdr *out_buf, int *pbytes_returned, - const int flags); -int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses, - char *in_buf, unsigned int in_len, int flags); int cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server); -struct mid_q_entry *cifs_setup_request(struct cifs_ses *ses, - struct TCP_Server_Info *server, - struct smb_rqst *rqst); -struct mid_q_entry *cifs_setup_async_request(struct TCP_Server_Info *serve= r, - struct smb_rqst *rqst); int __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, struct smb_rqst *rqst); -int cifs_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *se= rver, - bool log_error); int wait_for_free_request(struct TCP_Server_Info *server, const int flags, unsigned int *instance); int cifs_wait_mtu_credits(struct TCP_Server_Info *server, size_t size, @@ -137,9 +124,6 @@ send_cancel(struct cifs_ses *ses, struct TCP_Server_Inf= o *server, } =20 int wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *= mid); -int SendReceive2(const unsigned int xid, struct cifs_ses *ses, - struct kvec *iov, int n_vec, int *resp_buf_type /* ret */, - const int flags, struct kvec *resp_iov); =20 void smb2_query_server_interfaces(struct work_struct *work); void cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server, @@ -178,8 +162,6 @@ int map_and_check_smb_error(struct TCP_Server_Info *ser= ver, unsigned int header_assemble(struct smb_hdr *buffer, char smb_command, const struct cifs_tcon *treeCon, int word_count /* length of fixed section (word count) in two byte units */); -int small_smb_init_no_tc(const int smb_command, const int wct, - struct cifs_ses *ses, void **request_buf); int CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses, struct TCP_Server_Info *server, const struct nls_table *nls_cp); @@ -321,46 +303,15 @@ int cifs_setup_session(const unsigned int xid, struct= cifs_ses *ses, struct nls_table *nls_info); int cifs_enable_signing(struct TCP_Server_Info *server, bool mnt_sign_required); -int CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses, - struct TCP_Server_Info *server); =20 int CIFSTCon(const unsigned int xid, struct cifs_ses *ses, const char *tre= e, struct cifs_tcon *tcon, const struct nls_table *nls_codepage); =20 -int CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon, - const char *searchName, struct cifs_sb_info *cifs_sb, - __u16 *pnetfid, __u16 search_flags, - struct cifs_search_info *psrch_inf, bool msearch); - -int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon, - __u16 searchHandle, __u16 search_flags, - struct cifs_search_info *psrch_inf); - -int CIFSFindClose(const unsigned int xid, struct cifs_tcon *tcon, - const __u16 searchHandle); - -int CIFSSMBQFileInfo(const unsigned int xid, struct cifs_tcon *tcon, - u16 netfid, FILE_ALL_INFO *pFindData); -int CIFSSMBQPathInfo(const unsigned int xid, struct cifs_tcon *tcon, - const char *search_name, FILE_ALL_INFO *data, - int legacy /* old style infolevel */, - const struct nls_table *nls_codepage, int remap); -int SMBQueryInformation(const unsigned int xid, struct cifs_tcon *tcon, - const char *search_name, FILE_ALL_INFO *data, - const struct nls_table *nls_codepage, int remap); - -int CIFSSMBUnixQFileInfo(const unsigned int xid, struct cifs_tcon *tcon, - u16 netfid, FILE_UNIX_BASIC_INFO *pFindData); -int CIFSSMBUnixQPathInfo(const unsigned int xid, struct cifs_tcon *tcon, - const unsigned char *searchName, - FILE_UNIX_BASIC_INFO *pFindData, - const struct nls_table *nls_codepage, int remap); - -int CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses, - const char *search_name, - struct dfs_info3_param **target_nodes, - unsigned int *num_of_nodes, - const struct nls_table *nls_codepage, int remap); + + + + + =20 int parse_dfs_referrals(struct get_dfs_referral_rsp *rsp, u32 rsp_size, unsigned int *num_of_nodes, @@ -370,138 +321,14 @@ int parse_dfs_referrals(struct get_dfs_referral_rsp = *rsp, u32 rsp_size, void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx); -int CIFSSMBQFSInfo(const unsigned int xid, struct cifs_tcon *tcon, - struct kstatfs *FSData); -int SMBOldQFSInfo(const unsigned int xid, struct cifs_tcon *tcon, - struct kstatfs *FSData); -int CIFSSMBSetFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon, - __u64 cap); - -int CIFSSMBQFSAttributeInfo(const unsigned int xid, struct cifs_tcon *tcon= ); -int CIFSSMBQFSDeviceInfo(const unsigned int xid, struct cifs_tcon *tcon); -int CIFSSMBQFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon); -int CIFSSMBQFSPosixInfo(const unsigned int xid, struct cifs_tcon *tcon, - struct kstatfs *FSData); - -int SMBSetInformation(const unsigned int xid, struct cifs_tcon *tcon, - const char *fileName, __le32 attributes, - __le64 write_time, const struct nls_table *nls_codepage, - struct cifs_sb_info *cifs_sb); -int CIFSSMBSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon, - const char *fileName, const FILE_BASIC_INFO *data, - const struct nls_table *nls_codepage, - struct cifs_sb_info *cifs_sb); -int CIFSSMBSetFileInfo(const unsigned int xid, struct cifs_tcon *tcon, - const FILE_BASIC_INFO *data, __u16 fid, - __u32 pid_of_opener); -int CIFSSMBSetFileDisposition(const unsigned int xid, struct cifs_tcon *tc= on, - bool delete_file, __u16 fid, - __u32 pid_of_opener); -int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, - const char *file_name, __u64 size, - struct cifs_sb_info *cifs_sb, bool set_allocation, - struct dentry *dentry); -int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, - struct cifsFileInfo *cfile, __u64 size, - bool set_allocation); - -int CIFSSMBUnixSetFileInfo(const unsigned int xid, struct cifs_tcon *tcon, - const struct cifs_unix_set_info_args *args, u16 fid, - u32 pid_of_opener); - -int CIFSSMBUnixSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon, - const char *file_name, - const struct cifs_unix_set_info_args *args, - const struct nls_table *nls_codepage, int remap); - -int CIFSSMBMkDir(const unsigned int xid, struct inode *inode, umode_t mode, - struct cifs_tcon *tcon, const char *name, - struct cifs_sb_info *cifs_sb); -int CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon, - const char *name, struct cifs_sb_info *cifs_sb); -int CIFSPOSIXDelFile(const unsigned int xid, struct cifs_tcon *tcon, - const char *fileName, __u16 type, - const struct nls_table *nls_codepage, int remap); -int CIFSSMBDelFile(const unsigned int xid, struct cifs_tcon *tcon, - const char *name, struct cifs_sb_info *cifs_sb, - struct dentry *dentry); -int CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon, - struct dentry *source_dentry, const char *from_name, - const char *to_name, struct cifs_sb_info *cifs_sb); -int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon, - int netfid, const char *target_name, - const struct nls_table *nls_codepage, int remap); -int CIFSCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon, - struct dentry *source_dentry, const char *from_name, - const char *to_name, struct cifs_sb_info *cifs_sb); -int CIFSUnixCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon, - const char *fromName, const char *toName, - const struct nls_table *nls_codepage, int remap); -int CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon, - const char *fromName, const char *toName, - const struct nls_table *nls_codepage, int remap); -int CIFSSMBUnixQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon, - const unsigned char *searchName, - char **symlinkinfo, - const struct nls_table *nls_codepage, int remap); -int cifs_query_reparse_point(const unsigned int xid, struct cifs_tcon *tco= n, - struct cifs_sb_info *cifs_sb, - const char *full_path, u32 *tag, struct kvec *rsp, - int *rsp_buftype); -struct inode *cifs_create_reparse_inode(struct cifs_open_info_data *data, - struct super_block *sb, - const unsigned int xid, - struct cifs_tcon *tcon, - const char *full_path, bool directory, - struct kvec *reparse_iov, - struct kvec *xattr_iov); -int CIFSSMB_set_compression(const unsigned int xid, struct cifs_tcon *tcon, - __u16 fid); -int CIFS_open(const unsigned int xid, struct cifs_open_parms *oparms, - int *oplock, FILE_ALL_INFO *buf); -int SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon, - const char *fileName, const int openDisposition, - const int access_flags, const int create_options, - __u16 *netfid, int *pOplock, FILE_ALL_INFO *pfile_info, - const struct nls_table *nls_codepage, int remap); -int CIFSPOSIXCreate(const unsigned int xid, struct cifs_tcon *tcon, - __u32 posix_flags, __u64 mode, __u16 *netfid, - FILE_UNIX_BASIC_INFO *pRetData, __u32 *pOplock, - const char *name, const struct nls_table *nls_codepage, - int remap); -int CIFSSMBClose(const unsigned int xid, struct cifs_tcon *tcon, - int smb_file_id); - -int CIFSSMBFlush(const unsigned int xid, struct cifs_tcon *tcon, - int smb_file_id); - -int CIFSSMBRead(const unsigned int xid, struct cifs_io_parms *io_parms, - unsigned int *nbytes, char **buf, int *pbuf_type); -int CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms, - unsigned int *nbytes, const char *buf); -int CIFSSMBWrite2(const unsigned int xid, struct cifs_io_parms *io_parms, - unsigned int *nbytes, struct kvec *iov, int n_vec); -int CIFSGetSrvInodeNumber(const unsigned int xid, struct cifs_tcon *tcon, - const char *search_name, __u64 *inode_number, - const struct nls_table *nls_codepage, int remap); - -int cifs_lockv(const unsigned int xid, struct cifs_tcon *tcon, - const __u16 netfid, const __u8 lock_type, - const __u32 num_unlock, const __u32 num_lock, - LOCKING_ANDX_RANGE *buf); -int CIFSSMBLock(const unsigned int xid, struct cifs_tcon *tcon, - const __u16 smb_file_id, const __u32 netpid, const __u64 len, - const __u64 offset, const __u32 numUnlock, const __u32 numLock, - const __u8 lockType, const bool waitFlag, - const __u8 oplock_level); -int CIFSSMBPosixLock(const unsigned int xid, struct cifs_tcon *tcon, - const __u16 smb_file_id, const __u32 netpid, - const loff_t start_offset, const __u64 len, - struct file_lock *pLockData, const __u16 lock_type, - const bool waitFlag); -int CIFSSMBTDis(const unsigned int xid, struct cifs_tcon *tcon); -int CIFSSMBEcho(struct TCP_Server_Info *server); -int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses); + + + + + + + + =20 struct cifs_ses *sesInfoAlloc(void); void sesInfoFree(struct cifs_ses *buf_to_free); @@ -523,31 +350,6 @@ int generate_smb311signingkey(struct cifs_ses *ses, struct TCP_Server_Info *server); =20 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY -ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon, - const unsigned char *searchName, - const unsigned char *ea_name, char *EAData, - size_t buf_size, struct cifs_sb_info *cifs_sb); -int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon, - const char *fileName, const char *ea_name, - const void *ea_value, const __u16 ea_value_len, - const struct nls_table *nls_codepage, - struct cifs_sb_info *cifs_sb); -int CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, - __u16 fid, struct smb_ntsd **acl_inf, __u32 *pbuflen, - __u32 info); -int CIFSSMBSetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, - __u16 fid, struct smb_ntsd *pntsd, __u32 acllen, - int aclflag); -int cifs_do_get_acl(const unsigned int xid, struct cifs_tcon *tcon, - const unsigned char *searchName, struct posix_acl **acl, - const int acl_type, const struct nls_table *nls_codepage, - int remap); -int cifs_do_set_acl(const unsigned int xid, struct cifs_tcon *tcon, - const unsigned char *fileName, const struct posix_acl *acl, - const int acl_type, const struct nls_table *nls_codepage, - int remap); -int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon, - const int netfid, __u64 *pExtAttrBits, __u64 *pMask); #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */ void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb); bool couldbe_mf_symlink(const struct cifs_fattr *fattr); @@ -566,11 +368,9 @@ void __cifs_put_smb_ses(struct cifs_ses *ses); struct cifs_ses *cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx); =20 -int cifs_async_readv(struct cifs_io_subrequest *rdata); int cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid); =20 -void cifs_async_writev(struct cifs_io_subrequest *wdata); int cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, struct cifs_sb_info *cifs_sb, const unsigned char *path, char *pbuf, diff --git a/fs/smb/client/fscache.h b/fs/smb/client/fscache.h index b6c94db5edb9..3521222886c1 100644 --- a/fs/smb/client/fscache.h +++ b/fs/smb/client/fscache.h @@ -40,6 +40,11 @@ struct cifs_fscache_inode_coherency_data { */ int cifs_fscache_get_super_cookie(struct cifs_tcon *tcon); void cifs_fscache_release_super_cookie(struct cifs_tcon *tcon); +void cifs_fscache_get_inode_cookie(struct inode *inode); +void cifs_fscache_unuse_inode_cookie(struct inode *inode, bool update); +void cifs_fscache_release_inode_cookie(struct inode *inode); +int cifs_fscache_get_super_cookie(struct cifs_tcon *tcon); +void cifs_fscache_release_super_cookie(struct cifs_tcon *tcon); =20 void cifs_fscache_get_inode_cookie(struct inode *inode); void cifs_fscache_release_inode_cookie(struct inode *inode); diff --git a/fs/smb/client/smb1proto.h b/fs/smb/client/smb1proto.h index 0088edbcc73f..1fd4fd0bbb7a 100644 --- a/fs/smb/client/smb1proto.h +++ b/fs/smb/client/smb1proto.h @@ -23,6 +23,190 @@ struct cifs_unix_set_info_args { /* * cifssmb.c */ +int small_smb_init_no_tc(const int smb_command, const int wct, + struct cifs_ses *ses, void **request_buf); +int CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses, + struct TCP_Server_Info *server); +int CIFSSMBTDis(const unsigned int xid, struct cifs_tcon *tcon); +int CIFSSMBEcho(struct TCP_Server_Info *server); +int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses); +int CIFSPOSIXDelFile(const unsigned int xid, struct cifs_tcon *tcon, + const char *fileName, __u16 type, + const struct nls_table *nls_codepage, int remap); +int CIFSSMBDelFile(const unsigned int xid, struct cifs_tcon *tcon, + const char *name, struct cifs_sb_info *cifs_sb, + struct dentry *dentry); +int CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon, + const char *name, struct cifs_sb_info *cifs_sb); +int CIFSSMBMkDir(const unsigned int xid, struct inode *inode, umode_t mode, + struct cifs_tcon *tcon, const char *name, + struct cifs_sb_info *cifs_sb); +int CIFSPOSIXCreate(const unsigned int xid, struct cifs_tcon *tcon, + __u32 posix_flags, __u64 mode, __u16 *netfid, + FILE_UNIX_BASIC_INFO *pRetData, __u32 *pOplock, + const char *name, const struct nls_table *nls_codepage, + int remap); +int SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon, + const char *fileName, const int openDisposition, + const int access_flags, const int create_options, + __u16 *netfid, int *pOplock, FILE_ALL_INFO *pfile_info, + const struct nls_table *nls_codepage, int remap); +int CIFS_open(const unsigned int xid, struct cifs_open_parms *oparms, + int *oplock, FILE_ALL_INFO *buf); +int cifs_async_readv(struct cifs_io_subrequest *rdata); +int CIFSSMBRead(const unsigned int xid, struct cifs_io_parms *io_parms, + unsigned int *nbytes, char **buf, int *pbuf_type); +int CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms, + unsigned int *nbytes, const char *buf); +void cifs_async_writev(struct cifs_io_subrequest *wdata); +int CIFSSMBWrite2(const unsigned int xid, struct cifs_io_parms *io_parms, + unsigned int *nbytes, struct kvec *iov, int n_vec); +int cifs_lockv(const unsigned int xid, struct cifs_tcon *tcon, + const __u16 netfid, const __u8 lock_type, + const __u32 num_unlock, const __u32 num_lock, + LOCKING_ANDX_RANGE *buf); +int CIFSSMBLock(const unsigned int xid, struct cifs_tcon *tcon, + const __u16 smb_file_id, const __u32 netpid, const __u64 len, + const __u64 offset, const __u32 numUnlock, const __u32 numLock, + const __u8 lockType, const bool waitFlag, + const __u8 oplock_level); +int CIFSSMBPosixLock(const unsigned int xid, struct cifs_tcon *tcon, + const __u16 smb_file_id, const __u32 netpid, + const loff_t start_offset, const __u64 len, + struct file_lock *pLockData, const __u16 lock_type, + const bool waitFlag); +int CIFSSMBClose(const unsigned int xid, struct cifs_tcon *tcon, + int smb_file_id); +int CIFSSMBFlush(const unsigned int xid, struct cifs_tcon *tcon, + int smb_file_id); +int CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon, + struct dentry *source_dentry, const char *from_name, + const char *to_name, struct cifs_sb_info *cifs_sb); +int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon, + int netfid, const char *target_name, + const struct nls_table *nls_codepage, int remap); +int CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon, + const char *fromName, const char *toName, + const struct nls_table *nls_codepage, int remap); +int CIFSUnixCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon, + const char *fromName, const char *toName, + const struct nls_table *nls_codepage, int remap); +int CIFSCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon, + struct dentry *source_dentry, const char *from_name, + const char *to_name, struct cifs_sb_info *cifs_sb); +int CIFSSMBUnixQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon, + const unsigned char *searchName, + char **symlinkinfo, + const struct nls_table *nls_codepage, int remap); +int cifs_query_reparse_point(const unsigned int xid, struct cifs_tcon *tco= n, + struct cifs_sb_info *cifs_sb, + const char *full_path, u32 *tag, struct kvec *rsp, + int *rsp_buftype); +struct inode *cifs_create_reparse_inode(struct cifs_open_info_data *data, + struct super_block *sb, + const unsigned int xid, + struct cifs_tcon *tcon, + const char *full_path, bool directory, + struct kvec *reparse_iov, + struct kvec *xattr_iov); +int CIFSSMB_set_compression(const unsigned int xid, struct cifs_tcon *tcon, + __u16 fid); +int cifs_do_get_acl(const unsigned int xid, struct cifs_tcon *tcon, + const unsigned char *searchName, struct posix_acl **acl, + const int acl_type, const struct nls_table *nls_codepage, + int remap); +int cifs_do_set_acl(const unsigned int xid, struct cifs_tcon *tcon, + const unsigned char *fileName, const struct posix_acl *acl, + const int acl_type, const struct nls_table *nls_codepage, + int remap); +int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon, + const int netfid, __u64 *pExtAttrBits, __u64 *pMask); +int CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, + __u16 fid, struct smb_ntsd **acl_inf, __u32 *pbuflen, + __u32 info); +int CIFSSMBSetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, + __u16 fid, struct smb_ntsd *pntsd, __u32 acllen, + int aclflag); +int SMBQueryInformation(const unsigned int xid, struct cifs_tcon *tcon, + const char *search_name, FILE_ALL_INFO *data, + const struct nls_table *nls_codepage, int remap); +int CIFSSMBQFileInfo(const unsigned int xid, struct cifs_tcon *tcon, + u16 netfid, FILE_ALL_INFO *pFindData); +int CIFSSMBQPathInfo(const unsigned int xid, struct cifs_tcon *tcon, + const char *search_name, FILE_ALL_INFO *data, + int legacy /* old style infolevel */, + const struct nls_table *nls_codepage, int remap); +int CIFSSMBUnixQFileInfo(const unsigned int xid, struct cifs_tcon *tcon, + u16 netfid, FILE_UNIX_BASIC_INFO *pFindData); +int CIFSSMBUnixQPathInfo(const unsigned int xid, struct cifs_tcon *tcon, + const unsigned char *searchName, + FILE_UNIX_BASIC_INFO *pFindData, + const struct nls_table *nls_codepage, int remap); +int CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon, + const char *searchName, struct cifs_sb_info *cifs_sb, + __u16 *pnetfid, __u16 search_flags, + struct cifs_search_info *psrch_inf, bool msearch); +int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon, + __u16 searchHandle, __u16 search_flags, + struct cifs_search_info *psrch_inf); +int CIFSFindClose(const unsigned int xid, struct cifs_tcon *tcon, + const __u16 searchHandle); +int CIFSGetSrvInodeNumber(const unsigned int xid, struct cifs_tcon *tcon, + const char *search_name, __u64 *inode_number, + const struct nls_table *nls_codepage, int remap); +int CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses, + const char *search_name, + struct dfs_info3_param **target_nodes, + unsigned int *num_of_nodes, + const struct nls_table *nls_codepage, int remap); +int SMBOldQFSInfo(const unsigned int xid, struct cifs_tcon *tcon, + struct kstatfs *FSData); +int CIFSSMBQFSInfo(const unsigned int xid, struct cifs_tcon *tcon, + struct kstatfs *FSData); +int CIFSSMBQFSAttributeInfo(const unsigned int xid, struct cifs_tcon *tcon= ); +int CIFSSMBQFSDeviceInfo(const unsigned int xid, struct cifs_tcon *tcon); +int CIFSSMBQFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon); +int CIFSSMBSetFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon, + __u64 cap); +int CIFSSMBQFSPosixInfo(const unsigned int xid, struct cifs_tcon *tcon, + struct kstatfs *FSData); +int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, + const char *file_name, __u64 size, + struct cifs_sb_info *cifs_sb, bool set_allocation, + struct dentry *dentry); +int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, + struct cifsFileInfo *cfile, __u64 size, + bool set_allocation); +int SMBSetInformation(const unsigned int xid, struct cifs_tcon *tcon, + const char *fileName, __le32 attributes, + __le64 write_time, const struct nls_table *nls_codepage, + struct cifs_sb_info *cifs_sb); +int CIFSSMBSetFileInfo(const unsigned int xid, struct cifs_tcon *tcon, + const FILE_BASIC_INFO *data, __u16 fid, + __u32 pid_of_opener); +int CIFSSMBSetFileDisposition(const unsigned int xid, struct cifs_tcon *tc= on, + bool delete_file, __u16 fid, + __u32 pid_of_opener); +int CIFSSMBSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon, + const char *fileName, const FILE_BASIC_INFO *data, + const struct nls_table *nls_codepage, + struct cifs_sb_info *cifs_sb); +int CIFSSMBUnixSetFileInfo(const unsigned int xid, struct cifs_tcon *tcon, + const struct cifs_unix_set_info_args *args, u16 fid, + u32 pid_of_opener); +int CIFSSMBUnixSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon, + const char *file_name, + const struct cifs_unix_set_info_args *args, + const struct nls_table *nls_codepage, int remap); +ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon, + const unsigned char *searchName, + const unsigned char *ea_name, char *EAData, + size_t buf_size, struct cifs_sb_info *cifs_sb); +int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon, + const char *fileName, const char *ea_name, + const void *ea_value, const __u16 ea_value_len, + const struct nls_table *nls_codepage, + struct cifs_sb_info *cifs_sb); =20 /* * smb1ops.c @@ -33,6 +217,23 @@ extern struct smb_version_values smb1_values; /* * smb1transport.c */ +struct mid_q_entry *cifs_setup_async_request(struct TCP_Server_Info *serve= r, + struct smb_rqst *rqst); +int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses, + char *in_buf, unsigned int in_len, int flags); +int cifs_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *se= rver, + bool log_error); +struct mid_q_entry *cifs_setup_request(struct cifs_ses *ses, + struct TCP_Server_Info *server, + struct smb_rqst *rqst); +int SendReceive2(const unsigned int xid, struct cifs_ses *ses, + struct kvec *iov, int n_vec, int *resp_buf_type /* ret */, + const int flags, struct kvec *resp_iov); +int SendReceive(const unsigned int xid, struct cifs_ses *ses, + struct smb_hdr *in_buf, unsigned int in_len, + struct smb_hdr *out_buf, int *pbytes_returned, + const int flags); + =20 #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */ #endif /* _SMB1PROTO_H */