diff options
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r-- | fs/cifs/inode.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index f0586c0d7bdb..d7b85dfb0df3 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -210,7 +210,7 @@ static int decode_sfu_inode(struct inode * inode, __u64 size, | |||
210 | int oplock = FALSE; | 210 | int oplock = FALSE; |
211 | __u16 netfid; | 211 | __u16 netfid; |
212 | struct cifsTconInfo *pTcon = cifs_sb->tcon; | 212 | struct cifsTconInfo *pTcon = cifs_sb->tcon; |
213 | char buf[8]; | 213 | char buf[24]; |
214 | unsigned int bytes_read; | 214 | unsigned int bytes_read; |
215 | char * pbuf; | 215 | char * pbuf; |
216 | 216 | ||
@@ -232,30 +232,43 @@ static int decode_sfu_inode(struct inode * inode, __u64 size, | |||
232 | /* Read header */ | 232 | /* Read header */ |
233 | rc = CIFSSMBRead(xid, pTcon, | 233 | rc = CIFSSMBRead(xid, pTcon, |
234 | netfid, | 234 | netfid, |
235 | 8 /* length */, 0 /* offset */, | 235 | 24 /* length */, 0 /* offset */, |
236 | &bytes_read, &pbuf); | 236 | &bytes_read, &pbuf); |
237 | if((rc == 0) && (bytes_read == 8)) { | 237 | if((rc == 0) && (bytes_read >= 8)) { |
238 | if(memcmp("IntxBLK", pbuf, 8) == 0) { | 238 | if(memcmp("IntxBLK", pbuf, 8) == 0) { |
239 | cFYI(1,("Block device")); | 239 | cFYI(1,("Block device")); |
240 | inode->i_mode |= S_IFBLK; | 240 | inode->i_mode |= S_IFBLK; |
241 | if(bytes_read == 24) { | ||
242 | /* we have enough to decode dev num */ | ||
243 | __u64 mjr; /* major */ | ||
244 | __u64 mnr; /* minor */ | ||
245 | mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); | ||
246 | mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); | ||
247 | inode->i_rdev = MKDEV(mjr, mnr); | ||
248 | } | ||
241 | } else if(memcmp("IntxCHR", pbuf, 8) == 0) { | 249 | } else if(memcmp("IntxCHR", pbuf, 8) == 0) { |
242 | cFYI(1,("Char device")); | 250 | cFYI(1,("Char device")); |
243 | inode->i_mode |= S_IFCHR; | 251 | inode->i_mode |= S_IFCHR; |
252 | if(bytes_read == 24) { | ||
253 | /* we have enough to decode dev num */ | ||
254 | __u64 mjr; /* major */ | ||
255 | __u64 mnr; /* minor */ | ||
256 | mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); | ||
257 | mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); | ||
258 | inode->i_rdev = MKDEV(mjr, mnr); | ||
259 | } | ||
244 | } else if(memcmp("IntxLNK", pbuf, 7) == 0) { | 260 | } else if(memcmp("IntxLNK", pbuf, 7) == 0) { |
245 | cFYI(1,("Symlink")); | 261 | cFYI(1,("Symlink")); |
246 | inode->i_mode |= S_IFLNK; | 262 | inode->i_mode |= S_IFLNK; |
247 | } | 263 | } else { |
264 | inode->i_mode |= S_IFREG; /* file? */ | ||
265 | rc = -EOPNOTSUPP; | ||
266 | } | ||
248 | } else { | 267 | } else { |
249 | inode->i_mode |= S_IFREG; /* then it is a file */ | 268 | inode->i_mode |= S_IFREG; /* then it is a file */ |
250 | rc = -EOPNOTSUPP; /* or some unknown SFU type */ | 269 | rc = -EOPNOTSUPP; /* or some unknown SFU type */ |
251 | } | 270 | } |
252 | |||
253 | CIFSSMBClose(xid, pTcon, netfid); | 271 | CIFSSMBClose(xid, pTcon, netfid); |
254 | |||
255 | |||
256 | /* inode->i_rdev = MKDEV(le64_to_cpu(DevMajor), | ||
257 | le64_to_cpu(DevMinor) & MINORMASK);*/ | ||
258 | /* inode->i_mode |= S_IFBLK; */ | ||
259 | } | 272 | } |
260 | return rc; | 273 | return rc; |
261 | 274 | ||