コード例 #1
0
ファイル: nfs2xdr.c プロジェクト: rcplay/snake-os
static inline u32 *
xdr_encode_sattr(u32 *p, struct iattr *attr)
{
    const u32 not_set = __constant_htonl(0xFFFFFFFF);

    *p++ = (attr->ia_valid & ATTR_MODE) ? htonl(attr->ia_mode) : not_set;
    *p++ = (attr->ia_valid & ATTR_UID) ? htonl(attr->ia_uid) : not_set;
    *p++ = (attr->ia_valid & ATTR_GID) ? htonl(attr->ia_gid) : not_set;
    *p++ = (attr->ia_valid & ATTR_SIZE) ? htonl(attr->ia_size) : not_set;

    if (attr->ia_valid & ATTR_ATIME_SET) {
        p = xdr_encode_time(p, &attr->ia_atime);
    } else if (attr->ia_valid & ATTR_ATIME) {
        p = xdr_encode_current_server_time(p, &attr->ia_atime);
    } else {
        *p++ = not_set;
        *p++ = not_set;
    }

    if (attr->ia_valid & ATTR_MTIME_SET) {
        p = xdr_encode_time(p, &attr->ia_mtime);
    } else if (attr->ia_valid & ATTR_MTIME) {
        p = xdr_encode_current_server_time(p, &attr->ia_mtime);
    } else {
        *p++ = not_set;
        *p++ = not_set;
    }
    return p;
}
コード例 #2
0
ファイル: nfs2xdr.c プロジェクト: Antonio-Zhou/Linux-2.6.11
static inline u32 *
xdr_encode_sattr(u32 *p, struct iattr *attr)
{
	SATTR(p, attr, ATTR_MODE, ia_mode);
	SATTR(p, attr, ATTR_UID, ia_uid);
	SATTR(p, attr, ATTR_GID, ia_gid);
	SATTR(p, attr, ATTR_SIZE, ia_size);

	if (attr->ia_valid & ATTR_ATIME_SET) {
		p = xdr_encode_time(p, &attr->ia_atime);
	} else if (attr->ia_valid & ATTR_ATIME) {
		p = xdr_encode_current_server_time(p, &attr->ia_atime);
	} else {
		*p++ = ~(u32) 0;
		*p++ = ~(u32) 0;
	}

	if (attr->ia_valid & ATTR_MTIME_SET) {
		p = xdr_encode_time(p, &attr->ia_mtime);
	} else if (attr->ia_valid & ATTR_MTIME) {
		p = xdr_encode_current_server_time(p, &attr->ia_mtime);
	} else {
		*p++ = ~(u32) 0;	
		*p++ = ~(u32) 0;
	}
  	return p;
}
コード例 #3
0
static void encode_sattr(struct xdr_stream *xdr, const struct iattr *attr)
{
	__be32 *p;

	p = xdr_reserve_space(xdr, NFS_sattr_sz << 2);

	if (attr->ia_valid & ATTR_MODE)
		*p++ = cpu_to_be32(attr->ia_mode);
	else
		*p++ = cpu_to_be32(NFS2_SATTR_NOT_SET);
	if (attr->ia_valid & ATTR_UID)
		*p++ = cpu_to_be32(attr->ia_uid);
	else
		*p++ = cpu_to_be32(NFS2_SATTR_NOT_SET);
	if (attr->ia_valid & ATTR_GID)
		*p++ = cpu_to_be32(attr->ia_gid);
	else
		*p++ = cpu_to_be32(NFS2_SATTR_NOT_SET);
	if (attr->ia_valid & ATTR_SIZE)
		*p++ = cpu_to_be32((u32)attr->ia_size);
	else
		*p++ = cpu_to_be32(NFS2_SATTR_NOT_SET);

	if (attr->ia_valid & ATTR_ATIME_SET)
		p = xdr_encode_time(p, &attr->ia_atime);
	else if (attr->ia_valid & ATTR_ATIME)
		p = xdr_encode_current_server_time(p, &attr->ia_atime);
	else
		p = xdr_time_not_set(p);
	if (attr->ia_valid & ATTR_MTIME_SET)
		xdr_encode_time(p, &attr->ia_mtime);
	else if (attr->ia_valid & ATTR_MTIME)
		xdr_encode_current_server_time(p, &attr->ia_mtime);
	else
		xdr_time_not_set(p);
}