[CIFS] Recognize properly symlinks and char/blk devices (not just FIFOs)
created by SFU (part 1 of 2). Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
parent
7b0a65f992
commit
d6e2f2a4c8
|
@ -3,6 +3,8 @@ Version 1.39
|
|||
Defer close of a file handle slightly if pending writes depend on that file handle
|
||||
(this reduces the EBADF bad file handle errors that can be logged under heavy
|
||||
stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2
|
||||
Fix SFU style symlinks and mknod needed for servers which do not support the CIFS
|
||||
Unix Extensions.
|
||||
|
||||
Version 1.38
|
||||
------------
|
||||
|
|
|
@ -195,6 +195,55 @@ int cifs_get_inode_info_unix(struct inode **pinode,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int decode_sfu_inode(struct inode * inode, __u64 size,
|
||||
const unsigned char *path,
|
||||
struct cifs_sb_info *cifs_sb, int xid)
|
||||
{
|
||||
int rc;
|
||||
int oplock = FALSE;
|
||||
__u16 netfid;
|
||||
struct cifsTconInfo *pTcon = cifs_sb->tcon;
|
||||
char buf[8];
|
||||
unsigned int bytes_read;
|
||||
char * pbuf;
|
||||
|
||||
pbuf = buf;
|
||||
|
||||
if(size == 0) {
|
||||
inode->i_mode |= S_IFIFO;
|
||||
return 0;
|
||||
} else if (size < 8) {
|
||||
return -EINVAL; /* EOPNOTSUPP? */
|
||||
}
|
||||
|
||||
rc = CIFSSMBOpen(xid, pTcon, path, FILE_OPEN, GENERIC_READ,
|
||||
CREATE_NOT_DIR, &netfid, &oplock, NULL,
|
||||
cifs_sb->local_nls,
|
||||
cifs_sb->mnt_cifs_flags &
|
||||
CIFS_MOUNT_MAP_SPECIAL_CHR);
|
||||
if (rc==0) {
|
||||
/* Read header */
|
||||
rc = CIFSSMBRead(xid, pTcon,
|
||||
netfid,
|
||||
8 /* length */, 0 /* offset */,
|
||||
&bytes_read, &pbuf);
|
||||
if((rc == 0) && (bytes_read == 8)) {
|
||||
/* if memcmp(IntxCHR\000, pbuf, 8)
|
||||
else if memcmp(IntxBLK\000, pbuf, 8)
|
||||
else if memcmp(IntxLNK\001, pbuf, 8) */
|
||||
}
|
||||
|
||||
CIFSSMBClose(xid, pTcon, netfid);
|
||||
|
||||
|
||||
/* inode->i_rdev = MKDEV(le64_to_cpu(DevMajor),
|
||||
le64_to_cpu(DevMinor) & MINORMASK);*/
|
||||
/* inode->i_mode |= S_IFBLK; */
|
||||
}
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
||||
int cifs_get_inode_info(struct inode **pinode,
|
||||
const unsigned char *search_path, FILE_ALL_INFO *pfindData,
|
||||
struct super_block *sb, int xid)
|
||||
|
@ -345,10 +394,15 @@ int cifs_get_inode_info(struct inode **pinode,
|
|||
(pfindData->EndOfFile == 0)) {
|
||||
inode->i_mode = cifs_sb->mnt_file_mode;
|
||||
inode->i_mode |= S_IFIFO;
|
||||
/* BB Finish for SFU style symlinks and devies */
|
||||
/* } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) &&
|
||||
(cifsInfo->cifsAttrs & ATTR_SYSTEM) && ) */
|
||||
|
||||
/* BB Finish for SFU style symlinks and devices */
|
||||
} else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) &&
|
||||
(cifsInfo->cifsAttrs & ATTR_SYSTEM)) {
|
||||
if (decode_sfu_inode(inode,
|
||||
le64_to_cpu(pfindData->EndOfFile),
|
||||
search_path,
|
||||
cifs_sb, xid)) {
|
||||
cFYI(1,("Unrecognized sfu inode type"));
|
||||
}
|
||||
} else {
|
||||
inode->i_mode |= S_IFREG;
|
||||
/* treat the dos attribute of read-only as read-only
|
||||
|
|
Loading…
Reference in a new issue