1 #ifndef __NVIF_UNPACK_H__ 2 #define __NVIF_UNPACK_H__ 3 4 #define nvif_unvers(r,d,s,m) ({ \ 5 void **_data = (d); __u32 *_size = (s); int _ret = (r); \ 6 if (_ret == -ENOSYS && *_size == sizeof(m)) { \ 7 *_data = NULL; \ 8 *_size = _ret = 0; \ 9 } \ 10 _ret; \ 11 }) 12 13 #define nvif_unpack(r,d,s,m,vl,vh,x) ({ \ 14 void **_data = (d); __u32 *_size = (s); \ 15 int _ret = (r), _vl = (vl), _vh = (vh); \ 16 if (_ret == -ENOSYS && *_size >= sizeof(m) && \ 17 (m).version >= _vl && (m).version <= _vh) { \ 18 *_data = (__u8 *)*_data + sizeof(m); \ 19 *_size = *_size - sizeof(m); \ 20 if (_ret = 0, !(x)) { \ 21 _ret = *_size ? -E2BIG : 0; \ 22 *_data = NULL; \ 23 *_size = 0; \ 24 } \ 25 } \ 26 _ret; \ 27 }) 28 #endif 29