Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci-2.6.23
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci-2.6.23
Commits
79a58d1f
Commit
79a58d1f
authored
Jul 06, 2007
by
Steve French
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CIFS] whitespace cleanup
checkpatch.pl redux Signed-off-by:
Steve French
<
sfrench@us.ibm.com
>
parent
d20acd09
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
232 additions
and
228 deletions
+232
-228
fs/cifs/smberr.h
fs/cifs/smberr.h
+4
-4
fs/cifs/transport.c
fs/cifs/transport.c
+113
-113
fs/cifs/xattr.c
fs/cifs/xattr.c
+115
-111
No files found.
fs/cifs/smberr.h
View file @
79a58d1f
fs/cifs/transport.c
View file @
79a58d1f
/*
/*
* fs/cifs/transport.c
* fs/cifs/transport.c
*
*
* Copyright (C) International Business Machines Corp., 2002,200
5
* Copyright (C) International Business Machines Corp., 2002,200
7
* Author(s): Steve French (sfrench@us.ibm.com)
* Author(s): Steve French (sfrench@us.ibm.com)
* Jeremy Allison (jra@samba.org) 2006.
* Jeremy Allison (jra@samba.org) 2006.
*
*
...
@@ -86,7 +86,7 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
...
@@ -86,7 +86,7 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
list_del
(
&
midEntry
->
qhead
);
list_del
(
&
midEntry
->
qhead
);
atomic_dec
(
&
midCount
);
atomic_dec
(
&
midCount
);
spin_unlock
(
&
GlobalMid_Lock
);
spin_unlock
(
&
GlobalMid_Lock
);
if
(
midEntry
->
largeBuf
)
if
(
midEntry
->
largeBuf
)
cifs_buf_release
(
midEntry
->
resp_buf
);
cifs_buf_release
(
midEntry
->
resp_buf
);
else
else
cifs_small_buf_release
(
midEntry
->
resp_buf
);
cifs_small_buf_release
(
midEntry
->
resp_buf
);
...
@@ -94,8 +94,8 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
...
@@ -94,8 +94,8 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
now
=
jiffies
;
now
=
jiffies
;
/* commands taking longer than one second are indications that
/* commands taking longer than one second are indications that
something is wrong, unless it is quite a slow link or server */
something is wrong, unless it is quite a slow link or server */
if
((
now
-
midEntry
->
when_alloc
)
>
HZ
)
{
if
((
now
-
midEntry
->
when_alloc
)
>
HZ
)
{
if
((
cifsFYI
&
CIFS_TIMER
)
&&
if
((
cifsFYI
&
CIFS_TIMER
)
&&
(
midEntry
->
command
!=
SMB_COM_LOCKING_ANDX
))
{
(
midEntry
->
command
!=
SMB_COM_LOCKING_ANDX
))
{
printk
(
KERN_DEBUG
" CIFS slow rsp: cmd %d mid %d"
,
printk
(
KERN_DEBUG
" CIFS slow rsp: cmd %d mid %d"
,
midEntry
->
command
,
midEntry
->
mid
);
midEntry
->
command
,
midEntry
->
mid
);
...
@@ -110,10 +110,10 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
...
@@ -110,10 +110,10 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
}
}
struct
oplock_q_entry
*
struct
oplock_q_entry
*
AllocOplockQEntry
(
struct
inode
*
pinode
,
__u16
fid
,
struct
cifsTconInfo
*
tcon
)
AllocOplockQEntry
(
struct
inode
*
pinode
,
__u16
fid
,
struct
cifsTconInfo
*
tcon
)
{
{
struct
oplock_q_entry
*
temp
;
struct
oplock_q_entry
*
temp
;
if
((
pinode
==
NULL
)
||
(
tcon
==
NULL
))
{
if
((
pinode
==
NULL
)
||
(
tcon
==
NULL
))
{
cERROR
(
1
,
(
"Null parms passed to AllocOplockQEntry"
));
cERROR
(
1
,
(
"Null parms passed to AllocOplockQEntry"
));
return
NULL
;
return
NULL
;
}
}
...
@@ -133,7 +133,7 @@ AllocOplockQEntry(struct inode * pinode, __u16 fid, struct cifsTconInfo * tcon)
...
@@ -133,7 +133,7 @@ AllocOplockQEntry(struct inode * pinode, __u16 fid, struct cifsTconInfo * tcon)
}
}
void
DeleteOplockQEntry
(
struct
oplock_q_entry
*
oplockEntry
)
void
DeleteOplockQEntry
(
struct
oplock_q_entry
*
oplockEntry
)
{
{
spin_lock
(
&
GlobalMid_Lock
);
spin_lock
(
&
GlobalMid_Lock
);
/* should we check if list empty first? */
/* should we check if list empty first? */
...
@@ -152,7 +152,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
...
@@ -152,7 +152,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
struct
kvec
iov
;
struct
kvec
iov
;
unsigned
len
=
smb_buf_length
+
4
;
unsigned
len
=
smb_buf_length
+
4
;
if
(
ssocket
==
NULL
)
if
(
ssocket
==
NULL
)
return
-
ENOTSOCK
;
/* BB eventually add reconnect code here */
return
-
ENOTSOCK
;
/* BB eventually add reconnect code here */
iov
.
iov_base
=
smb_buffer
;
iov
.
iov_base
=
smb_buffer
;
iov
.
iov_len
=
len
;
iov
.
iov_len
=
len
;
...
@@ -179,7 +179,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
...
@@ -179,7 +179,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
/* smaller timeout here than send2 since smaller size */
/* smaller timeout here than send2 since smaller size */
/* Although it may not be required, this also is smaller
/* Although it may not be required, this also is smaller
oplock break time */
oplock break time */
if
(
i
>
12
)
{
if
(
i
>
12
)
{
cERROR
(
1
,
cERROR
(
1
,
(
"sends on sock %p stuck for 7 seconds"
,
(
"sends on sock %p stuck for 7 seconds"
,
ssocket
));
ssocket
));
...
@@ -199,7 +199,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
...
@@ -199,7 +199,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
}
}
if
(
rc
<
0
)
{
if
(
rc
<
0
)
{
cERROR
(
1
,(
"Error %d sending data on socket to server"
,
rc
));
cERROR
(
1
,
(
"Error %d sending data on socket to server"
,
rc
));
}
else
{
}
else
{
rc
=
0
;
rc
=
0
;
}
}
...
@@ -224,7 +224,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
...
@@ -224,7 +224,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
int
first_vec
=
0
;
int
first_vec
=
0
;
unsigned
int
smb_buf_length
=
smb_buffer
->
smb_buf_length
;
unsigned
int
smb_buf_length
=
smb_buffer
->
smb_buf_length
;
if
(
ssocket
==
NULL
)
if
(
ssocket
==
NULL
)
return
-
ENOTSOCK
;
/* BB eventually add reconnect code here */
return
-
ENOTSOCK
;
/* BB eventually add reconnect code here */
smb_msg
.
msg_name
=
sin
;
smb_msg
.
msg_name
=
sin
;
...
@@ -252,7 +252,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
...
@@ -252,7 +252,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
n_vec
-
first_vec
,
total_len
);
n_vec
-
first_vec
,
total_len
);
if
((
rc
==
-
ENOSPC
)
||
(
rc
==
-
EAGAIN
))
{
if
((
rc
==
-
ENOSPC
)
||
(
rc
==
-
EAGAIN
))
{
i
++
;
i
++
;
if
(
i
>=
14
)
{
if
(
i
>=
14
)
{
cERROR
(
1
,
cERROR
(
1
,
(
"sends on sock %p stuck for 15 seconds"
,
(
"sends on sock %p stuck for 15 seconds"
,
ssocket
));
ssocket
));
...
@@ -269,10 +269,10 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
...
@@ -269,10 +269,10 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
WARN_ON
(
rc
>
total_len
);
WARN_ON
(
rc
>
total_len
);
break
;
break
;
}
}
if
(
rc
==
0
)
{
if
(
rc
==
0
)
{
/* should never happen, letting socket clear before
/* should never happen, letting socket clear before
retrying is our only obvious option here */
retrying is our only obvious option here */
cERROR
(
1
,(
"tcp sent no data"
));
cERROR
(
1
,
(
"tcp sent no data"
));
msleep
(
500
);
msleep
(
500
);
continue
;
continue
;
}
}
...
@@ -295,7 +295,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
...
@@ -295,7 +295,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
}
}
if
(
rc
<
0
)
{
if
(
rc
<
0
)
{
cERROR
(
1
,(
"Error %d sending data on socket to server"
,
rc
));
cERROR
(
1
,
(
"Error %d sending data on socket to server"
,
rc
));
}
else
}
else
rc
=
0
;
rc
=
0
;
...
@@ -308,13 +308,13 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
...
@@ -308,13 +308,13 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
static
int
wait_for_free_request
(
struct
cifsSesInfo
*
ses
,
const
int
long_op
)
static
int
wait_for_free_request
(
struct
cifsSesInfo
*
ses
,
const
int
long_op
)
{
{
if
(
long_op
==
-
1
)
{
if
(
long_op
==
-
1
)
{
/* oplock breaks must not be held up */
/* oplock breaks must not be held up */
atomic_inc
(
&
ses
->
server
->
inFlight
);
atomic_inc
(
&
ses
->
server
->
inFlight
);
}
else
{
}
else
{
spin_lock
(
&
GlobalMid_Lock
);
spin_lock
(
&
GlobalMid_Lock
);
while
(
1
)
{
while
(
1
)
{
if
(
atomic_read
(
&
ses
->
server
->
inFlight
)
>=
if
(
atomic_read
(
&
ses
->
server
->
inFlight
)
>=
cifs_max_pending
){
cifs_max_pending
){
spin_unlock
(
&
GlobalMid_Lock
);
spin_unlock
(
&
GlobalMid_Lock
);
#ifdef CONFIG_CIFS_STATS2
#ifdef CONFIG_CIFS_STATS2
...
@@ -328,13 +328,13 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
...
@@ -328,13 +328,13 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
#endif
#endif
spin_lock
(
&
GlobalMid_Lock
);
spin_lock
(
&
GlobalMid_Lock
);
}
else
{
}
else
{
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
{
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
{
spin_unlock
(
&
GlobalMid_Lock
);
spin_unlock
(
&
GlobalMid_Lock
);
return
-
ENOENT
;
return
-
ENOENT
;
}
}
/* can not count locking commands against total
since
/* can not count locking commands against total
they are allowed to block on server */
as
they are allowed to block on server */
/* update # of requests on the wire to server */
/* update # of requests on the wire to server */
if
(
long_op
<
3
)
if
(
long_op
<
3
)
...
@@ -353,11 +353,11 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf,
...
@@ -353,11 +353,11 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf,
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
{
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
{
return
-
ENOENT
;
return
-
ENOENT
;
}
else
if
(
ses
->
server
->
tcpStatus
==
CifsNeedReconnect
)
{
}
else
if
(
ses
->
server
->
tcpStatus
==
CifsNeedReconnect
)
{
cFYI
(
1
,(
"tcp session dead - return to caller to retry"
));
cFYI
(
1
,
(
"tcp session dead - return to caller to retry"
));
return
-
EAGAIN
;
return
-
EAGAIN
;
}
else
if
(
ses
->
status
!=
CifsGood
)
{
}
else
if
(
ses
->
status
!=
CifsGood
)
{
/* check if SMB session is bad because we are setting it up */
/* check if SMB session is bad because we are setting it up */
if
((
in_buf
->
Command
!=
SMB_COM_SESSION_SETUP_ANDX
)
&&
if
((
in_buf
->
Command
!=
SMB_COM_SESSION_SETUP_ANDX
)
&&
(
in_buf
->
Command
!=
SMB_COM_NEGOTIATE
))
{
(
in_buf
->
Command
!=
SMB_COM_NEGOTIATE
))
{
return
-
EAGAIN
;
return
-
EAGAIN
;
}
/* else ok - we are setting up session */
}
/* else ok - we are setting up session */
...
@@ -407,7 +407,7 @@ static int wait_for_response(struct cifsSesInfo *ses,
...
@@ -407,7 +407,7 @@ static int wait_for_response(struct cifsSesInfo *ses,
lrt
+=
time_to_wait
;
lrt
+=
time_to_wait
;
if
(
time_after
(
jiffies
,
lrt
))
{
if
(
time_after
(
jiffies
,
lrt
))
{
/* No replies for time_to_wait. */
/* No replies for time_to_wait. */
cERROR
(
1
,(
"server not responding"
));
cERROR
(
1
,
(
"server not responding"
));
return
-
1
;
return
-
1
;
}
}
}
else
{
}
else
{
...
@@ -418,7 +418,7 @@ static int wait_for_response(struct cifsSesInfo *ses,
...
@@ -418,7 +418,7 @@ static int wait_for_response(struct cifsSesInfo *ses,
int
int
SendReceive2
(
const
unsigned
int
xid
,
struct
cifsSesInfo
*
ses
,
SendReceive2
(
const
unsigned
int
xid
,
struct
cifsSesInfo
*
ses
,
struct
kvec
*
iov
,
int
n_vec
,
int
*
pRespBufType
/* ret */
,
struct
kvec
*
iov
,
int
n_vec
,
int
*
pRespBufType
/* ret */
,
const
int
long_op
)
const
int
long_op
)
{
{
int
rc
=
0
;
int
rc
=
0
;
...
@@ -431,11 +431,11 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -431,11 +431,11 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
if
((
ses
==
NULL
)
||
(
ses
->
server
==
NULL
))
{
if
((
ses
==
NULL
)
||
(
ses
->
server
==
NULL
))
{
cifs_small_buf_release
(
in_buf
);
cifs_small_buf_release
(
in_buf
);
cERROR
(
1
,(
"Null session"
));
cERROR
(
1
,
(
"Null session"
));
return
-
EIO
;
return
-
EIO
;
}
}
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
{
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
{
cifs_small_buf_release
(
in_buf
);
cifs_small_buf_release
(
in_buf
);
return
-
ENOENT
;
return
-
ENOENT
;
}
}
...
@@ -482,7 +482,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -482,7 +482,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
up
(
&
ses
->
server
->
tcpSem
);
up
(
&
ses
->
server
->
tcpSem
);
cifs_small_buf_release
(
in_buf
);
cifs_small_buf_release
(
in_buf
);
if
(
rc
<
0
)
if
(
rc
<
0
)
goto
out
;
goto
out
;
if
(
long_op
==
-
1
)
if
(
long_op
==
-
1
)
...
@@ -511,10 +511,10 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -511,10 +511,10 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
spin_unlock
(
&
GlobalMid_Lock
);
spin_unlock
(
&
GlobalMid_Lock
);
receive_len
=
midQ
->
resp_buf
->
smb_buf_length
;
receive_len
=
midQ
->
resp_buf
->
smb_buf_length
;
}
else
{
}
else
{
cERROR
(
1
,(
"No response to cmd %d mid %d"
,
cERROR
(
1
,
(
"No response to cmd %d mid %d"
,
midQ
->
command
,
midQ
->
mid
));
midQ
->
command
,
midQ
->
mid
));
if
(
midQ
->
midState
==
MID_REQUEST_SUBMITTED
)
{
if
(
midQ
->
midState
==
MID_REQUEST_SUBMITTED
)
{
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
rc
=
-
EHOSTDOWN
;
rc
=
-
EHOSTDOWN
;
else
{
else
{
ses
->
server
->
tcpStatus
=
CifsNeedReconnect
;
ses
->
server
->
tcpStatus
=
CifsNeedReconnect
;
...
@@ -523,9 +523,9 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -523,9 +523,9 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
}
}
if
(
rc
!=
-
EHOSTDOWN
)
{
if
(
rc
!=
-
EHOSTDOWN
)
{
if
(
midQ
->
midState
==
MID_RETRY_NEEDED
)
{
if
(
midQ
->
midState
==
MID_RETRY_NEEDED
)
{
rc
=
-
EAGAIN
;
rc
=
-
EAGAIN
;
cFYI
(
1
,(
"marking request for retry"
));
cFYI
(
1
,
(
"marking request for retry"
));
}
else
{
}
else
{
rc
=
-
EIO
;
rc
=
-
EIO
;
}
}
...
@@ -547,7 +547,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -547,7 +547,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
(
midQ
->
midState
==
MID_RESPONSE_RECEIVED
))
{
(
midQ
->
midState
==
MID_RESPONSE_RECEIVED
))
{
iov
[
0
].
iov_base
=
(
char
*
)
midQ
->
resp_buf
;
iov
[
0
].
iov_base
=
(
char
*
)
midQ
->
resp_buf
;
if
(
midQ
->
largeBuf
)
if
(
midQ
->
largeBuf
)
*
pRespBufType
=
CIFS_LARGE_BUFFER
;
*
pRespBufType
=
CIFS_LARGE_BUFFER
;
else
else
*
pRespBufType
=
CIFS_SMALL_BUFFER
;
*
pRespBufType
=
CIFS_SMALL_BUFFER
;
...
@@ -555,14 +555,14 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -555,14 +555,14 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
dump_smb
(
midQ
->
resp_buf
,
80
);
dump_smb
(
midQ
->
resp_buf
,
80
);
/* convert the length into a more usable form */
/* convert the length into a more usable form */
if
((
receive_len
>
24
)
&&
if
((
receive_len
>
24
)
&&
(
ses
->
server
->
secMode
&
(
SECMODE_SIGN_REQUIRED
|
(
ses
->
server
->
secMode
&
(
SECMODE_SIGN_REQUIRED
|
SECMODE_SIGN_ENABLED
)))
{
SECMODE_SIGN_ENABLED
)))
{
rc
=
cifs_verify_signature
(
midQ
->
resp_buf
,
rc
=
cifs_verify_signature
(
midQ
->
resp_buf
,
ses
->
server
->
mac_signing_key
,
ses
->
server
->
mac_signing_key
,
midQ
->
sequence_number
+
1
);
midQ
->
sequence_number
+
1
);
if
(
rc
)
{
if
(
rc
)
{
cERROR
(
1
,(
"Unexpected SMB signature"
));
cERROR
(
1
,
(
"Unexpected SMB signature"
));
/* BB FIXME add code to kill session */
/* BB FIXME add code to kill session */
}
}
}
}
...
@@ -582,7 +582,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -582,7 +582,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
by DeleteMidQEntry */
by DeleteMidQEntry */
}
else
{
}
else
{
rc
=
-
EIO
;
rc
=
-
EIO
;
cFYI
(
1
,(
"Bad MID state?"
));
cFYI
(
1
,
(
"Bad MID state?"
));
}
}
}
}
...
@@ -605,15 +605,15 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -605,15 +605,15 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
struct
mid_q_entry
*
midQ
;
struct
mid_q_entry
*
midQ
;
if
(
ses
==
NULL
)
{
if
(
ses
==
NULL
)
{
cERROR
(
1
,(
"Null smb session"
));
cERROR
(
1
,
(
"Null smb session"
));
return
-
EIO
;
return
-
EIO
;
}
}
if
(
ses
->
server
==
NULL
)
{
if
(
ses
->
server
==
NULL
)
{
cERROR
(
1
,(
"Null tcp session"
));
cERROR
(
1
,
(
"Null tcp session"
));
return
-
EIO
;
return
-
EIO
;
}
}
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
return
-
ENOENT
;
return
-
ENOENT
;
/* Ensure that we do not send more than 50 overlapping requests
/* Ensure that we do not send more than 50 overlapping requests
...
@@ -664,7 +664,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -664,7 +664,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
#endif
#endif
up
(
&
ses
->
server
->
tcpSem
);
up
(
&
ses
->
server
->
tcpSem
);
if
(
rc
<
0
)
if
(
rc
<
0
)
goto
out
;
goto
out
;
if
(
long_op
==
-
1
)
if
(
long_op
==
-
1
)
...
@@ -692,10 +692,10 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -692,10 +692,10 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
spin_unlock
(
&
GlobalMid_Lock
);
spin_unlock
(
&
GlobalMid_Lock
);
receive_len
=
midQ
->
resp_buf
->
smb_buf_length
;
receive_len
=
midQ
->
resp_buf
->
smb_buf_length
;
}
else
{
}
else
{
cERROR
(
1
,(
"No response for cmd %d mid %d"
,
cERROR
(
1
,
(
"No response for cmd %d mid %d"
,
midQ
->
command
,
midQ
->
mid
));
midQ
->
command
,
midQ
->
mid
));
if
(
midQ
->
midState
==
MID_REQUEST_SUBMITTED
)
{
if
(
midQ
->
midState
==
MID_REQUEST_SUBMITTED
)
{
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
rc
=
-
EHOSTDOWN
;
rc
=
-
EHOSTDOWN
;
else
{
else
{
ses
->
server
->
tcpStatus
=
CifsNeedReconnect
;
ses
->
server
->
tcpStatus
=
CifsNeedReconnect
;
...
@@ -704,9 +704,9 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -704,9 +704,9 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
}
}
if
(
rc
!=
-
EHOSTDOWN
)
{
if
(
rc
!=
-
EHOSTDOWN
)
{
if
(
midQ
->
midState
==
MID_RETRY_NEEDED
)
{
if
(
midQ
->
midState
==
MID_RETRY_NEEDED
)
{
rc
=
-
EAGAIN
;
rc
=
-
EAGAIN
;
cFYI
(
1
,(
"marking request for retry"
));
cFYI
(
1
,
(
"marking request for retry"
));
}
else
{
}
else
{
rc
=
-
EIO
;
rc
=
-
EIO
;
}
}
...
@@ -734,14 +734,14 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -734,14 +734,14 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
dump_smb
(
out_buf
,
92
);
dump_smb
(
out_buf
,
92
);
/* convert the length into a more usable form */
/* convert the length into a more usable form */
if
((
receive_len
>
24
)
&&
if
((
receive_len
>
24
)
&&
(
ses
->
server
->
secMode
&
(
SECMODE_SIGN_REQUIRED
|
(
ses
->
server
->
secMode
&
(
SECMODE_SIGN_REQUIRED
|
SECMODE_SIGN_ENABLED
)))
{
SECMODE_SIGN_ENABLED
)))
{
rc
=
cifs_verify_signature
(
out_buf
,
rc
=
cifs_verify_signature
(
out_buf
,
ses
->
server
->
mac_signing_key
,
ses
->
server
->
mac_signing_key
,
midQ
->
sequence_number
+
1
);
midQ
->
sequence_number
+
1
);
if
(
rc
)
{
if
(
rc
)
{
cERROR
(
1
,(
"Unexpected SMB signature"
));
cERROR
(
1
,
(
"Unexpected SMB signature"
));
/* BB FIXME add code to kill session */
/* BB FIXME add code to kill session */
}
}
}
}
...
@@ -759,7 +759,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -759,7 +759,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
BCC
(
out_buf
)
=
le16_to_cpu
(
BCC_LE
(
out_buf
));
BCC
(
out_buf
)
=
le16_to_cpu
(
BCC_LE
(
out_buf
));
}
else
{
}
else
{
rc
=
-
EIO
;
rc
=
-
EIO
;
cERROR
(
1
,(
"Bad MID state?"
));
cERROR
(
1
,
(
"Bad MID state?"
));
}
}
}
}
...
@@ -832,17 +832,17 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
...
@@ -832,17 +832,17 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
struct
cifsSesInfo
*
ses
;
struct
cifsSesInfo
*
ses
;
if
(
tcon
==
NULL
||
tcon
->
ses
==
NULL
)
{
if
(
tcon
==
NULL
||
tcon
->
ses
==
NULL
)
{
cERROR
(
1
,(
"Null smb session"
));
cERROR
(
1
,
(
"Null smb session"
));
return
-
EIO
;
return
-
EIO
;
}
}
ses
=
tcon
->
ses
;
ses
=
tcon
->
ses
;
if
(
ses
->
server
==
NULL
)
{
if
(
ses
->
server
==
NULL
)
{
cERROR
(
1
,(
"Null tcp session"
));
cERROR
(
1
,
(
"Null tcp session"
));
return
-
EIO
;
return
-
EIO
;
}
}
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
return
-
ENOENT
;
return
-
ENOENT
;
/* Ensure that we do not send more than 50 overlapping requests
/* Ensure that we do not send more than 50 overlapping requests
...
@@ -887,7 +887,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
...
@@ -887,7 +887,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
#endif
#endif
up
(
&
ses
->
server
->
tcpSem
);
up
(
&
ses
->
server
->
tcpSem
);
if
(
rc
<
0
)
{
if
(
rc
<
0
)
{
DeleteMidQEntry
(
midQ
);
DeleteMidQEntry
(
midQ
);
return
rc
;
return
rc
;
}
}
...
@@ -928,7 +928,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
...
@@ -928,7 +928,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
}
}
/* Wait 5 seconds for the response. */
/* Wait 5 seconds for the response. */
if
(
wait_for_response
(
ses
,
midQ
,
5
*
HZ
,
5
*
HZ
)
==
0
)
{
if
(
wait_for_response
(
ses
,
midQ
,
5
*
HZ
,
5
*
HZ
)
==
0
)
{
/* We got the response - restart system call. */
/* We got the response - restart system call. */
rstart
=
1
;
rstart
=
1
;
}
}
...
@@ -939,10 +939,10 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
...
@@ -939,10 +939,10 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
spin_unlock
(
&
GlobalMid_Lock
);
spin_unlock
(
&
GlobalMid_Lock
);
receive_len
=
midQ
->
resp_buf
->
smb_buf_length
;
receive_len
=
midQ
->
resp_buf
->
smb_buf_length
;
}
else
{
}
else
{
cERROR
(
1
,(
"No response for cmd %d mid %d"
,
cERROR
(
1
,
(
"No response for cmd %d mid %d"
,
midQ
->
command
,
midQ
->
mid
));
midQ
->
command
,
midQ
->
mid
));
if
(
midQ
->
midState
==
MID_REQUEST_SUBMITTED
)
{
if
(
midQ
->
midState
==
MID_REQUEST_SUBMITTED
)
{
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
if
(
ses
->
server
->
tcpStatus
==
CifsExiting
)
rc
=
-
EHOSTDOWN
;
rc
=
-
EHOSTDOWN
;
else
{
else
{
ses
->
server
->
tcpStatus
=
CifsNeedReconnect
;
ses
->
server
->
tcpStatus
=
CifsNeedReconnect
;
...
@@ -951,9 +951,9 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
...
@@ -951,9 +951,9 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
}
}
if
(
rc
!=
-
EHOSTDOWN
)
{
if
(
rc
!=
-
EHOSTDOWN
)
{
if
(
midQ
->
midState
==
MID_RETRY_NEEDED
)
{
if
(
midQ
->
midState
==
MID_RETRY_NEEDED
)
{
rc
=
-
EAGAIN
;
rc
=
-
EAGAIN
;
cFYI
(
1
,(
"marking request for retry"
));
cFYI
(
1
,
(
"marking request for retry"
));
}
else
{
}
else
{
rc
=
-
EIO
;
rc
=
-
EIO
;
}
}
...
@@ -978,14 +978,14 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
...
@@ -978,14 +978,14 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
dump_smb
(
out_buf
,
92
);
dump_smb
(
out_buf
,
92
);
/* convert the length into a more usable form */
/* convert the length into a more usable form */
if
((
receive_len
>
24
)
&&
if
((
receive_len
>
24
)
&&
(
ses
->
server
->
secMode
&
(
SECMODE_SIGN_REQUIRED
|
(
ses
->
server
->
secMode
&
(
SECMODE_SIGN_REQUIRED
|
SECMODE_SIGN_ENABLED
)))
{
SECMODE_SIGN_ENABLED
)))
{
rc
=
cifs_verify_signature
(
out_buf
,
rc
=
cifs_verify_signature
(
out_buf
,
ses
->
server
->
mac_signing_key
,
ses
->
server
->
mac_signing_key
,
midQ
->
sequence_number
+
1
);
midQ
->
sequence_number
+
1
);
if
(
rc
)
{
if
(
rc
)
{
cERROR
(
1
,(
"Unexpected SMB signature"
));
cERROR
(
1
,
(
"Unexpected SMB signature"
));
/* BB FIXME add code to kill session */
/* BB FIXME add code to kill session */
}
}
}
}
...
@@ -1003,7 +1003,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
...
@@ -1003,7 +1003,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
BCC
(
out_buf
)
=
le16_to_cpu
(
BCC_LE
(
out_buf
));
BCC
(
out_buf
)
=
le16_to_cpu
(
BCC_LE
(
out_buf
));
}
else
{
}
else
{
rc
=
-
EIO
;
rc
=
-
EIO
;
cERROR
(
1
,(
"Bad MID state?"
));
cERROR
(
1
,
(
"Bad MID state?"
));
}
}
}
}
DeleteMidQEntry
(
midQ
);
DeleteMidQEntry
(
midQ
);
...
...
fs/cifs/xattr.c
View file @
79a58d1f
/*
/*
* fs/cifs/xattr.c
* fs/cifs/xattr.c
*
*
* Copyright (c) International Business Machines Corp., 2003
* Copyright (c) International Business Machines Corp., 2003
, 2007
* Author(s): Steve French (sfrench@us.ibm.com)
* Author(s): Steve French (sfrench@us.ibm.com)
*
*
* This library is free software; you can redistribute it and/or modify
* This library is free software; you can redistribute it and/or modify
...
@@ -40,22 +40,22 @@
...
@@ -40,22 +40,22 @@
int
cifs_removexattr
(
struct
dentry
*
direntry
,
const
char
*
ea_name
)
int
cifs_removexattr
(
struct
dentry
*
direntry
,
const
char
*
ea_name
)
{
{
int
rc
=
-
EOPNOTSUPP
;
int
rc
=
-
EOPNOTSUPP
;
#ifdef CONFIG_CIFS_XATTR
#ifdef CONFIG_CIFS_XATTR
int
xid
;
int
xid
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifsTconInfo
*
pTcon
;
struct
cifsTconInfo
*
pTcon
;
struct
super_block
*
sb
;
struct
super_block
*
sb
;
char
*
full_path
;
char
*
full_path
;
if
(
direntry
==
NULL
)
if
(
direntry
==
NULL
)
return
-
EIO
;
return
-
EIO
;
if
(
direntry
->
d_inode
==
NULL
)
if
(
direntry
->
d_inode
==
NULL
)
return
-
EIO
;
return
-
EIO
;
sb
=
direntry
->
d_inode
->
i_sb
;
sb
=
direntry
->
d_inode
->
i_sb
;
if
(
sb
==
NULL
)
if
(
sb
==
NULL
)
return
-
EIO
;
return
-
EIO
;
xid
=
GetXid
();
xid
=
GetXid
();
...
@@ -63,24 +63,26 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name)
...
@@ -63,24 +63,26 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name)
pTcon
=
cifs_sb
->
tcon
;
pTcon
=
cifs_sb
->
tcon
;
full_path
=
build_path_from_dentry
(
direntry
);
full_path
=
build_path_from_dentry
(
direntry
);
if
(
full_path
==
NULL
)
{
if
(
full_path
==
NULL
)
{
FreeXid
(
xid
);
FreeXid
(
xid
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
if
(
ea_name
==
NULL
)
{
if
(
ea_name
==
NULL
)
{
cFYI
(
1
,(
"Null xattr names not supported"
));
cFYI
(
1
,
(
"Null xattr names not supported"
));
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_USER_PREFIX
,
5
)
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_USER_PREFIX
,
5
)
&&
(
strncmp
(
ea_name
,
CIFS_XATTR_OS2_PREFIX
,
4
)))
{
&&
(
strncmp
(
ea_name
,
CIFS_XATTR_OS2_PREFIX
,
4
)))
{
cFYI
(
1
,(
"illegal xattr namespace %s (only user namespace supported)"
,
ea_name
));
cFYI
(
1
,
(
"illegal xattr request %s (only user namespace supported)"
,
ea_name
));
/* BB what if no namespace prefix? */
/* BB what if no namespace prefix? */
/* Should we just pass them to server, except for
/* Should we just pass them to server, except for
system and perhaps security prefixes? */
system and perhaps security prefixes? */
}
else
{
}
else
{
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
goto
remove_ea_exit
;
goto
remove_ea_exit
;
ea_name
+=
5
;
/* skip past user. prefix */
ea_name
+=
5
;
/* skip past user. prefix */
rc
=
CIFSSMBSetEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
NULL
,
rc
=
CIFSSMBSetEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
NULL
,
(
__u16
)
0
,
cifs_sb
->
local_nls
,
(
__u16
)
0
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
}
}
...
@@ -91,23 +93,23 @@ remove_ea_exit:
...
@@ -91,23 +93,23 @@ remove_ea_exit:
return
rc
;
return
rc
;
}
}
int
cifs_setxattr
(
struct
dentry
*
direntry
,
const
char
*
ea_name
,
int
cifs_setxattr
(
struct
dentry
*
direntry
,
const
char
*
ea_name
,
const
void
*
ea_value
,
size_t
value_size
,
int
flags
)
const
void
*
ea_value
,
size_t
value_size
,
int
flags
)
{
{
int
rc
=
-
EOPNOTSUPP
;
int
rc
=
-
EOPNOTSUPP
;
#ifdef CONFIG_CIFS_XATTR
#ifdef CONFIG_CIFS_XATTR
int
xid
;
int
xid
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifsTconInfo
*
pTcon
;
struct
cifsTconInfo
*
pTcon
;
struct
super_block
*
sb
;
struct
super_block
*
sb
;
char
*
full_path
;
char
*
full_path
;
if
(
direntry
==
NULL
)
if
(
direntry
==
NULL
)
return
-
EIO
;
return
-
EIO
;
if
(
direntry
->
d_inode
==
NULL
)
if
(
direntry
->
d_inode
==
NULL
)
return
-
EIO
;
return
-
EIO
;
sb
=
direntry
->
d_inode
->
i_sb
;
sb
=
direntry
->
d_inode
->
i_sb
;
if
(
sb
==
NULL
)
if
(
sb
==
NULL
)
return
-
EIO
;
return
-
EIO
;
xid
=
GetXid
();
xid
=
GetXid
();
...
@@ -115,7 +117,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
...
@@ -115,7 +117,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
pTcon
=
cifs_sb
->
tcon
;
pTcon
=
cifs_sb
->
tcon
;
full_path
=
build_path_from_dentry
(
direntry
);
full_path
=
build_path_from_dentry
(
direntry
);
if
(
full_path
==
NULL
)
{
if
(
full_path
==
NULL
)
{
FreeXid
(
xid
);
FreeXid
(
xid
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
...
@@ -125,63 +127,64 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
...
@@ -125,63 +127,64 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
/* if proc/fs/cifs/streamstoxattr is set then
/* if proc/fs/cifs/streamstoxattr is set then
search server for EAs or streams to
search server for EAs or streams to
returns as xattrs */
returns as xattrs */
if
(
value_size
>
MAX_EA_VALUE_SIZE
)
{
if
(
value_size
>
MAX_EA_VALUE_SIZE
)
{
cFYI
(
1
,(
"size of EA value too large"
));
cFYI
(
1
,
(
"size of EA value too large"
));
kfree
(
full_path
);
kfree
(
full_path
);
FreeXid
(
xid
);
FreeXid
(
xid
);
return
-
EOPNOTSUPP
;
return
-
EOPNOTSUPP
;
}
}
if
(
ea_name
==
NULL
)
{
if
(
ea_name
==
NULL
)
{
cFYI
(
1
,(
"Null xattr names not supported"
));
cFYI
(
1
,
(
"Null xattr names not supported"
));
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_USER_PREFIX
,
5
)
==
0
)
{
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_USER_PREFIX
,
5
)
==
0
)
{
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
goto
set_ea_exit
;
goto
set_ea_exit
;
if
(
strncmp
(
ea_name
,
CIFS_XATTR_DOS_ATTRIB
,
14
)
==
0
)
{
if
(
strncmp
(
ea_name
,
CIFS_XATTR_DOS_ATTRIB
,
14
)
==
0
)
{
cFYI
(
1
,(
"attempt to set cifs inode metadata"
));
cFYI
(
1
,
(
"attempt to set cifs inode metadata"
));
}
}
ea_name
+=
5
;
/* skip past user. prefix */
ea_name
+=
5
;
/* skip past user. prefix */
rc
=
CIFSSMBSetEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
rc
=
CIFSSMBSetEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
(
__u16
)
value_size
,
cifs_sb
->
local_nls
,
(
__u16
)
value_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_OS2_PREFIX
,
4
)
==
0
)
{
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_OS2_PREFIX
,
4
)
==
0
)
{
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
goto
set_ea_exit
;
goto
set_ea_exit
;
ea_name
+=
4
;
/* skip past os2. prefix */
ea_name
+=
4
;
/* skip past os2. prefix */
rc
=
CIFSSMBSetEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
rc
=
CIFSSMBSetEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
(
__u16
)
value_size
,
cifs_sb
->
local_nls
,
(
__u16
)
value_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
}
else
{
}
else
{
int
temp
;
int
temp
;
temp
=
strncmp
(
ea_name
,
POSIX_ACL_XATTR_ACCESS
,
temp
=
strncmp
(
ea_name
,
POSIX_ACL_XATTR_ACCESS
,
strlen
(
POSIX_ACL_XATTR_ACCESS
));
strlen
(
POSIX_ACL_XATTR_ACCESS
));
if
(
temp
==
0
)
{
if
(
temp
==
0
)
{
#ifdef CONFIG_CIFS_POSIX
#ifdef CONFIG_CIFS_POSIX
if
(
sb
->
s_flags
&
MS_POSIXACL
)
if
(
sb
->
s_flags
&
MS_POSIXACL
)
rc
=
CIFSSMBSetPosixACL
(
xid
,
pTcon
,
full_path
,
rc
=
CIFSSMBSetPosixACL
(
xid
,
pTcon
,
full_path
,
ea_value
,
(
const
int
)
value_size
,
ea_value
,
(
const
int
)
value_size
,
ACL_TYPE_ACCESS
,
cifs_sb
->
local_nls
,
ACL_TYPE_ACCESS
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
CIFS_MOUNT_MAP_SPECIAL_CHR
);
cFYI
(
1
,
(
"set POSIX ACL rc %d"
,
rc
));
cFYI
(
1
,
(
"set POSIX ACL rc %d"
,
rc
));
#else
#else
cFYI
(
1
,(
"set POSIX ACL not supported"
));
cFYI
(
1
,
(
"set POSIX ACL not supported"
));
#endif
#endif
}
else
if
(
strncmp
(
ea_name
,
POSIX_ACL_XATTR_DEFAULT
,
strlen
(
POSIX_ACL_XATTR_DEFAULT
))
==
0
)
{
}
else
if
(
strncmp
(
ea_name
,
POSIX_ACL_XATTR_DEFAULT
,
strlen
(
POSIX_ACL_XATTR_DEFAULT
))
==
0
)
{
#ifdef CONFIG_CIFS_POSIX
#ifdef CONFIG_CIFS_POSIX
if
(
sb
->
s_flags
&
MS_POSIXACL
)
if
(
sb
->
s_flags
&
MS_POSIXACL
)
rc
=
CIFSSMBSetPosixACL
(
xid
,
pTcon
,
full_path
,
rc
=
CIFSSMBSetPosixACL
(
xid
,
pTcon
,
full_path
,
ea_value
,
(
const
int
)
value_size
,
ea_value
,
(
const
int
)
value_size
,
ACL_TYPE_DEFAULT
,
cifs_sb
->
local_nls
,
ACL_TYPE_DEFAULT
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
CIFS_MOUNT_MAP_SPECIAL_CHR
);
cFYI
(
1
,
(
"set POSIX default ACL rc %d"
,
rc
));
cFYI
(
1
,
(
"set POSIX default ACL rc %d"
,
rc
));
#else
#else
cFYI
(
1
,(
"set default POSIX ACL not supported"
));
cFYI
(
1
,
(
"set default POSIX ACL not supported"
));
#endif
#endif
}
else
{
}
else
{
cFYI
(
1
,
(
"illegal xattr request %s (only user namespace supported)"
,
ea_name
));
cFYI
(
1
,
(
"illegal xattr request %s (only user namespace supported)"
,
ea_name
));
/* BB what if no namespace prefix? */
/* BB what if no namespace prefix? */
/* Should we just pass them to server, except for
/* Should we just pass them to server, except for
system and perhaps security prefixes? */
system and perhaps security prefixes? */
...
@@ -195,23 +198,23 @@ set_ea_exit:
...
@@ -195,23 +198,23 @@ set_ea_exit:
return
rc
;
return
rc
;
}
}
ssize_t
cifs_getxattr
(
struct
dentry
*
direntry
,
const
char
*
ea_name
,
ssize_t
cifs_getxattr
(
struct
dentry
*
direntry
,
const
char
*
ea_name
,
void
*
ea_value
,
size_t
buf_size
)
void
*
ea_value
,
size_t
buf_size
)
{
{
ssize_t
rc
=
-
EOPNOTSUPP
;
ssize_t
rc
=
-
EOPNOTSUPP
;
#ifdef CONFIG_CIFS_XATTR
#ifdef CONFIG_CIFS_XATTR
int
xid
;
int
xid
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifsTconInfo
*
pTcon
;
struct
cifsTconInfo
*
pTcon
;
struct
super_block
*
sb
;
struct
super_block
*
sb
;
char
*
full_path
;
char
*
full_path
;
if
(
direntry
==
NULL
)
if
(
direntry
==
NULL
)
return
-
EIO
;
return
-
EIO
;
if
(
direntry
->
d_inode
==
NULL
)
if
(
direntry
->
d_inode
==
NULL
)
return
-
EIO
;
return
-
EIO
;
sb
=
direntry
->
d_inode
->
i_sb
;
sb
=
direntry
->
d_inode
->
i_sb
;
if
(
sb
==
NULL
)
if
(
sb
==
NULL
)
return
-
EIO
;
return
-
EIO
;
xid
=
GetXid
();
xid
=
GetXid
();
...
@@ -220,38 +223,38 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
...
@@ -220,38 +223,38 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
pTcon
=
cifs_sb
->
tcon
;
pTcon
=
cifs_sb
->
tcon
;
full_path
=
build_path_from_dentry
(
direntry
);
full_path
=
build_path_from_dentry
(
direntry
);
if
(
full_path
==
NULL
)
{
if
(
full_path
==
NULL
)
{
FreeXid
(
xid
);
FreeXid
(
xid
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
/* return dos attributes as pseudo xattr */
/* return dos attributes as pseudo xattr */
/* return alt name if available as pseudo attr */
/* return alt name if available as pseudo attr */
if
(
ea_name
==
NULL
)
{
if
(
ea_name
==
NULL
)
{
cFYI
(
1
,(
"Null xattr names not supported"
));
cFYI
(
1
,
(
"Null xattr names not supported"
));
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_USER_PREFIX
,
5
)
==
0
)
{
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_USER_PREFIX
,
5
)
==
0
)
{
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
goto
get_ea_exit
;
goto
get_ea_exit
;
if
(
strncmp
(
ea_name
,
CIFS_XATTR_DOS_ATTRIB
,
14
)
==
0
)
{
if
(
strncmp
(
ea_name
,
CIFS_XATTR_DOS_ATTRIB
,
14
)
==
0
)
{
cFYI
(
1
,(
"attempt to query cifs inode metadata"
));
cFYI
(
1
,
(
"attempt to query cifs inode metadata"
));
/* revalidate/getattr then populate from inode */
/* revalidate/getattr then populate from inode */
}
/* BB add else when above is implemented */
}
/* BB add else when above is implemented */
ea_name
+=
5
;
/* skip past user. prefix */
ea_name
+=
5
;
/* skip past user. prefix */
rc
=
CIFSSMBQueryEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
rc
=
CIFSSMBQueryEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
buf_size
,
cifs_sb
->
local_nls
,
buf_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_OS2_PREFIX
,
4
)
==
0
)
{
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_OS2_PREFIX
,
4
)
==
0
)
{
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
goto
get_ea_exit
;
goto
get_ea_exit
;
ea_name
+=
4
;
/* skip past os2. prefix */
ea_name
+=
4
;
/* skip past os2. prefix */
rc
=
CIFSSMBQueryEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
rc
=
CIFSSMBQueryEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
buf_size
,
cifs_sb
->
local_nls
,
buf_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
}
else
if
(
strncmp
(
ea_name
,
POSIX_ACL_XATTR_ACCESS
,
}
else
if
(
strncmp
(
ea_name
,
POSIX_ACL_XATTR_ACCESS
,
strlen
(
POSIX_ACL_XATTR_ACCESS
))
==
0
)
{
strlen
(
POSIX_ACL_XATTR_ACCESS
))
==
0
)
{
#ifdef CONFIG_CIFS_POSIX
#ifdef CONFIG_CIFS_POSIX
if
(
sb
->
s_flags
&
MS_POSIXACL
)
if
(
sb
->
s_flags
&
MS_POSIXACL
)
rc
=
CIFSSMBGetPosixACL
(
xid
,
pTcon
,
full_path
,
rc
=
CIFSSMBGetPosixACL
(
xid
,
pTcon
,
full_path
,
ea_value
,
buf_size
,
ACL_TYPE_ACCESS
,
ea_value
,
buf_size
,
ACL_TYPE_ACCESS
,
cifs_sb
->
local_nls
,
cifs_sb
->
local_nls
,
...
@@ -272,30 +275,31 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
...
@@ -272,30 +275,31 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
CIFSSMBClose(xid, pTcon, fid);
CIFSSMBClose(xid, pTcon, fid);
}
}
} */
/* BB enable after fixing up return data */
} */
/* BB enable after fixing up return data */
#else
#else
cFYI
(
1
,(
"query POSIX ACL not supported yet"
));
cFYI
(
1
,
(
"query POSIX ACL not supported yet"
));
#endif
/* CONFIG_CIFS_POSIX */
#endif
/* CONFIG_CIFS_POSIX */
}
else
if
(
strncmp
(
ea_name
,
POSIX_ACL_XATTR_DEFAULT
,
}
else
if
(
strncmp
(
ea_name
,
POSIX_ACL_XATTR_DEFAULT
,
strlen
(
POSIX_ACL_XATTR_DEFAULT
))
==
0
)
{
strlen
(
POSIX_ACL_XATTR_DEFAULT
))
==
0
)
{
#ifdef CONFIG_CIFS_POSIX
#ifdef CONFIG_CIFS_POSIX
if
(
sb
->
s_flags
&
MS_POSIXACL
)
if
(
sb
->
s_flags
&
MS_POSIXACL
)
rc
=
CIFSSMBGetPosixACL
(
xid
,
pTcon
,
full_path
,
rc
=
CIFSSMBGetPosixACL
(
xid
,
pTcon
,
full_path
,
ea_value
,
buf_size
,
ACL_TYPE_DEFAULT
,
ea_value
,
buf_size
,
ACL_TYPE_DEFAULT
,
cifs_sb
->
local_nls
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
CIFS_MOUNT_MAP_SPECIAL_CHR
);
#else
#else
cFYI
(
1
,(
"query POSIX default ACL not supported yet"
));
cFYI
(
1
,
(
"query POSIX default ACL not supported yet"
));
#endif
#endif
}
else
if
(
strncmp
(
ea_name
,
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_TRUSTED_PREFIX
,
XATTR_TRUSTED_PREFIX_LEN
)
==
0
)
{
CIFS_XATTR_TRUSTED_PREFIX
,
XATTR_TRUSTED_PREFIX_LEN
)
==
0
)
{
cFYI
(
1
,(
"Trusted xattr namespace not supported yet"
));
cFYI
(
1
,
(
"Trusted xattr namespace not supported yet"
));
}
else
if
(
strncmp
(
ea_name
,
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_SECURITY_PREFIX
,
XATTR_SECURITY_PREFIX_LEN
)
==
0
)
{
CIFS_XATTR_SECURITY_PREFIX
,
XATTR_SECURITY_PREFIX_LEN
)
==
0
)
{
cFYI
(
1
,(
"Security xattr namespace not supported yet"
));
cFYI
(
1
,
(
"Security xattr namespace not supported yet"
));
}
else
{
}
else
{
cFYI
(
1
,(
"illegal xattr name request %s (only user namespace supported)"
,
ea_name
));
cFYI
(
1
,
(
"illegal xattr request %s (only user namespace supported)"
,
ea_name
));
}
}
/* We could add an additional check for streams ie
/* We could add an additional check for streams ie
...
@@ -303,7 +307,7 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
...
@@ -303,7 +307,7 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
search server for EAs or streams to
search server for EAs or streams to
returns as xattrs */
returns as xattrs */
if
(
rc
==
-
EINVAL
)
if
(
rc
==
-
EINVAL
)
rc
=
-
EOPNOTSUPP
;
rc
=
-
EOPNOTSUPP
;
get_ea_exit:
get_ea_exit:
...
@@ -313,34 +317,34 @@ get_ea_exit:
...
@@ -313,34 +317,34 @@ get_ea_exit:
return
rc
;
return
rc
;
}
}
ssize_t
cifs_listxattr
(
struct
dentry
*
direntry
,
char
*
data
,
size_t
buf_size
)
ssize_t
cifs_listxattr
(
struct
dentry
*
direntry
,
char
*
data
,
size_t
buf_size
)
{
{
ssize_t
rc
=
-
EOPNOTSUPP
;
ssize_t
rc
=
-
EOPNOTSUPP
;
#ifdef CONFIG_CIFS_XATTR
#ifdef CONFIG_CIFS_XATTR
int
xid
;
int
xid
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifsTconInfo
*
pTcon
;
struct
cifsTconInfo
*
pTcon
;
struct
super_block
*
sb
;
struct
super_block
*
sb
;
char
*
full_path
;
char
*
full_path
;
if
(
direntry
==
NULL
)
if
(
direntry
==
NULL
)
return
-
EIO
;
return
-
EIO
;
if
(
direntry
->
d_inode
==
NULL
)
if
(
direntry
->
d_inode
==
NULL
)
return
-
EIO
;
return
-
EIO
;
sb
=
direntry
->
d_inode
->
i_sb
;
sb
=
direntry
->
d_inode
->
i_sb
;
if
(
sb
==
NULL
)
if
(
sb
==
NULL
)
return
-
EIO
;
return
-
EIO
;
cifs_sb
=
CIFS_SB
(
sb
);
cifs_sb
=
CIFS_SB
(
sb
);
pTcon
=
cifs_sb
->
tcon
;
pTcon
=
cifs_sb
->
tcon
;
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
return
-
EOPNOTSUPP
;
return
-
EOPNOTSUPP
;
xid
=
GetXid
();
xid
=
GetXid
();
full_path
=
build_path_from_dentry
(
direntry
);
full_path
=
build_path_from_dentry
(
direntry
);
if
(
full_path
==
NULL
)
{
if
(
full_path
==
NULL
)
{
FreeXid
(
xid
);
FreeXid
(
xid
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
...
@@ -350,7 +354,7 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
...
@@ -350,7 +354,7 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
/* if proc/fs/cifs/streamstoxattr is set then
/* if proc/fs/cifs/streamstoxattr is set then
search server for EAs or streams to
search server for EAs or streams to
returns as xattrs */
returns as xattrs */
rc
=
CIFSSMBQAllEAs
(
xid
,
pTcon
,
full_path
,
data
,
buf_size
,
rc
=
CIFSSMBQAllEAs
(
xid
,
pTcon
,
full_path
,
data
,
buf_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
CIFS_MOUNT_MAP_SPECIAL_CHR
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment