aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 3c05c2de50e..9c04ad40455 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1166,6 +1166,20 @@ static __u16 convert_disposition(int disposition)
1166 return ofun; 1166 return ofun;
1167} 1167}
1168 1168
1169static int
1170access_flags_to_smbopen_mode(const int access_flags)
1171{
1172 int masked_flags = access_flags & (GENERIC_READ | GENERIC_WRITE);
1173
1174 if (masked_flags == GENERIC_READ)
1175 return SMBOPEN_READ;
1176 else if (masked_flags == GENERIC_WRITE)
1177 return SMBOPEN_WRITE;
1178
1179 /* just go for read/write */
1180 return SMBOPEN_READWRITE;
1181}
1182
1169int 1183int
1170SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon, 1184SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon,
1171 const char *fileName, const int openDisposition, 1185 const char *fileName, const int openDisposition,
@@ -1207,13 +1221,7 @@ OldOpenRetry:
1207 pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK); 1221 pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK);
1208 1222
1209 pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO); 1223 pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO);
1210 /* BB fixme add conversion for access_flags to bits 0 - 2 of mode */ 1224 pSMB->Mode = cpu_to_le16(access_flags_to_smbopen_mode(access_flags));
1211 /* 0 = read
1212 1 = write
1213 2 = rw
1214 3 = execute
1215 */
1216 pSMB->Mode = cpu_to_le16(2);
1217 pSMB->Mode |= cpu_to_le16(0x40); /* deny none */ 1225 pSMB->Mode |= cpu_to_le16(0x40); /* deny none */
1218 /* set file as system file if special file such 1226 /* set file as system file if special file such
1219 as fifo and server expecting SFU style and 1227 as fifo and server expecting SFU style and