2.6.0/CIFS patch filetype
Florian Lohoff
flo at rfc822.org
Tue Dec 30 17:46:18 GMT 2003
Hi,
the linux kernel 2.6.0 cifs implementation misses to set the file
type in CIFSSMBUnixSetPerms which means mknod of any type does not work.
I guess something like this is needed - Loaned from smbfs - I am though
unshure about the UNIX_UNKNOWN - Guess one can return -EINVAL if this
happens instead of letting the server guess.
Also i am unshure if one needs to mask the permissions as top level bits
might get misinterpreted on server side.
diff -Nur linux-2.6.0/fs/cifs/cifspdu.h linux-2.6.0.flo/fs/cifs/cifspdu.h
--- linux-2.6.0/fs/cifs/cifspdu.h 2003-12-18 03:59:27.000000000 +0100
+++ linux-2.6.0.flo/fs/cifs/cifspdu.h 2003-12-30 18:31:20.000000000 +0100
@@ -1554,6 +1554,7 @@
#define UNIX_BLOCKDEV 4
#define UNIX_FIFO 5
#define UNIX_SOCKET 6
+#define UNIX_UNKNOWN 0xffffffff
typedef struct {
__u32 NextEntryOffset;
diff -Nur linux-2.6.0/fs/cifs/cifssmb.c linux-2.6.0.flo/fs/cifs/cifssmb.c
--- linux-2.6.0/fs/cifs/cifssmb.c 2003-12-18 03:58:28.000000000 +0100
+++ linux-2.6.0.flo/fs/cifs/cifssmb.c 2003-12-30 18:30:57.000000000 +0100
@@ -42,6 +42,26 @@
BAD_PROT, "\2"}
};
+static u32
+smb_filetype_from_mode(int mode)
+{
+ if (mode & S_IFREG)
+ return UNIX_FILE;
+ if (mode & S_IFDIR)
+ return UNIX_DIR;
+ if (mode & S_IFLNK)
+ return UNIX_SYMLINK;
+ if (mode & S_IFCHR)
+ return UNIX_CHARDEV;
+ if (mode & S_IFBLK)
+ return UNIX_BLOCKDEV;
+ if (mode & S_IFIFO)
+ return UNIX_FIFO;
+ if (mode & S_IFSOCK)
+ return UNIX_SOCKET;
+ return UNIX_UNKNOWN;
+}
+
int
smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
void **request_buf /* returned */ ,
@@ -2462,6 +2482,8 @@
data_offset->DevMajor = cpu_to_le64(MAJOR(device));
data_offset->DevMinor = cpu_to_le64(MINOR(device));
data_offset->Permissions = cpu_to_le64(mode);
+ data_offset->Type = cpu_to_le32(smb_filetype_from_mode(mode));
+
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
--
Florian Lohoff flo at rfc822.org +49-171-2280134
Heisenberg may have been here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20031230/4592b1c2/attachment.bin
More information about the samba-technical
mailing list