File indexing completed on 2025-01-18 10:01:48
0001 #ifndef __NVIF_UNPACK_H__
0002 #define __NVIF_UNPACK_H__
0003
0004 #define nvif_unvers(r,d,s,m) ({ \
0005 void **_data = (d); __u32 *_size = (s); int _ret = (r); \
0006 if (_ret == -ENOSYS && *_size == sizeof(m)) { \
0007 *_data = NULL; \
0008 *_size = _ret = 0; \
0009 } \
0010 _ret; \
0011 })
0012
0013 #define nvif_unpack(r,d,s,m,vl,vh,x) ({ \
0014 void **_data = (d); __u32 *_size = (s); \
0015 int _ret = (r), _vl = (vl), _vh = (vh); \
0016 if (_ret == -ENOSYS && *_size >= sizeof(m) && \
0017 (m).version >= _vl && (m).version <= _vh) { \
0018 *_data = (__u8 *)*_data + sizeof(m); \
0019 *_size = *_size - sizeof(m); \
0020 if (_ret = 0, !(x)) { \
0021 _ret = *_size ? -E2BIG : 0; \
0022 *_data = NULL; \
0023 *_size = 0; \
0024 } \
0025 } \
0026 _ret; \
0027 })
0028 #endif