Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Aug 2013 07:10:19 +0000 (UTC)
From:      Mark Murray <markm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r254648 - in projects/random_number_generator: . bin/chflags bin/ls lib/libc/gen lib/libc/sys lib/libutil share/man/man9 sys/amd64/conf sys/amd64/include sys/cddl/contrib/opensolaris/ut...
Message-ID:  <201308220710.r7M7AJCK007165@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markm
Date: Thu Aug 22 07:10:18 2013
New Revision: 254648
URL: http://svnweb.freebsd.org/changeset/base/254648

Log:
  IFC.

Modified:
  projects/random_number_generator/UPDATING
  projects/random_number_generator/bin/chflags/chflags.1
  projects/random_number_generator/bin/ls/ls.1
  projects/random_number_generator/lib/libc/gen/strtofflags.c
  projects/random_number_generator/lib/libc/sys/chflags.2
  projects/random_number_generator/lib/libutil/expand_number.c
  projects/random_number_generator/share/man/man9/atomic.9
  projects/random_number_generator/sys/amd64/conf/GENERIC
  projects/random_number_generator/sys/amd64/conf/NOTES
  projects/random_number_generator/sys/amd64/include/atomic.h
  projects/random_number_generator/sys/amd64/include/pmap.h
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S
  projects/random_number_generator/sys/conf/options.amd64
  projects/random_number_generator/sys/conf/options.i386
  projects/random_number_generator/sys/dev/hwpmc/pmc_events.h
  projects/random_number_generator/sys/dev/mps/mps_sas.c
  projects/random_number_generator/sys/fs/msdosfs/msdosfs_denode.c
  projects/random_number_generator/sys/fs/msdosfs/msdosfs_vnops.c
  projects/random_number_generator/sys/fs/smbfs/smbfs_node.c
  projects/random_number_generator/sys/fs/smbfs/smbfs_vnops.c
  projects/random_number_generator/sys/i386/conf/GENERIC
  projects/random_number_generator/sys/i386/conf/NOTES
  projects/random_number_generator/sys/i386/i386/machdep.c
  projects/random_number_generator/sys/i386/include/atomic.h
  projects/random_number_generator/sys/i386/include/pmap.h
  projects/random_number_generator/sys/net80211/ieee80211_freebsd.h
  projects/random_number_generator/sys/net80211/ieee80211_hostap.c
  projects/random_number_generator/sys/net80211/ieee80211_input.c
  projects/random_number_generator/sys/netinet/in_mcast.c
  projects/random_number_generator/sys/netinet6/in6_mcast.c
  projects/random_number_generator/sys/powerpc/conf/GENERIC64
  projects/random_number_generator/sys/sys/param.h
  projects/random_number_generator/sys/sys/stat.h
  projects/random_number_generator/sys/ufs/ufs/ufs_vnops.c
  projects/random_number_generator/sys/vm/vm_pageout.c
Directory Properties:
  projects/random_number_generator/   (props changed)
  projects/random_number_generator/lib/libc/   (props changed)
  projects/random_number_generator/lib/libutil/   (props changed)
  projects/random_number_generator/sys/   (props changed)
  projects/random_number_generator/sys/cddl/contrib/opensolaris/   (props changed)
  projects/random_number_generator/sys/conf/   (props changed)

Modified: projects/random_number_generator/UPDATING
==============================================================================
--- projects/random_number_generator/UPDATING	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/UPDATING	Thu Aug 22 07:10:18 2013	(r254648)
@@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
 	disable the most expensive debugging functionality run
 	"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20130821:
+	The PADLOCK_RNG and RDRAND_RNG kernel options are now devices.
+	Thus "device padlock_rng" and "device rdrand_rng" should be
+	used instead of "options PADLOCK_RNG" & "options RDRAND_RNG".
+
 20130813:
 	WITH_ICONV has been split into two feature sets.  WITH_ICONV now
 	enables just the iconv* functionality and is now on by default.
@@ -340,9 +345,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
 20120913:
 	The random(4) support for the VIA hardware random number
 	generator (`PADLOCK') is no longer enabled unconditionally.
-	Add the PADLOCK_RNG option in the custom kernel config if
+	Add the padlock_rng device in the custom kernel config if
 	needed.  The GENERIC kernels on i386 and amd64 do include the
-	option, so the change only affects the custom kernel
+	device, so the change only affects the custom kernel
 	configurations.
 
 20120908:

Modified: projects/random_number_generator/bin/chflags/chflags.1
==============================================================================
--- projects/random_number_generator/bin/chflags/chflags.1	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/bin/chflags/chflags.1	Thu Aug 22 07:10:18 2013	(r254648)
@@ -32,7 +32,7 @@
 .\"	@(#)chflags.1	8.4 (Berkeley) 5/2/95
 .\" $FreeBSD$
 .\"
-.Dd March 3, 2006
+.Dd April 8, 2013
 .Dt CHFLAGS 1
 .Os
 .Sh NAME
@@ -101,20 +101,36 @@ The following keywords are currently def
 .Bl -tag -offset indent -width ".Cm opaque"
 .It Cm arch , archived
 set the archived flag (super-user only)
-.It Cm opaque
-set the opaque flag (owner or super-user only)
 .It Cm nodump
 set the nodump flag (owner or super-user only)
+.It Cm opaque
+set the opaque flag (owner or super-user only)
 .It Cm sappnd , sappend
 set the system append-only flag (super-user only)
 .It Cm schg , schange , simmutable
 set the system immutable flag (super-user only)
+.It Cm snapshot
+set the snapshot flag (filesystems do not allow changing this flag)
 .It Cm sunlnk , sunlink
 set the system undeletable flag (super-user only)
 .It Cm uappnd , uappend
 set the user append-only flag (owner or super-user only)
+.It Cm uarch , uarchive
+set the archive flag (owner or super-user only)
 .It Cm uchg , uchange , uimmutable
 set the user immutable flag (owner or super-user only)
+.It Cm uhidden , hidden
+set the hidden file attribute (owner or super-user only)
+.It Cm uoffline , offline
+set the offline file attribute (owner or super-user only)
+.It Cm urdonly , rdonly , readonly
+set the DOS, Windows and CIFS readonly flag (owner or super-user only)
+.It Cm usparse , sparse
+set the sparse file attribute (owner or super-user only)
+.It Cm usystem , system
+set the DOS, Windows and CIFS system flag (owner or super-user only)
+.It Cm ureparse , reparse
+set the Windows reparse point file attribute (owner or super-user only)
 .It Cm uunlnk , uunlink
 set the user undeletable flag (owner or super-user only)
 .El

Modified: projects/random_number_generator/bin/ls/ls.1
==============================================================================
--- projects/random_number_generator/bin/ls/ls.1	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/bin/ls/ls.1	Thu Aug 22 07:10:18 2013	(r254648)
@@ -232,6 +232,9 @@ output.
 Include the file flags in a long
 .Pq Fl l
 output.
+See
+.Xr chflags 1
+for a list of file flags and their meanings.
 .It Fl p
 Write a slash
 .Pq Ql /

Modified: projects/random_number_generator/lib/libc/gen/strtofflags.c
==============================================================================
--- projects/random_number_generator/lib/libc/gen/strtofflags.c	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/lib/libc/gen/strtofflags.c	Thu Aug 22 07:10:18 2013	(r254648)
@@ -62,13 +62,29 @@ static struct {
 #endif
 	{ "nouappnd",		0, UF_APPEND	},
 	{ "nouappend",		0, UF_APPEND	},
+	{ "nouarch", 		0, UF_ARCHIVE	},
+	{ "nouarchive",		0, UF_ARCHIVE	},
+	{ "nohidden",		0, UF_HIDDEN	},
+	{ "nouhidden",		0, UF_HIDDEN	},
 	{ "nouchg",		0, UF_IMMUTABLE	},
 	{ "nouchange",		0, UF_IMMUTABLE	},
 	{ "nouimmutable",	0, UF_IMMUTABLE	},
 	{ "nodump",		1, UF_NODUMP	},
-	{ "noopaque",		0, UF_OPAQUE	},
 	{ "nouunlnk",		0, UF_NOUNLINK	},
-	{ "nouunlink",		0, UF_NOUNLINK	}
+	{ "nouunlink",		0, UF_NOUNLINK	},
+	{ "nooffline",		0, UF_OFFLINE	},
+	{ "nouoffline",		0, UF_OFFLINE	},
+	{ "noopaque",		0, UF_OPAQUE	},
+	{ "nordonly",		0, UF_READONLY	},
+	{ "nourdonly",		0, UF_READONLY	},
+	{ "noreadonly",		0, UF_READONLY	},
+	{ "noureadonly",	0, UF_READONLY	},
+	{ "noreparse",		0, UF_REPARSE	},
+	{ "noureparse",		0, UF_REPARSE	},
+	{ "nosparse",		0, UF_SPARSE	},
+	{ "nousparse",		0, UF_SPARSE	},
+	{ "nosystem",		0, UF_SYSTEM	},
+	{ "nousystem",		0, UF_SYSTEM	}
 };
 #define nmappings	(sizeof(mapping) / sizeof(mapping[0]))
 

Modified: projects/random_number_generator/lib/libc/sys/chflags.2
==============================================================================
--- projects/random_number_generator/lib/libc/sys/chflags.2	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/lib/libc/sys/chflags.2	Thu Aug 22 07:10:18 2013	(r254648)
@@ -112,26 +112,61 @@ The flags specified are formed by
 the following values
 .Pp
 .Bl -tag -width ".Dv SF_IMMUTABLE" -compact -offset indent
-.It Dv UF_NODUMP
-Do not dump the file.
-.It Dv UF_IMMUTABLE
-The file may not be changed.
-.It Dv UF_APPEND
+.It Dv SF_APPEND
 The file may only be appended to.
-.It Dv UF_NOUNLINK
-The file may not be renamed or deleted.
-.It Dv UF_OPAQUE
-The directory is opaque when viewed through a union stack.
 .It Dv SF_ARCHIVED
-The file may be archived.
+The file has been archived.
+This flag means the opposite of the DOS, Windows and CIFS
+FILE_ATTRIBUTE_ARCHIVE attribute.
+This flag has been deprecated, and may be removed in a future release.
 .It Dv SF_IMMUTABLE
 The file may not be changed.
-.It Dv SF_APPEND
-The file may only be appended to.
 .It Dv SF_NOUNLINK
 The file may not be renamed or deleted.
 .It Dv SF_SNAPSHOT
 The file is a snapshot file.
+.It Dv UF_APPEND
+The file may only be appended to.
+.It Dv UF_ARCHIVE
+The file needs to be archived.
+This flag has the same meaning as the DOS, Windows and CIFS
+FILE_ATTRIBUTE_ARCHIVE attribute.
+Filesystems in FreeBSD may or may not have special handling for this flag.
+For instance, ZFS tracks changes to files and will set this bit when a
+file is updated.
+UFS only stores the flag, and relies on the application to change it when
+needed.
+.It Dv UF_HIDDEN
+The file may be hidden from directory listings at the application's
+discretion.
+The file has the DOS, Windows and CIFS FILE_ATTRIBUTE_HIDDEN attribute.
+.It Dv UF_IMMUTABLE
+The file may not be changed.
+.It Dv UF_NODUMP
+Do not dump the file.
+.It Dv UF_NOUNLINK
+The file may not be renamed or deleted.
+.It Dv UF_OFFLINE
+The file is offline, or has the Windows and CIFS FILE_ATTRIBUTE_OFFLINE
+attribute.
+Filesystems in FreeBSD store and display this flag, but do not provide any
+special handling when it is set.
+.It Dv UF_OPAQUE
+The directory is opaque when viewed through a union stack.
+.It Dv UF_READONLY
+The file is read only, and may not be written or appended.
+Filesystems may use this flag to maintain compatibility with the DOS, Windows
+and CIFS FILE_ATTRIBUTE_READONLY attribute.
+.It Dv UF_REPARSE
+The file contains a Windows reparse point and has the Windows and CIFS
+FILE_ATTRIBUTE_REPARSE_POINT attribute.
+.It Dv UF_SPARSE
+The file has the Windows FILE_ATTRIBUTE_SPARSE_FILE attribute.
+This may also be used by a filesystem to indicate a sparse file.
+.It Dv UF_SYSTEM
+The file has the DOS, Windows and CIFS FILE_ATTRIBUTE_SYSTEM attribute.
+Filesystems in FreeBSD may store and display this flag, but do not provide
+any special handling when it is set.
 .El
 .Pp
 If one of
@@ -162,6 +197,13 @@ the system is in single-user mode.
 .Xr init 8
 for details.)
 .Pp
+The implementation of all flags is filesystem-dependent.
+See the description of the 
+.Dv UF_ARCHIVE
+flag above for one example of the differences in behavior.
+Care should be exercised when writing applications to account for
+support or lack of support of these flags in various filesystems.
+.Pp
 The
 .Dv SF_SNAPSHOT
 flag is maintained by the system and cannot be toggled.

Modified: projects/random_number_generator/lib/libutil/expand_number.c
==============================================================================
--- projects/random_number_generator/lib/libutil/expand_number.c	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/lib/libutil/expand_number.c	Thu Aug 22 07:10:18 2013	(r254648)
@@ -50,15 +50,22 @@ int
 expand_number(const char *buf, uint64_t *num)
 {
 	uint64_t number;
+	int saved_errno;
 	unsigned shift;
 	char *endptr;
 
+	saved_errno = errno;
+	errno = 0;
+
 	number = strtoumax(buf, &endptr, 0);
 
 	if (number == UINTMAX_MAX && errno == ERANGE) {
 		return (-1);
 	}
 
+	if (errno == 0)
+		errno = saved_errno;
+
 	if (endptr == buf) {
 		/* No valid digits. */
 		errno = EINVAL;

Modified: projects/random_number_generator/share/man/man9/atomic.9
==============================================================================
--- projects/random_number_generator/share/man/man9/atomic.9	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/share/man/man9/atomic.9	Thu Aug 22 07:10:18 2013	(r254648)
@@ -23,7 +23,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 27, 2005
+.Dd August 20, 2013
 .Dt ATOMIC 9
 .Os
 .Sh NAME
@@ -62,6 +62,10 @@
 .Fn atomic_subtract_[acq_|rel_]<type> "volatile <type> *p" "<type> v"
 .Ft void
 .Fn atomic_store_rel_<type> "volatile <type> *p" "<type> v"
+.Ft <type>
+.Fn atomic_swap_<type> "volatile <type> *p" "<type> v"
+.Ft int
+.Fn atomic_testandset_<type> "volatile <type> *p" "u_int v"
 .Sh DESCRIPTION
 Each of the atomic operations is guaranteed to be atomic in the presence of
 interrupts.
@@ -184,9 +188,9 @@ This section describes the semantics of 
 .Bd -literal -compact
 if (*dst == old) {
 	*dst = new;
-	return 1;
+	return (1);
 } else
-	return 0;
+	return (0);
 .Ed
 .El
 .Pp
@@ -203,7 +207,7 @@ and
 .Bd -literal -compact
 tmp = *p;
 *p += v;
-return tmp;
+return (tmp);
 .Ed
 .El
 .Pp
@@ -216,9 +220,9 @@ and
 .Dq Li 32
 and do not have any variants with memory barriers at this time.
 .Bl -hang
-.It Fn atomic_load addr
+.It Fn atomic_load p
 .Bd -literal -compact
-return (*addr)
+return (*p);
 .Ed
 .El
 .Pp
@@ -226,11 +230,11 @@ The
 .Fn atomic_load
 functions are only provided with acquire memory barriers.
 .Bl -hang
-.It Fn atomic_readandclear addr
+.It Fn atomic_readandclear p
 .Bd -literal -compact
-temp = *addr;
-*addr = 0;
-return (temp);
+tmp = *p;
+*p = 0;
+return (tmp);
 .Ed
 .El
 .Pp
@@ -243,8 +247,7 @@ functions are not implemented for the ty
 .Dq Li 8 ,
 and
 .Dq Li 16
-and do
-not have any variants with memory barriers at this time.
+and do not have any variants with memory barriers at this time.
 .Bl -hang
 .It Fn atomic_set p v
 .Bd -literal -compact
@@ -264,6 +267,44 @@ The
 .Fn atomic_store
 functions are only provided with release memory barriers.
 .Pp
+.Bl -hang
+.It Fn atomic_swap p v
+.Bd -literal -compact
+tmp = *p;
+*p = v;
+return (tmp);
+.Ed
+.El
+.Pp
+The
+.Fn atomic_swap
+functions are not implemented for the types
+.Dq Li char ,
+.Dq Li short ,
+.Dq Li ptr ,
+.Dq Li 8 ,
+and
+.Dq Li 16
+and do not have any variants with memory barriers at this time.
+.Bl -hang
+.It Fn atomic_testandset p v
+.Bd -literal -compact
+bit = 1 << (v % (sizeof(*p) * NBBY));
+tmp = (*p & bit) != 0;
+*p |= bit;
+return (tmp);
+.Ed
+.El
+.Pp
+The
+.Fn atomic_testandset
+functions are only implemented for the types
+.Dq Li int ,
+.Dq Li long
+and
+.Dq Li 32
+and do not have any variants with memory barriers at this time.
+.Pp
 The type
 .Dq Li 64
 is currently not implemented for any of the atomic operations on the
@@ -275,15 +316,17 @@ architectures.
 .Sh RETURN VALUES
 The
 .Fn atomic_cmpset
-function
-returns the result of the compare operation.
+function returns the result of the compare operation.
 The
 .Fn atomic_fetchadd ,
 .Fn atomic_load ,
+.Fn atomic_readandclear ,
 and
-.Fn atomic_readandclear
-functions
-return the value at the specified address.
+.Fn atomic_swap
+functions return the value at the specified address.
+The
+.Fn atomic_testandset
+function returns the result of the test operation.
 .Sh EXAMPLES
 This example uses the
 .Fn atomic_cmpset_acq_ptr
@@ -354,3 +397,9 @@ The
 .Fn atomic_fetchadd
 operations were added in
 .Fx 6.0 .
+The
+.Fn atomic_swap
+and
+.Fn atomic_testandset
+operations were added in
+.Fx 10.0 .

Modified: projects/random_number_generator/sys/amd64/conf/GENERIC
==============================================================================
--- projects/random_number_generator/sys/amd64/conf/GENERIC	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/amd64/conf/GENERIC	Thu Aug 22 07:10:18 2013	(r254648)
@@ -293,8 +293,8 @@ device		wpi		# Intel 3945ABG wireless NI
 # Pseudo devices.
 device		loop		# Network loopback
 device		random		# Entropy device
-options 	PADLOCK_RNG	# VIA Padlock RNG
-options 	RDRAND_RNG	# Intel Bull Mountain RNG
+device		padlock_rng	# VIA Padlock RNG
+device		rdrand_rng	# Intel Bull Mountain RNG
 device		ether		# Ethernet support
 device		vlan		# 802.1Q VLAN support
 device		tun		# Packet tunnel.

Modified: projects/random_number_generator/sys/amd64/conf/NOTES
==============================================================================
--- projects/random_number_generator/sys/amd64/conf/NOTES	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/amd64/conf/NOTES	Thu Aug 22 07:10:18 2013	(r254648)
@@ -496,6 +496,8 @@ device		vpd
 device		asmc
 #device		si
 device		tpm
+device		padlock_rng	# VIA Padlock RNG
+device		rdrand_rng	# Intel Bull Mountain RNG
 
 #
 # Laptop/Notebook options:

Modified: projects/random_number_generator/sys/amd64/include/atomic.h
==============================================================================
--- projects/random_number_generator/sys/amd64/include/atomic.h	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/amd64/include/atomic.h	Thu Aug 22 07:10:18 2013	(r254648)
@@ -54,12 +54,14 @@
  * atomic_clear_int(P, V)	(*(u_int *)(P) &= ~(V))
  * atomic_add_int(P, V)		(*(u_int *)(P) += (V))
  * atomic_subtract_int(P, V)	(*(u_int *)(P) -= (V))
+ * atomic_swap_int(P, V)	(return (*(u_int *)(P)); *(u_int *)(P) = (V);)
  * atomic_readandclear_int(P)	(return (*(u_int *)(P)); *(u_int *)(P) = 0;)
  *
  * atomic_set_long(P, V)	(*(u_long *)(P) |= (V))
  * atomic_clear_long(P, V)	(*(u_long *)(P) &= ~(V))
  * atomic_add_long(P, V)	(*(u_long *)(P) += (V))
  * atomic_subtract_long(P, V)	(*(u_long *)(P) -= (V))
+ * atomic_swap_long(P, V)	(return (*(u_long *)(P)); *(u_long *)(P) = (V);)
  * atomic_readandclear_long(P)	(return (*(u_long *)(P)); *(u_long *)(P) = 0;)
  */
 
@@ -80,6 +82,8 @@ int	atomic_cmpset_int(volatile u_int *ds
 int	atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src);
 u_int	atomic_fetchadd_int(volatile u_int *p, u_int v);
 u_long	atomic_fetchadd_long(volatile u_long *p, u_long v);
+int	atomic_testandset_int(volatile u_int *p, u_int v);
+int	atomic_testandset_long(volatile u_long *p, u_int v);
 
 #define	ATOMIC_LOAD(TYPE, LOP)					\
 u_##TYPE	atomic_load_acq_##TYPE(volatile u_##TYPE *p)
@@ -138,15 +142,14 @@ atomic_cmpset_int(volatile u_int *dst, u
 
 	__asm __volatile(
 	"	" MPLOCKED "		"
-	"	cmpxchgl %2,%1 ;	"
+	"	cmpxchgl %3,%1 ;	"
 	"       sete	%0 ;		"
 	"# atomic_cmpset_int"
-	: "=a" (res),			/* 0 */
-	  "+m" (*dst)			/* 1 */
-	: "r" (src),			/* 2 */
-	  "a" (expect)			/* 3 */
+	: "=q" (res),			/* 0 */
+	  "+m" (*dst),			/* 1 */
+	  "+a" (expect)			/* 2 */
+	: "r" (src)			/* 3 */
 	: "memory", "cc");
-
 	return (res);
 }
 
@@ -157,15 +160,14 @@ atomic_cmpset_long(volatile u_long *dst,
 
 	__asm __volatile(
 	"	" MPLOCKED "		"
-	"	cmpxchgq %2,%1 ;	"
+	"	cmpxchgq %3,%1 ;	"
 	"       sete	%0 ;		"
 	"# atomic_cmpset_long"
-	: "=a" (res),			/* 0 */
-	  "+m" (*dst)			/* 1 */
-	: "r" (src),			/* 2 */
-	  "a" (expect)			/* 3 */
+	: "=q" (res),			/* 0 */
+	  "+m" (*dst),			/* 1 */
+	  "+a" (expect)			/* 2 */
+	: "r" (src)			/* 3 */
 	: "memory", "cc");
-
 	return (res);
 }
 
@@ -205,6 +207,40 @@ atomic_fetchadd_long(volatile u_long *p,
 	return (v);
 }
 
+static __inline int
+atomic_testandset_int(volatile u_int *p, u_int v)
+{
+	u_char res;
+
+	__asm __volatile(
+	"	" MPLOCKED "		"
+	"	btsl	%2,%1 ;		"
+	"	setc	%0 ;		"
+	"# atomic_testandset_int"
+	: "=q" (res),			/* 0 */
+	  "+m" (*p)			/* 1 */
+	: "Ir" (v & 0x1f)		/* 2 */
+	: "cc");
+	return (res);
+}
+
+static __inline int
+atomic_testandset_long(volatile u_long *p, u_int v)
+{
+	u_char res;
+
+	__asm __volatile(
+	"	" MPLOCKED "		"
+	"	btsq	%2,%1 ;		"
+	"	setc	%0 ;		"
+	"# atomic_testandset_long"
+	: "=q" (res),			/* 0 */
+	  "+m" (*p)			/* 1 */
+	: "Jr" ((u_long)(v & 0x3f))	/* 2 */
+	: "cc");
+	return (res);
+}
+
 /*
  * We assume that a = b will do atomic loads and stores.  Due to the
  * IA32 memory model, a simple store guarantees release semantics.
@@ -251,7 +287,6 @@ atomic_load_acq_##TYPE(volatile u_##TYPE
 	: "=a" (res),			/* 0 */		\
 	  "+m" (*p)			/* 1 */		\
 	: : "memory", "cc");				\
-							\
 	return (res);					\
 }							\
 struct __hack
@@ -296,43 +331,37 @@ ATOMIC_STORE(long);
 
 #ifndef WANT_FUNCTIONS
 
-/* Read the current value and store a zero in the destination. */
+/* Read the current value and store a new value in the destination. */
 #ifdef __GNUCLIKE_ASM
 
 static __inline u_int
-atomic_readandclear_int(volatile u_int *p)
+atomic_swap_int(volatile u_int *p, u_int v)
 {
-	u_int res;
 
-	res = 0;
 	__asm __volatile(
 	"	xchgl	%1,%0 ;		"
-	"# atomic_readandclear_int"
-	: "+r" (res),			/* 0 */
+	"# atomic_swap_int"
+	: "+r" (v),			/* 0 */
 	  "+m" (*p));			/* 1 */
-
-	return (res);
+	return (v);
 }
 
 static __inline u_long
-atomic_readandclear_long(volatile u_long *p)
+atomic_swap_long(volatile u_long *p, u_long v)
 {
-	u_long res;
 
-	res = 0;
 	__asm __volatile(
 	"	xchgq	%1,%0 ;		"
-	"# atomic_readandclear_long"
-	: "+r" (res),			/* 0 */
+	"# atomic_swap_long"
+	: "+r" (v),			/* 0 */
 	  "+m" (*p));			/* 1 */
-
-	return (res);
+	return (v);
 }
 
 #else /* !__GNUCLIKE_ASM */
 
-u_int	atomic_readandclear_int(volatile u_int *p);
-u_long	atomic_readandclear_long(volatile u_long *p);
+u_int	atomic_swap_int(volatile u_int *p, u_int v);
+u_long	atomic_swap_long(volatile u_long *p, u_long v);
 
 #endif /* __GNUCLIKE_ASM */
 
@@ -376,6 +405,9 @@ u_long	atomic_readandclear_long(volatile
 #define	atomic_cmpset_acq_long		atomic_cmpset_long
 #define	atomic_cmpset_rel_long		atomic_cmpset_long
 
+#define	atomic_readandclear_int(p)	atomic_swap_int(p, 0)
+#define	atomic_readandclear_long(p)	atomic_swap_long(p, 0)
+
 /* Operations on 8-bit bytes. */
 #define	atomic_set_8		atomic_set_char
 #define	atomic_set_acq_8	atomic_set_acq_char
@@ -426,8 +458,10 @@ u_long	atomic_readandclear_long(volatile
 #define	atomic_cmpset_32	atomic_cmpset_int
 #define	atomic_cmpset_acq_32	atomic_cmpset_acq_int
 #define	atomic_cmpset_rel_32	atomic_cmpset_rel_int
+#define	atomic_swap_32		atomic_swap_int
 #define	atomic_readandclear_32	atomic_readandclear_int
 #define	atomic_fetchadd_32	atomic_fetchadd_int
+#define	atomic_testandset_32	atomic_testandset_int
 
 /* Operations on 64-bit quad words. */
 #define	atomic_set_64		atomic_set_long
@@ -447,7 +481,9 @@ u_long	atomic_readandclear_long(volatile
 #define	atomic_cmpset_64	atomic_cmpset_long
 #define	atomic_cmpset_acq_64	atomic_cmpset_acq_long
 #define	atomic_cmpset_rel_64	atomic_cmpset_rel_long
+#define	atomic_swap_64		atomic_swap_long
 #define	atomic_readandclear_64	atomic_readandclear_long
+#define	atomic_testandset_64	atomic_testandset_long
 
 /* Operations on pointers. */
 #define	atomic_set_ptr		atomic_set_long
@@ -467,6 +503,7 @@ u_long	atomic_readandclear_long(volatile
 #define	atomic_cmpset_ptr	atomic_cmpset_long
 #define	atomic_cmpset_acq_ptr	atomic_cmpset_acq_long
 #define	atomic_cmpset_rel_ptr	atomic_cmpset_rel_long
+#define	atomic_swap_ptr		atomic_swap_long
 #define	atomic_readandclear_ptr	atomic_readandclear_long
 
 #endif /* !WANT_FUNCTIONS */

Modified: projects/random_number_generator/sys/amd64/include/pmap.h
==============================================================================
--- projects/random_number_generator/sys/amd64/include/pmap.h	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/amd64/include/pmap.h	Thu Aug 22 07:10:18 2013	(r254648)
@@ -206,41 +206,14 @@ extern u_int64_t KPML4phys;	/* physical 
 pt_entry_t *vtopte(vm_offset_t);
 #define	vtophys(va)	pmap_kextract(((vm_offset_t) (va)))
 
-static __inline pt_entry_t
-pte_load(pt_entry_t *ptep)
-{
-	pt_entry_t r;
-
-	r = *ptep;
-	return (r);
-}
-
-static __inline pt_entry_t
-pte_load_store(pt_entry_t *ptep, pt_entry_t pte)
-{
-	pt_entry_t r;
-
-	__asm __volatile(
-	    "xchgq %0,%1"
-	    : "=m" (*ptep),
-	      "=r" (r)
-	    : "1" (pte),
-	      "m" (*ptep));
-	return (r);
-}
-
-#define	pte_load_clear(pte)	atomic_readandclear_long(pte)
-
-static __inline void
-pte_store(pt_entry_t *ptep, pt_entry_t pte)
-{
+#define	pte_load_store(ptep, pte)	atomic_swap_long(ptep, pte)
+#define	pte_load_clear(ptep)		atomic_swap_long(ptep, 0)
+#define	pte_store(ptep, pte) do { \
+	*(u_long *)(ptep) = (u_long)(pte); \
+} while (0)
+#define	pte_clear(ptep)			pte_store(ptep, 0)
 
-	*ptep = pte;
-}
-
-#define	pte_clear(ptep)		pte_store((ptep), (pt_entry_t)0ULL)
-
-#define	pde_store(pdep, pde)	pte_store((pdep), (pde))
+#define	pde_store(pdep, pde)		pte_store(pdep, pde)
 
 extern pt_entry_t pg_nx;
 

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Thu Aug 22 07:10:18 2013	(r254648)
@@ -6071,6 +6071,14 @@ zfs_freebsd_getattr(ap)
 	XVA_SET_REQ(&xvap, XAT_APPENDONLY);
 	XVA_SET_REQ(&xvap, XAT_NOUNLINK);
 	XVA_SET_REQ(&xvap, XAT_NODUMP);
+	XVA_SET_REQ(&xvap, XAT_READONLY);
+	XVA_SET_REQ(&xvap, XAT_ARCHIVE);
+	XVA_SET_REQ(&xvap, XAT_SYSTEM);
+	XVA_SET_REQ(&xvap, XAT_HIDDEN);
+	XVA_SET_REQ(&xvap, XAT_REPARSE);
+	XVA_SET_REQ(&xvap, XAT_OFFLINE);
+	XVA_SET_REQ(&xvap, XAT_SPARSE);
+
 	error = zfs_getattr(ap->a_vp, (vattr_t *)&xvap, 0, ap->a_cred, NULL);
 	if (error != 0)
 		return (error);
@@ -6086,8 +6094,23 @@ zfs_freebsd_getattr(ap)
 	    xvap.xva_xoptattrs.xoa_appendonly);
 	FLAG_CHECK(SF_NOUNLINK, XAT_NOUNLINK,
 	    xvap.xva_xoptattrs.xoa_nounlink);
+	FLAG_CHECK(UF_ARCHIVE, XAT_ARCHIVE,
+	    xvap.xva_xoptattrs.xoa_archive);
 	FLAG_CHECK(UF_NODUMP, XAT_NODUMP,
 	    xvap.xva_xoptattrs.xoa_nodump);
+	FLAG_CHECK(UF_READONLY, XAT_READONLY,
+	    xvap.xva_xoptattrs.xoa_readonly);
+	FLAG_CHECK(UF_SYSTEM, XAT_SYSTEM,
+	    xvap.xva_xoptattrs.xoa_system);
+	FLAG_CHECK(UF_HIDDEN, XAT_HIDDEN,
+	    xvap.xva_xoptattrs.xoa_hidden);
+	FLAG_CHECK(UF_REPARSE, XAT_REPARSE,
+	    xvap.xva_xoptattrs.xoa_reparse);
+	FLAG_CHECK(UF_OFFLINE, XAT_OFFLINE,
+	    xvap.xva_xoptattrs.xoa_offline);
+	FLAG_CHECK(UF_SPARSE, XAT_SPARSE,
+	    xvap.xva_xoptattrs.xoa_sparse);
+
 #undef	FLAG_CHECK
 	*vap = xvap.xva_vattr;
 	vap->va_flags = fflags;
@@ -6125,7 +6148,16 @@ zfs_freebsd_setattr(ap)
 			return (EOPNOTSUPP);
 
 		fflags = vap->va_flags;
-		if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_NODUMP)) != 0)
+		/*
+		 * XXX KDM 
+		 * We need to figure out whether it makes sense to allow
+		 * UF_REPARSE through, since we don't really have other
+		 * facilities to handle reparse points and zfs_setattr()
+		 * doesn't currently allow setting that attribute anyway.
+		 */
+		if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_ARCHIVE|
+		     UF_NODUMP|UF_SYSTEM|UF_HIDDEN|UF_READONLY|UF_REPARSE|
+		     UF_OFFLINE|UF_SPARSE)) != 0)
 			return (EOPNOTSUPP);
 		/*
 		 * Unprivileged processes are not permitted to unset system
@@ -6177,8 +6209,22 @@ zfs_freebsd_setattr(ap)
 		    xvap.xva_xoptattrs.xoa_appendonly);
 		FLAG_CHANGE(SF_NOUNLINK, ZFS_NOUNLINK, XAT_NOUNLINK,
 		    xvap.xva_xoptattrs.xoa_nounlink);
+		FLAG_CHANGE(UF_ARCHIVE, ZFS_ARCHIVE, XAT_ARCHIVE,
+		    xvap.xva_xoptattrs.xoa_archive);
 		FLAG_CHANGE(UF_NODUMP, ZFS_NODUMP, XAT_NODUMP,
 		    xvap.xva_xoptattrs.xoa_nodump);
+		FLAG_CHANGE(UF_READONLY, ZFS_READONLY, XAT_READONLY,
+		    xvap.xva_xoptattrs.xoa_readonly);
+		FLAG_CHANGE(UF_SYSTEM, ZFS_SYSTEM, XAT_SYSTEM,
+		    xvap.xva_xoptattrs.xoa_system);
+		FLAG_CHANGE(UF_HIDDEN, ZFS_HIDDEN, XAT_HIDDEN,
+		    xvap.xva_xoptattrs.xoa_hidden);
+		FLAG_CHANGE(UF_REPARSE, ZFS_REPARSE, XAT_REPARSE,
+		    xvap.xva_xoptattrs.xoa_hidden);
+		FLAG_CHANGE(UF_OFFLINE, ZFS_OFFLINE, XAT_OFFLINE,
+		    xvap.xva_xoptattrs.xoa_offline);
+		FLAG_CHANGE(UF_SPARSE, ZFS_SPARSE, XAT_SPARSE,
+		    xvap.xva_xoptattrs.xoa_sparse);
 #undef	FLAG_CHANGE
 	}
 	return (zfs_setattr(vp, (vattr_t *)&xvap, 0, cred, NULL));

Modified: projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S
==============================================================================
--- projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S	Thu Aug 22 07:10:18 2013	(r254648)
@@ -125,13 +125,13 @@ void
 dtrace_copy(uintptr_t src, uintptr_t dest, size_t size)
 */
 ASENTRY_NOPROF(dtrace_copy)
-	addme	%r7,%r3
-	addme	%r8,%r4
+	subi	%r7,%r3,1
+	subi	%r8,%r4,1
+	mtctr	%r5
 1:
 	lbzu	%r3,1(%r7)
 	stbu	%r3,1(%r8)
-	addme	%r5,%r5
-	beq	2f
+	bdnz	1b
 2:
 	blr
 END(dtrace_copy)

Modified: projects/random_number_generator/sys/conf/options.amd64
==============================================================================
--- projects/random_number_generator/sys/conf/options.amd64	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/conf/options.amd64	Thu Aug 22 07:10:18 2013	(r254648)
@@ -68,7 +68,3 @@ XENHVM			opt_global.h
 
 # options for the Intel C600 SAS driver (isci)
 ISCI_LOGGING	opt_isci.h
-
-# hw random number generators for random(4)
-PADLOCK_RNG		opt_cpu.h
-RDRAND_RNG		opt_cpu.h

Modified: projects/random_number_generator/sys/conf/options.i386
==============================================================================
--- projects/random_number_generator/sys/conf/options.i386	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/conf/options.i386	Thu Aug 22 07:10:18 2013	(r254648)
@@ -123,7 +123,3 @@ XENHVM			opt_global.h
 
 # options for the Intel C600 SAS driver (isci)
 ISCI_LOGGING	opt_isci.h
-
-# hw random number generators for random(4)
-PADLOCK_RNG		opt_cpu.h
-RDRAND_RNG		opt_cpu.h

Modified: projects/random_number_generator/sys/dev/hwpmc/pmc_events.h
==============================================================================
--- projects/random_number_generator/sys/dev/hwpmc/pmc_events.h	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/dev/hwpmc/pmc_events.h	Thu Aug 22 07:10:18 2013	(r254648)
@@ -3304,7 +3304,7 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE
     IAP_EVENT_D2H_04H)							\
 __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE",		\
     IAP_EVENT_D2H_08H)							\
-__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS",		\
+__PMC_EV_ALIAS("MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS",			\
     IAP_EVENT_D4H_02H)							\
 __PMC_EV_ALIAS("L2_TRANS.DEMAND_DATA_RD", IAP_EVENT_F0H_01H)		\
 __PMC_EV_ALIAS("L2_TRANS.RFO", IAP_EVENT_F0H_02H)			\
@@ -3538,7 +3538,7 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE
     IAP_EVENT_D2H_08H)							\
 __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.ALL",			\
     IAP_EVENT_D2H_0FH)							\
-__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS",		\
+__PMC_EV_ALIAS("MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS",		\
     IAP_EVENT_D4H_02H)							\
 __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM",		\
     IAP_EVENT_D3H_01H)							\

Modified: projects/random_number_generator/sys/dev/mps/mps_sas.c
==============================================================================
--- projects/random_number_generator/sys/dev/mps/mps_sas.c	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/dev/mps/mps_sas.c	Thu Aug 22 07:10:18 2013	(r254648)
@@ -2103,7 +2103,7 @@ mpssas_scsiio_complete(struct mps_softc 
 	cm->cm_targ->completed++;
 	cm->cm_targ->outstanding--;
 	TAILQ_REMOVE(&cm->cm_targ->commands, cm, cm_link);
-	ccb->ccb_h.status |= ~(CAM_STATUS_MASK | CAM_SIM_QUEUED);
+	ccb->ccb_h.status &= ~(CAM_STATUS_MASK | CAM_SIM_QUEUED);
 
 	if (cm->cm_state == MPS_CM_STATE_TIMEDOUT) {
 		TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery);
@@ -2145,7 +2145,7 @@ mpssas_scsiio_complete(struct mps_softc 
 		 * because there can be no reply when we haven't actually
 		 * gone out to the hardware.
 		 */
-		ccb->ccb_h.status |= CAM_REQUEUE_REQ;
+		ccb->ccb_h.status = CAM_REQUEUE_REQ;
 
 		/*
 		 * Currently the only error included in the mask is

Modified: projects/random_number_generator/sys/fs/msdosfs/msdosfs_denode.c
==============================================================================
--- projects/random_number_generator/sys/fs/msdosfs/msdosfs_denode.c	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/fs/msdosfs/msdosfs_denode.c	Thu Aug 22 07:10:18 2013	(r254648)
@@ -304,8 +304,8 @@ deupdat(dep, waitfor)
 	if ((dep->de_flag & DE_MODIFIED) == 0 && waitfor == 0)
 		return (0);
 	dep->de_flag &= ~DE_MODIFIED;
-	if (dep->de_Attributes & ATTR_DIRECTORY)
-		return (0);
+	if (DETOV(dep)->v_vflag & VV_ROOT)
+		return (EINVAL);
 	if (dep->de_refcnt <= 0)
 		return (0);
 	error = readde(dep, &bp, &dirp);

Modified: projects/random_number_generator/sys/fs/msdosfs/msdosfs_vnops.c
==============================================================================
--- projects/random_number_generator/sys/fs/msdosfs/msdosfs_vnops.c	Thu Aug 22 06:51:59 2013	(r254647)
+++ projects/random_number_generator/sys/fs/msdosfs/msdosfs_vnops.c	Thu Aug 22 07:10:18 2013	(r254648)
@@ -172,8 +172,7 @@ msdosfs_create(ap)
 	if (error)
 		goto bad;
 
-	ndirent.de_Attributes = (ap->a_vap->va_mode & VWRITE) ?
-				ATTR_ARCHIVE : ATTR_ARCHIVE | ATTR_READONLY;
+	ndirent.de_Attributes = ATTR_ARCHIVE;
 	ndirent.de_LowerCase = 0;
 	ndirent.de_StartCluster = 0;
 	ndirent.de_FileSize = 0;
@@ -256,8 +255,7 @@ msdosfs_access(ap)
 	mode_t file_mode;
 	accmode_t accmode = ap->a_accmode;
 
-	file_mode = (S_IXUSR|S_IXGRP|S_IXOTH) | (S_IRUSR|S_IRGRP|S_IROTH) |
-	    ((dep->de_Attributes & ATTR_READONLY) ? 0 : (S_IWUSR|S_IWGRP|S_IWOTH));
+	file_mode = S_IRWXU|S_IRWXG|S_IRWXO;
 	file_mode &= (vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask);
 
 	/*
@@ -266,8 +264,8 @@ msdosfs_access(ap)
 	 */
 	if (accmode & VWRITE) {
 		switch (vp->v_type) {
-		case VDIR:
 		case VREG:
+		case VDIR:
 			if (vp->v_mount->mnt_flag & MNT_RDONLY)
 				return (EROFS);
 			break;
@@ -322,10 +320,7 @@ msdosfs_getattr(ap)
 	else
 		vap->va_fileid = (long)fileid;
 
-	if ((dep->de_Attributes & ATTR_READONLY) == 0)
-		mode = S_IRWXU|S_IRWXG|S_IRWXO;
-	else
-		mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
+	mode = S_IRWXU|S_IRWXG|S_IRWXO;
 	vap->va_mode = mode & 
 	    (ap->a_vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask);
 	vap->va_uid = pmp->pm_uid;
@@ -345,8 +340,14 @@ msdosfs_getattr(ap)
 		vap->va_birthtime.tv_nsec = 0;
 	}
 	vap->va_flags = 0;
-	if ((dep->de_Attributes & ATTR_ARCHIVE) == 0)
-		vap->va_flags |= SF_ARCHIVED;
+	if (dep->de_Attributes & ATTR_ARCHIVE)
+		vap->va_flags |= UF_ARCHIVE;
+	if (dep->de_Attributes & ATTR_HIDDEN)
+		vap->va_flags |= UF_HIDDEN;
+	if (dep->de_Attributes & ATTR_READONLY)
+		vap->va_flags |= UF_READONLY;
+	if (dep->de_Attributes & ATTR_SYSTEM)
+		vap->va_flags |= UF_SYSTEM;
 	vap->va_gen = 0;
 	vap->va_blocksize = pmp->pm_bpcluster;
 	vap->va_bytes =
@@ -395,6 +396,18 @@ msdosfs_setattr(ap)
 #endif
 		return (EINVAL);
 	}
+
+	/*
+	 * We don't allow setting attributes on the root directory.
+	 * The special case for the root directory is because before
+	 * FAT32, the root directory didn't have an entry for itself
+	 * (and was otherwise special).  With FAT32, the root
+	 * directory is not so special, but still doesn't have an
+	 * entry for itself.
+	 */
+	if (vp->v_vflag & VV_ROOT)
+		return (EINVAL);
+
 	if (vap->va_flags != VNOVAL) {
 		if (vp->v_mount->mnt_flag & MNT_RDONLY)
 			return (EROFS);
@@ -408,24 +421,29 @@ msdosfs_setattr(ap)
 		 * attributes.  We ignored the access time and the
 		 * read and execute bits.  We were strict for the other
 		 * attributes.
-		 *
-		 * Here we are strict, stricter than ufs in not allowing
-		 * users to attempt to set SF_SETTABLE bits or anyone to
-		 * set unsupported bits.  However, we ignore attempts to
-		 * set ATTR_ARCHIVE for directories `cp -pr' from a more
-		 * sensible filesystem attempts it a lot.
 		 */
-		if (vap->va_flags & SF_SETTABLE) {
-			error = priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0);
-			if (error)
-				return (error);
-		}
-		if (vap->va_flags & ~SF_ARCHIVED)
+		if (vap->va_flags & ~(UF_ARCHIVE | UF_HIDDEN | UF_READONLY |
+		    UF_SYSTEM))
 			return EOPNOTSUPP;
