Module Name: src
Committed By: bouyer
Date: Sun Jan 13 16:05:34 UTC 2013
Modified Files:
src/sys/fs/smbfs [netbsd-5]: smbfs_smb.c smbfs_subr.c smbfs_subr.h
smbfs_vnops.c
src/sys/netsmb [netbsd-5]: smb.h
Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1824):
sys/netsmb/smb.h: revision 1.20
sys/fs/smbfs/smbfs_vnops.c: revision 1.85
sys/fs/smbfs/smbfs_subr.c: revision 1.16
sys/fs/smbfs/smbfs_smb.c: revision 1.44
sys/fs/smbfs/smbfs_subr.h: revision 1.21
Improve smbfs timestamp handling.
Don't round timestamp to 2 seconds resolution if the server
supports the CAP_INFOLEVEL_PASSTHRU capability.
To generate a diff of this commit:
cvs rdiff -u -r1.37.6.2 -r1.37.6.3 src/sys/fs/smbfs/smbfs_smb.c
cvs rdiff -u -r1.14 -r1.14.44.1 src/sys/fs/smbfs/smbfs_subr.c
cvs rdiff -u -r1.19.6.1 -r1.19.6.2 src/sys/fs/smbfs/smbfs_subr.h
cvs rdiff -u -r1.65.6.2 -r1.65.6.3 src/sys/fs/smbfs/smbfs_vnops.c
cvs rdiff -u -r1.17 -r1.17.86.1 src/sys/netsmb/smb.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/smbfs/smbfs_smb.c
diff -u src/sys/fs/smbfs/smbfs_smb.c:1.37.6.2 src/sys/fs/smbfs/smbfs_smb.c:1.37.6.3
--- src/sys/fs/smbfs/smbfs_smb.c:1.37.6.2 Mon Nov 26 19:50:11 2012
+++ src/sys/fs/smbfs/smbfs_smb.c Sun Jan 13 16:05:34 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_smb.c,v 1.37.6.2 2012/11/26 19:50:11 riz Exp $ */
+/* $NetBSD: smbfs_smb.c,v 1.37.6.3 2013/01/13 16:05:34 bouyer Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_smb.c,v 1.37.6.2 2012/11/26 19:50:11 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_smb.c,v 1.37.6.3 2013/01/13 16:05:34 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -430,7 +430,6 @@ smbfs_smb_setptime2(struct smbnode *np,
/*
* NT level. Specially for win9x
*/
-#if 0
int
smbfs_smb_setpattrNT(struct smbnode *np, u_short attr, struct timespec *mtime,
struct timespec *atime, struct smb_cred *scred)
@@ -442,13 +441,22 @@ smbfs_smb_setpattrNT(struct smbnode *np,
int64_t tm;
int error, tzoff;
+ /*
+ * SMB_SET_FILE_BASIC_INFO isn't supported for
+ * SMB_TRANS2_SET_PATH_INFORMATION,
+ * so use SMB_SET_FILE_BASIC_INFORMATION instead,
+ * but it requires SMB_CAP_INFOLEVEL_PASSTHRU capability.
+ */
+ if ((SMB_CAPS(vcp) & SMB_CAP_INFOLEVEL_PASSTHRU) == 0)
+ return smbfs_smb_setptime2(np, mtime, atime, attr, scred);
+
error = smb_t2_alloc(SSTOCP(ssp), SMB_TRANS2_SET_PATH_INFORMATION,
scred, &t2p);
if (error)
return error;
mbp = &t2p->t2_tparam;
mb_init(mbp);
- mb_put_uint16le(mbp, SMB_SET_FILE_BASIC_INFO);
+ mb_put_uint16le(mbp, SMB_SET_FILE_BASIC_INFORMATION);
mb_put_uint32le(mbp, 0); /* MBZ */
error = smbfs_fullpath(mbp, vcp, np, NULL, 0);
if (error) {
@@ -471,13 +479,13 @@ smbfs_smb_setpattrNT(struct smbnode *np,
mb_put_int64le(mbp, tm);
mb_put_int64le(mbp, tm); /* change time */
mb_put_uint32le(mbp, attr); /* attr */
- t2p->t2_maxpcount = 24;
- t2p->t2_maxdcount = 56;
+ mb_put_uint32le(mbp, 0); /* padding */
+ t2p->t2_maxpcount = 2;
+ t2p->t2_maxdcount = 0;
error = smb_t2_request(t2p);
smb_t2_done(t2p);
return error;
}
-#endif
/*
* Set file atime and mtime. Doesn't supported by core dialect.
@@ -560,9 +568,8 @@ smbfs_smb_setfattrNT(struct smbnode *np,
tm = 0;
mb_put_int64le(mbp, tm);
mb_put_int64le(mbp, tm); /* change time */
- mb_put_uint16le(mbp, attr);
- mb_put_uint32le(mbp, 0); /* padding */
- mb_put_uint16le(mbp, 0);
+ mb_put_uint32le(mbp, attr); /* attr */
+ mb_put_uint32le(mbp, 0); /* padding */
t2p->t2_maxpcount = 2;
t2p->t2_maxdcount = 0;
error = smb_t2_request(t2p);
Index: src/sys/fs/smbfs/smbfs_subr.c
diff -u src/sys/fs/smbfs/smbfs_subr.c:1.14 src/sys/fs/smbfs/smbfs_subr.c:1.14.44.1
--- src/sys/fs/smbfs/smbfs_subr.c:1.14 Sat Jun 30 09:37:57 2007
+++ src/sys/fs/smbfs/smbfs_subr.c Sun Jan 13 16:05:34 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_subr.c,v 1.14 2007/06/30 09:37:57 pooka Exp $ */
+/* $NetBSD: smbfs_subr.c,v 1.14.44.1 2013/01/13 16:05:34 bouyer Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_subr.c,v 1.14 2007/06/30 09:37:57 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_subr.c,v 1.14.44.1 2013/01/13 16:05:34 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -145,7 +145,7 @@ smb_time_local2NT(struct timespec *tsp,
u_long seconds;
smb_time_local2server(tsp, 0, &seconds);
- *nsec = (((int64_t)(seconds) & ~1) + DIFF1970TO1601) * (int64_t)10000000;
+ *nsec = ((int64_t)seconds + DIFF1970TO1601) * (int64_t)10000000;
}
void
Index: src/sys/fs/smbfs/smbfs_subr.h
diff -u src/sys/fs/smbfs/smbfs_subr.h:1.19.6.1 src/sys/fs/smbfs/smbfs_subr.h:1.19.6.2
--- src/sys/fs/smbfs/smbfs_subr.h:1.19.6.1 Tue Oct 27 20:46:52 2009
+++ src/sys/fs/smbfs/smbfs_subr.h Sun Jan 13 16:05:34 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_subr.h,v 1.19.6.1 2009/10/27 20:46:52 bouyer Exp $ */
+/* $NetBSD: smbfs_subr.h,v 1.19.6.2 2013/01/13 16:05:34 bouyer Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@@ -142,10 +142,8 @@ int smbfs_smb_setpattr(struct smbnode *
struct timespec *mtime, struct smb_cred *scred);
int smbfs_smb_setptime2(struct smbnode *np, struct timespec *mtime,
struct timespec *atime, int attr, struct smb_cred *scred);
-#if 0
int smbfs_smb_setpattrNT(struct smbnode *np, u_int16_t attr,
struct timespec *mtime, struct timespec *atime, struct smb_cred *scred);
-#endif
int smbfs_smb_setftime(struct smbnode *np, struct timespec *mtime,
struct timespec *atime, struct smb_cred *scred);
Index: src/sys/fs/smbfs/smbfs_vnops.c
diff -u src/sys/fs/smbfs/smbfs_vnops.c:1.65.6.2 src/sys/fs/smbfs/smbfs_vnops.c:1.65.6.3
--- src/sys/fs/smbfs/smbfs_vnops.c:1.65.6.2 Sun Jan 13 16:03:38 2013
+++ src/sys/fs/smbfs/smbfs_vnops.c Sun Jan 13 16:05:34 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_vnops.c,v 1.65.6.2 2013/01/13 16:03:38 bouyer Exp $ */
+/* $NetBSD: smbfs_vnops.c,v 1.65.6.3 2013/01/13 16:05:34 bouyer Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.65.6.2 2013/01/13 16:03:38 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.65.6.3 2013/01/13 16:05:34 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -478,8 +478,7 @@ smbfs_setattr(v)
VOP_CLOSE(vp, FWRITE, ap->a_cred);
}
} else if (SMB_CAPS(vcp) & SMB_CAP_NT_SMBS) {
- error = smbfs_smb_setptime2(np, mtime, atime, 0, &scred);
-/* error = smbfs_smb_setpattrNT(np, 0, mtime, atime, &scred);*/
+ error = smbfs_smb_setpattrNT(np, 0, mtime, atime, &scred);
} else if (SMB_DIALECT(vcp) >= SMB_DIALECT_LANMAN2_0) {
error = smbfs_smb_setptime2(np, mtime, atime, 0, &scred);
} else {
Index: src/sys/netsmb/smb.h
diff -u src/sys/netsmb/smb.h:1.17 src/sys/netsmb/smb.h:1.17.86.1
--- src/sys/netsmb/smb.h:1.17 Sun Dec 11 06:25:32 2005
+++ src/sys/netsmb/smb.h Sun Jan 13 16:05:34 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: smb.h,v 1.17 2005/12/11 06:25:32 christos Exp $ */
+/* $NetBSD: smb.h,v 1.17.86.1 2013/01/13 16:05:34 bouyer Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@@ -374,6 +374,7 @@ enum smb_dialects {
*/
#define SMB_SET_FILE_BASIC_INFO 0x101
#define SMB_SET_FILE_END_OF_FILE_INFO 0x104
+#define SMB_SET_FILE_BASIC_INFORMATION 1004
/*
* LOCKING_ANDX LockType flags