diff options
-rw-r--r-- | fs/nfs/nfs2xdr.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index 59049e864ca7..7fc0560c89c9 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c | |||
@@ -146,23 +146,23 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr) | |||
146 | return p; | 146 | return p; |
147 | } | 147 | } |
148 | 148 | ||
149 | #define SATTR(p, attr, flag, field) \ | ||
150 | *p++ = (attr->ia_valid & flag) ? htonl(attr->field) : ~(u32) 0 | ||
151 | static inline u32 * | 149 | static inline u32 * |
152 | xdr_encode_sattr(u32 *p, struct iattr *attr) | 150 | xdr_encode_sattr(u32 *p, struct iattr *attr) |
153 | { | 151 | { |
154 | SATTR(p, attr, ATTR_MODE, ia_mode); | 152 | const u32 not_set = __constant_htonl(0xFFFFFFFF); |
155 | SATTR(p, attr, ATTR_UID, ia_uid); | 153 | |
156 | SATTR(p, attr, ATTR_GID, ia_gid); | 154 | *p++ = (attr->ia_valid & ATTR_MODE) ? htonl(attr->ia_mode) : not_set; |
157 | SATTR(p, attr, ATTR_SIZE, ia_size); | 155 | *p++ = (attr->ia_valid & ATTR_UID) ? htonl(attr->ia_uid) : not_set; |
156 | *p++ = (attr->ia_valid & ATTR_GID) ? htonl(attr->ia_gid) : not_set; | ||
157 | *p++ = (attr->ia_valid & ATTR_SIZE) ? htonl(attr->ia_size) : not_set; | ||
158 | 158 | ||
159 | if (attr->ia_valid & ATTR_ATIME_SET) { | 159 | if (attr->ia_valid & ATTR_ATIME_SET) { |
160 | p = xdr_encode_time(p, &attr->ia_atime); | 160 | p = xdr_encode_time(p, &attr->ia_atime); |
161 | } else if (attr->ia_valid & ATTR_ATIME) { | 161 | } else if (attr->ia_valid & ATTR_ATIME) { |
162 | p = xdr_encode_current_server_time(p, &attr->ia_atime); | 162 | p = xdr_encode_current_server_time(p, &attr->ia_atime); |
163 | } else { | 163 | } else { |
164 | *p++ = ~(u32) 0; | 164 | *p++ = not_set; |
165 | *p++ = ~(u32) 0; | 165 | *p++ = not_set; |
166 | } | 166 | } |
167 | 167 | ||
168 | if (attr->ia_valid & ATTR_MTIME_SET) { | 168 | if (attr->ia_valid & ATTR_MTIME_SET) { |
@@ -170,12 +170,11 @@ xdr_encode_sattr(u32 *p, struct iattr *attr) | |||
170 | } else if (attr->ia_valid & ATTR_MTIME) { | 170 | } else if (attr->ia_valid & ATTR_MTIME) { |
171 | p = xdr_encode_current_server_time(p, &attr->ia_mtime); | 171 | p = xdr_encode_current_server_time(p, &attr->ia_mtime); |
172 | } else { | 172 | } else { |
173 | *p++ = ~(u32) 0; | 173 | *p++ = not_set; |
174 | *p++ = ~(u32) 0; | 174 | *p++ = not_set; |
175 | } | 175 | } |
176 | return p; | 176 | return p; |
177 | } | 177 | } |
178 | #undef SATTR | ||
179 | 178 | ||
180 | /* | 179 | /* |
181 | * NFS encode functions | 180 | * NFS encode functions |