-		if (vap->va_flags & SF_ARCHIVED)
-			dep->de_Attributes &= ~ATTR_ARCHIVE;
-		else if (!(dep->de_Attributes & ATTR_DIRECTORY))
+		if (vap->va_flags & UF_ARCHIVE)
 			dep->de_Attributes |= ATTR_ARCHIVE;
+		else
+			dep->de_Attributes &= ~ATTR_ARCHIVE;
+		if (vap->va_flags & UF_HIDDEN)
+			dep->de_Attributes |= ATTR_HIDDEN;
+		else
+			dep->de_Attributes &= ~ATTR_HIDDEN;
+		/* We don't allow changing the readonly bit on directories. */
+		if (vp->v_type != VDIR) {
+			if (vap->va_flags & UF_READONLY)
+				dep->de_Attributes |= ATTR_READONLY;
+			else
+				dep->de_Attributes &= ~ATTR_READONLY;
+		}
+		if (vap->va_flags & UF_SYSTEM)
+			dep->de_Attributes |= ATTR_SYSTEM;
+		else
+			dep->de_Attributes &= ~ATTR_SYSTEM;
 		dep->de_flag |= DE_MODIFIED;
 	}
 
@@ -489,21 +507,24 @@ msdosfs_setattr(ap)
 				error = VOP_ACCESS(vp, VWRITE, cred, td);
 		} else
 			error = VOP_ACCESS(vp, VADMIN, cred, td);
-		if (vp->v_type != VDIR) {
-			if ((pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0 &&
-			    vap->va_atime.tv_sec != VNOVAL) {
-				dep->de_flag &= ~DE_ACCESS;
-				timespec2fattime(&vap->va_atime, 0,
-				    &dep->de_ADate, NULL, NULL);
-			}
-			if (vap->va_mtime.tv_sec != VNOVAL) {
-				dep->de_flag &= ~DE_UPDATE;
-				timespec2fattime(&vap->va_mtime, 0,
-				    &dep->de_MDate, &dep->de_MTime, NULL);
-			}
-			dep->de_Attributes |= ATTR_ARCHIVE;
-			dep->de_flag |= DE_MODIFIED;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308220710.r7M7AJCK007165>