xfs
[Top] [All Lists]

simpler _xfs_dic2xflags() ?

To: linux-xfs <linux-xfs@xxxxxxxxxxx>
Subject: simpler _xfs_dic2xflags() ?
From: utz lehmann <xfs2@xxxxxxxxxx>
Date: Sat, 14 Aug 2010 00:29:51 +0200
Hello

I just found following function in xfs_inode.c:

STATIC uint
_xfs_dic2xflags(
        __uint16_t              di_flags)
{
        uint                    flags = 0;

        if (di_flags & XFS_DIFLAG_ANY) {
                if (di_flags & XFS_DIFLAG_REALTIME)
                        flags |= XFS_XFLAG_REALTIME;
                if (di_flags & XFS_DIFLAG_PREALLOC)
                        flags |= XFS_XFLAG_PREALLOC;
                if (di_flags & XFS_DIFLAG_IMMUTABLE)
                        flags |= XFS_XFLAG_IMMUTABLE;
                if (di_flags & XFS_DIFLAG_APPEND)
                        flags |= XFS_XFLAG_APPEND;
                if (di_flags & XFS_DIFLAG_SYNC)
                        flags |= XFS_XFLAG_SYNC;
                if (di_flags & XFS_DIFLAG_NOATIME)
                        flags |= XFS_XFLAG_NOATIME;
                if (di_flags & XFS_DIFLAG_NODUMP)
                        flags |= XFS_XFLAG_NODUMP;
                if (di_flags & XFS_DIFLAG_RTINHERIT)
                        flags |= XFS_XFLAG_RTINHERIT;
                if (di_flags & XFS_DIFLAG_PROJINHERIT)
                        flags |= XFS_XFLAG_PROJINHERIT;
                if (di_flags & XFS_DIFLAG_NOSYMLINKS)
                        flags |= XFS_XFLAG_NOSYMLINKS;
                if (di_flags & XFS_DIFLAG_EXTSIZE)
                        flags |= XFS_XFLAG_EXTSIZE;
                if (di_flags & XFS_DIFLAG_EXTSZINHERIT)
                        flags |= XFS_XFLAG_EXTSZINHERIT;
                if (di_flags & XFS_DIFLAG_NODEFRAG)
                        flags |= XFS_XFLAG_NODEFRAG;
                if (di_flags & XFS_DIFLAG_FILESTREAM)
                        flags |= XFS_XFLAG_FILESTREAM;
        }

        return flags;
}

Can't the whole function be replaced by something like this?

flags = di_flags & MASK;

The corresponding XFS_DIFLAGS and XFS_XFLAGS have the same values.


utz


<Prev in Thread] Current Thread [Next in Thread>