1 #ifndef __NVIF_UNPACK_H__ 2 #define __NVIF_UNPACK_H__ 3 4 #define nvif_unvers(d) ({ \ 5 ret = (size == sizeof(d)) ? 0 : -ENOSYS; \ 6 (ret == 0); \ 7 }) 8 9 #define nvif_unpack(d,vl,vh,m) ({ \ 10 if ((vl) == 0 || ret == -ENOSYS) { \ 11 int _size = sizeof(d); \ 12 if (_size <= size && (d).version >= (vl) && \ 13 (d).version <= (vh)) { \ 14 data = (u8 *)data + _size; \ 15 size = size - _size; \ 16 ret = ((m) || !size) ? 0 : -E2BIG; \ 17 } else { \ 18 ret = -ENOSYS; \ 19 } \ 20 } \ 21 (ret == 0); \ 22 }) 23 24 #endif 25