svn commit: r254627 - in head: bin/chflags bin/ls lib/libc/gen lib/libc/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/msdosfs sys/fs/smbfs sys/sys sys/ufs/ufs

Bryan Drewery bryan at shatow.net
Wed Aug 28 20:54:24 UTC 2013


On 2013-08-21 18:04, Kenneth D. Merry wrote:
> Author: ken
> Date: Wed Aug 21 23:04:48 2013
> New Revision: 254627
> URL: http://svnweb.freebsd.org/changeset/base/254627
> 
> Log:
>   Expand the use of stat(2) flags to allow storing some Windows/DOS
>   and CIFS file attributes as BSD stat(2) flags.
> 
>   This work is intended to be compatible with ZFS, the Solaris CIFS
>   server's interaction with ZFS, somewhat compatible with MacOS X,
>   and of course compatible with Windows.
> 
>   The Windows attributes that are implemented were chosen based on
>   the attributes that ZFS already supports.
> 
>   The summary of the flags is as follows:
[...]
> 
>   UF_ARCHIVE:	Command line name: "uarch", "uarchive"
>   		ZFS_NAME: XAT_ARCHIVE, ZFS_ARCHIVE
>   		Windows name: FILE_ATTRIBUTE_ARCHIVE
> 
>   		The UF_ARCHIVED flag means that the file has changed and
>   		needs to be archived.  The meaning is same as
>   		the Windows FILE_ATTRIBUTE_ARCHIVE attribute, and
>   		the ZFS XAT_ARCHIVE and ZFS_ARCHIVE attribute.
> 
>   		msdosfs and ZFS have special handling for this flag.
>   		i.e. they will set it when the file changes.

Is it intended that this flag is automatically added to all new and 
existing ZFS files?

# touch test
# ls -alo test
-rw-r--r--- 1 root wheel  uarch  0 Aug 28 15:46 test

This breaks 'cp -p' to tmpfs as tmpfs does not allow this flag.

# mkdir /tmp/tmpfs
# mount -t tmpfs tmpfs /tmp/tmpfs
# cp -f test /tmp/tmpfs
cp: test: Operation not supported


[...]
> Modified: head/sys/ufs/ufs/ufs_vnops.c
> ==============================================================================
> --- head/sys/ufs/ufs/ufs_vnops.c	Wed Aug 21 22:57:29 2013	(r254626)
> +++ head/sys/ufs/ufs/ufs_vnops.c	Wed Aug 21 23:04:48 2013	(r254627)
> @@ -528,9 +528,11 @@ ufs_setattr(ap)
>  		return (EINVAL);
>  	}
>  	if (vap->va_flags != VNOVAL) {
> -		if ((vap->va_flags & ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND |
> -		    UF_OPAQUE | UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE |
> -		    SF_APPEND | SF_NOUNLINK | SF_SNAPSHOT)) != 0)
> +		if ((vap->va_flags & ~(SF_APPEND | SF_ARCHIVED | SF_IMMUTABLE |
> +		    SF_NOUNLINK | SF_SNAPSHOT | UF_APPEND | UF_ARCHIVE |
> +		    UF_HIDDEN | UF_IMMUTABLE | UF_NODUMP | UF_NOUNLINK |
> +		    UF_OFFLINE | UF_OPAQUE | UF_READONLY | UF_REPARSE |
> +		    UF_SPARSE | UF_SYSTEM)) != 0)
>  			return (EOPNOTSUPP);
>  		if (vp->v_mount->mnt_flag & MNT_RDONLY)
>  			return (EROFS);

Seems a similar change is needed in tmpfs_subr.c:tmpfs_chflags() 
(antoine pointed this out)


More information about the svn-src-all mailing list