Re: [PATCH] xfs_io: changes to statx interface [ver #3]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Howells <dhowells@xxxxxxxxxx> wrote:

> Here's my third attempt at changing Eric's statx patch.  I've got rid of the
> compare option to statx and added a raw output option to stat.  They're still
> not directly comparable since the stat output lacks some fields, but it will
> hopefully be possible to load them into associative arrays in bash and compare
> them that way.

Kind of like this:

function cmpstat () {
    file=$1
    declare -A st stx

    # Read the stat output
    coproc { xfs_io -c "open -P $file" -c "stat -r" | sed -e s/://; }
    while read tag val
    do
	st[$tag]=$val
    done <&${COPROC[0]}
    wait || exit $?

    # Read the statx output
    coproc { xfs_io -c "open -P $file" -c "statx" | sed -e s/://; }
    while read tag val
    do
	stx[$tag]=$val
    done <&${COPROC[0]}
    wait || exit $?

    # Compare them
    for key in ${!stx[*]}
    do
	if [ "${stx[$key]}" != "${st[$key]}" ]
	then
	    case $key in
		stat.mask|stat.attributes|stat.btime.tv_*)
		    # Not supported in stat
		    ;;
		*)
		    echo differ $key "${stx[$key]}" != "${st[$key]}"
		    ;;
	    esac
	fi
    done
}

cmpstat /



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux