diff options
author | Steve French <sfrench@us.ibm.com> | 2005-07-21 18:20:28 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2005-07-21 18:20:28 -0400 |
commit | eda3c029899cbf435d76fea43b7e1404439ccec9 (patch) | |
tree | 334ad2504575c4c22247e62c4add3bb2cb54f502 /fs | |
parent | 076fb01e8238b7e5d68ba0d729c0ff7716d1d8ec (diff) |
[CIFS] Add compat with SFU (part 2)
Creating FIFOs to non-Unix servers (with cifs mounts for which sfu option
was specified) now works.
Signed-off-by: Steve French (sfrench@us.ibm.com)
Thanks to Martin Koeppe for his assistance
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifspdu.h | 10 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 10 | ||||
-rw-r--r-- | fs/cifs/dir.c | 34 | ||||
-rw-r--r-- | fs/cifs/inode.c | 10 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 7 |
5 files changed, 64 insertions, 7 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 84d37f8e986e..3cef57b7a34f 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -268,10 +268,18 @@ | |||
268 | /* CreateOptions */ | 268 | /* CreateOptions */ |
269 | #define CREATE_NOT_FILE 0x00000001 /* if set must not be file */ | 269 | #define CREATE_NOT_FILE 0x00000001 /* if set must not be file */ |
270 | #define CREATE_WRITE_THROUGH 0x00000002 | 270 | #define CREATE_WRITE_THROUGH 0x00000002 |
271 | #define CREATE_NOT_DIR 0x00000040 /* if set must not be directory */ | 271 | #define CREATE_SEQUENTIAL 0x00000004 |
272 | #define CREATE_SYNC_ALERT 0x00000010 | ||
273 | #define CREATE_ASYNC_ALERT 0x00000020 | ||
274 | #define CREATE_NOT_DIR 0x00000040 /* if set must not be directory */ | ||
275 | #define CREATE_NO_EA_KNOWLEDGE 0x00000200 | ||
276 | #define CREATE_EIGHT_DOT_THREE 0x00000400 | ||
272 | #define CREATE_RANDOM_ACCESS 0x00000800 | 277 | #define CREATE_RANDOM_ACCESS 0x00000800 |
273 | #define CREATE_DELETE_ON_CLOSE 0x00001000 | 278 | #define CREATE_DELETE_ON_CLOSE 0x00001000 |
279 | #define CREATE_OPEN_BY_ID 0x00002000 | ||
274 | #define OPEN_REPARSE_POINT 0x00200000 | 280 | #define OPEN_REPARSE_POINT 0x00200000 |
281 | #define CREATE_OPTIONS_MASK 0x007FFFFF | ||
282 | #define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */ | ||
275 | 283 | ||
276 | /* ImpersonationLevel flags */ | 284 | /* ImpersonationLevel flags */ |
277 | #define SECURITY_ANONYMOUS 0 | 285 | #define SECURITY_ANONYMOUS 0 |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 56d79fd90679..fbe651858c88 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -738,7 +738,13 @@ openRetry: | |||
738 | } | 738 | } |
739 | pSMB->DesiredAccess = cpu_to_le32(access_flags); | 739 | pSMB->DesiredAccess = cpu_to_le32(access_flags); |
740 | pSMB->AllocationSize = 0; | 740 | pSMB->AllocationSize = 0; |
741 | pSMB->FileAttributes = cpu_to_le32(ATTR_NORMAL); | 741 | /* set file as system file if special file such |
742 | as fifo and server expecting SFU style and | ||
743 | no Unix extensions */ | ||
744 | if(create_options & CREATE_OPTION_SPECIAL) | ||
745 | pSMB->FileAttributes = cpu_to_le32(ATTR_SYSTEM); | ||
746 | else | ||
747 | pSMB->FileAttributes = cpu_to_le32(ATTR_NORMAL); | ||
742 | /* XP does not handle ATTR_POSIX_SEMANTICS */ | 748 | /* XP does not handle ATTR_POSIX_SEMANTICS */ |
743 | /* but it helps speed up case sensitive checks for other | 749 | /* but it helps speed up case sensitive checks for other |
744 | servers such as Samba */ | 750 | servers such as Samba */ |
@@ -752,7 +758,7 @@ openRetry: | |||
752 | being created */ | 758 | being created */ |
753 | pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL); | 759 | pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL); |
754 | pSMB->CreateDisposition = cpu_to_le32(openDisposition); | 760 | pSMB->CreateDisposition = cpu_to_le32(openDisposition); |
755 | pSMB->CreateOptions = cpu_to_le32(create_options); | 761 | pSMB->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK); |
756 | /* BB Expirement with various impersonation levels and verify */ | 762 | /* BB Expirement with various impersonation levels and verify */ |
757 | pSMB->ImpersonationLevel = cpu_to_le32(SECURITY_IMPERSONATION); | 763 | pSMB->ImpersonationLevel = cpu_to_le32(SECURITY_IMPERSONATION); |
758 | pSMB->SecurityFlags = | 764 | pSMB->SecurityFlags = |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 0d5e27fec92b..c0f20fc09290 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -327,13 +327,39 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t dev | |||
327 | d_instantiate(direntry, newinode); | 327 | d_instantiate(direntry, newinode); |
328 | } | 328 | } |
329 | } else { | 329 | } else { |
330 | if((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && | 330 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { |
331 | (special_file(mode))) { | 331 | int oplock = 0; |
332 | u16 fileHandle; | ||
333 | FILE_ALL_INFO * buf; | ||
332 | 334 | ||
333 | cFYI(1,("sfu compat create special file")); | 335 | cFYI(1,("sfu compat create special file")); |
334 | /* Attributes = cpu_to_le32(ATTR_SYSTEM); | ||
335 | rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, ...); */ | ||
336 | 336 | ||
337 | buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL); | ||
338 | if(buf == NULL) { | ||
339 | kfree(full_path); | ||
340 | FreeXid(xid); | ||
341 | return -ENOMEM; | ||
342 | } | ||
343 | |||
344 | rc = CIFSSMBOpen(xid, pTcon, full_path, | ||
345 | FILE_CREATE, /* fail if exists */ | ||
346 | GENERIC_WRITE /* BB would | ||
347 | WRITE_OWNER | WRITE_DAC be better? */, | ||
348 | /* Create a file and set the | ||
349 | file attribute to SYSTEM */ | ||
350 | CREATE_NOT_DIR | CREATE_OPTION_SPECIAL, | ||
351 | &fileHandle, &oplock, buf, | ||
352 | cifs_sb->local_nls, | ||
353 | cifs_sb->mnt_cifs_flags & | ||
354 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
355 | |||
356 | if(!rc) { | ||
357 | /* BB Do not bother to decode buf since no | ||
358 | local inode yet to put timestamps in */ | ||
359 | CIFSSMBClose(xid, pTcon, fileHandle); | ||
360 | d_drop(direntry); | ||
361 | } | ||
362 | kfree(buf); | ||
337 | /* add code here to set EAs */ | 363 | /* add code here to set EAs */ |
338 | } | 364 | } |
339 | } | 365 | } |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 95354da606d6..628aa1a9fe64 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -320,6 +320,16 @@ int cifs_get_inode_info(struct inode **pinode, | |||
320 | on dirs */ | 320 | on dirs */ |
321 | inode->i_mode = cifs_sb->mnt_dir_mode; | 321 | inode->i_mode = cifs_sb->mnt_dir_mode; |
322 | inode->i_mode |= S_IFDIR; | 322 | inode->i_mode |= S_IFDIR; |
323 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && | ||
324 | (cifsInfo->cifsAttrs & ATTR_SYSTEM) && | ||
325 | /* No need to le64 convert size of zero */ | ||
326 | (pfindData->EndOfFile == 0)) { | ||
327 | inode->i_mode = cifs_sb->mnt_file_mode; | ||
328 | inode->i_mode |= S_IFIFO; | ||
329 | /* BB Finish for SFU style symlinks and devies */ | ||
330 | /* } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && | ||
331 | (cifsInfo->cifsAttrs & ATTR_SYSTEM) && ) */ | ||
332 | |||
323 | } else { | 333 | } else { |
324 | inode->i_mode |= S_IFREG; | 334 | inode->i_mode |= S_IFREG; |
325 | /* treat the dos attribute of read-only as read-only | 335 | /* treat the dos attribute of read-only as read-only |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 42310281871c..dec3c9dd04d7 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -148,6 +148,13 @@ static void fill_in_inode(struct inode *tmp_inode, | |||
148 | tmp_inode->i_mode = cifs_sb->mnt_dir_mode; | 148 | tmp_inode->i_mode = cifs_sb->mnt_dir_mode; |
149 | } | 149 | } |
150 | tmp_inode->i_mode |= S_IFDIR; | 150 | tmp_inode->i_mode |= S_IFDIR; |
151 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && | ||
152 | (attr & ATTR_SYSTEM) && (end_of_file == 0)) { | ||
153 | *pobject_type = DT_FIFO; | ||
154 | tmp_inode->i_mode |= S_IFIFO; | ||
155 | /* BB Finish for SFU style symlinks and devies */ | ||
156 | /* } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && | ||
157 | (attr & ATTR_SYSTEM) && ) { */ | ||
151 | /* we no longer mark these because we could not follow them */ | 158 | /* we no longer mark these because we could not follow them */ |
152 | /* } else if (attr & ATTR_REPARSE) { | 159 | /* } else if (attr & ATTR_REPARSE) { |
153 | *pobject_type = DT_LNK; | 160 | *pobject_type = DT_LNK; |