Skip to content

Commit 86932e5

Browse files
authored
Merge pull request #156 from igaw/build-static-inline
util: Define inline function as static inline
2 parents 1a49e08 + 3d04b2c commit 86932e5

1 file changed

Lines changed: 54 additions & 31 deletions

File tree

src/nvme/util.h

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ int nvme_get_directive_receive_length(enum nvme_directive_dtype dtype,
114114
#define NVME_FEAT_ARB_MPW(v) NVME_GET(v, FEAT_ARBITRATION_MPW)
115115
#define NVME_FEAT_ARB_HPW(v) NVME_GET(v, FEAT_ARBITRATION_HPW)
116116

117-
inline void nvme_feature_decode_arbitration(__u32 value, __u8 *ab, __u8 *lpw,
118-
__u8 *mpw, __u8 *hpw)
117+
static inline void nvme_feature_decode_arbitration(__u32 value, __u8 *ab,
118+
__u8 *lpw, __u8 *mpw,
119+
__u8 *hpw)
119120
{
120121
*ab = NVME_FEAT_ARB_BURST(value);
121122
*lpw = NVME_FEAT_ARB_LPW(value);
@@ -126,15 +127,16 @@ inline void nvme_feature_decode_arbitration(__u32 value, __u8 *ab, __u8 *lpw,
126127
#define NVME_FEAT_PM_PS(v) NVME_GET(v, FEAT_PWRMGMT_PS)
127128
#define NVME_FEAT_PM_WH(v) NVME_GET(v, FEAT_PWRMGMT_WH)
128129

129-
inline void nvme_feature_decode_power_mgmt(__u32 value, __u8 *ps, __u8 *wh)
130+
static inline void nvme_feature_decode_power_mgmt(__u32 value, __u8 *ps,
131+
__u8 *wh)
130132
{
131133
*ps = NVME_FEAT_PM_PS(value);
132134
*wh = NVME_FEAT_PM_WH(value);
133135
}
134136

135137
#define NVME_FEAT_LBAR_NR(v) NVME_GET(v, FEAT_LBAR_NR)
136138

137-
inline void nvme_feature_decode_lba_range(__u32 value, __u8 *num)
139+
static inline void nvme_feature_decode_lba_range(__u32 value, __u8 *num)
138140
{
139141
*num = NVME_FEAT_LBAR_NR(value);
140142
}
@@ -143,8 +145,8 @@ inline void nvme_feature_decode_lba_range(__u32 value, __u8 *num)
143145
#define NVME_FEAT_TT_TMPSEL(v) NVME_GET(v, FEAT_TT_TMPSEL)
144146
#define NVME_FEAT_TT_THSEL(v) NVME_GET(v, FEAT_TT_THSEL)
145147

146-
inline void nvme_feature_decode_temp_threshold(__u32 value, __u16 *tmpth,
147-
__u8 *tmpsel, __u8 *thsel)
148+
static inline void nvme_feature_decode_temp_threshold(__u32 value, __u16 *tmpth,
149+
__u8 *tmpsel, __u8 *thsel)
148150
{
149151
*tmpth = NVME_FEAT_TT_TMPTH(value);
150152
*tmpsel = NVME_FEAT_TT_TMPSEL(value);
@@ -154,23 +156,27 @@ inline void nvme_feature_decode_temp_threshold(__u32 value, __u16 *tmpth,
154156
#define NVME_FEAT_ER_TLER(v) NVME_GET(v, FEAT_ERROR_RECOVERY_TLER)
155157
#define NVME_FEAT_ER_DULBE(v) NVME_GET(v, FEAT_ERROR_RECOVERY_DULBE)
156158

157-
inline void nvme_feature_decode_error_recovery(__u32 value, __u16 *tler, bool *dulbe)
159+
static inline void nvme_feature_decode_error_recovery(__u32 value, __u16 *tler,
160+
bool *dulbe)
158161
{
159162
*tler = NVME_FEAT_ER_TLER(value);
160163
*dulbe = NVME_FEAT_ER_DULBE(value);
161164
}
162165

163166
#define NVME_FEAT_VWC_WCE(v) NVME_GET(v, FEAT_VWC_WCE)
164167

165-
inline void nvme_feature_decode_volatile_write_cache(__u32 value, bool *wce)
168+
static inline void nvme_feature_decode_volatile_write_cache(__u32 value,
169+
bool *wce)
166170
{
167171
*wce = NVME_FEAT_VWC_WCE(value);
168172
}
169173

170174
#define NVME_FEAT_NRQS_NSQR(v) NVME_GET(v, FEAT_NRQS_NSQR)
171175
#define NVME_FEAT_NRQS_NCQR(v) NVME_GET(v, FEAT_NRQS_NCQR)
172176

173-
inline void nvme_feature_decode_number_of_queues(__u32 value, __u16 *nsqr, __u16 *ncqr)
177+
static inline void nvme_feature_decode_number_of_queues(__u32 value,
178+
__u16 *nsqr,
179+
__u16 *ncqr)
174180
{
175181
*nsqr = NVME_FEAT_NRQS_NSQR(value);
176182
*ncqr = NVME_FEAT_NRQS_NCQR(value);
@@ -179,7 +185,9 @@ inline void nvme_feature_decode_number_of_queues(__u32 value, __u16 *nsqr, __u16
179185
#define NVME_FEAT_IRQC_THR(v) NVME_GET(v, FEAT_IRQC_THR)
180186
#define NVME_FEAT_IRQC_TIME(v) NVME_GET(v, FEAT_IRQC_TIME)
181187

182-
inline void nvme_feature_decode_interrupt_coalescing(__u32 value, __u8 *thr, __u8 *time)
188+
static inline void nvme_feature_decode_interrupt_coalescing(__u32 value,
189+
__u8 *thr,
190+
__u8 *time)
183191
{
184192
*thr = NVME_FEAT_IRQC_THR(value);
185193
*time = NVME_FEAT_IRQC_TIME(value);
@@ -188,15 +196,16 @@ inline void nvme_feature_decode_interrupt_coalescing(__u32 value, __u8 *thr, __u
188196
#define NVME_FEAT_ICFG_IV(v) NVME_GET(v, FEAT_ICFG_IV)
189197
#define NVME_FEAT_ICFG_CD(v) NVME_GET(v, FEAT_ICFG_CD)
190198

191-
inline void nvme_feature_decode_interrupt_config(__u32 value, __u16 *iv, bool *cd)
199+
static inline void nvme_feature_decode_interrupt_config(__u32 value, __u16 *iv,
200+
bool *cd)
192201
{
193202
*iv = NVME_FEAT_ICFG_IV(value);
194203
*cd = NVME_FEAT_ICFG_CD(value);
195204
}
196205

197206
#define NVME_FEAT_WA_DN(v) NVME_GET(v, FEAT_WA_DN)
198207

199-
inline void nvme_feature_decode_write_atomicity(__u32 value, bool *dn)
208+
static inline void nvme_feature_decode_write_atomicity(__u32 value, bool *dn)
200209
{
201210
*dn = NVME_FEAT_WA_DN(value);
202211
}
@@ -210,9 +219,9 @@ inline void nvme_feature_decode_write_atomicity(__u32 value, bool *dn)
210219
#define NVME_FEAT_AE_LBAS(v) NVME_GET(v, FEAT_AE_LBAS)
211220
#define NVME_FEAT_AE_EGA(v) NVME_GET(v, FEAT_AE_EGA)
212221

213-
inline void nvme_feature_decode_async_event_config(__u32 value, __u8 *smart,
214-
bool *nan, bool *fw, bool *telem, bool *ana, bool *pla, bool *lbas,
215-
bool *ega)
222+
static inline void nvme_feature_decode_async_event_config(__u32 value,
223+
__u8 *smart, bool *nan, bool *fw, bool *telem,
224+
bool *ana, bool *pla, bool *lbas, bool *ega)
216225
{
217226
*smart = NVME_FEAT_AE_SMART(value);
218227
*nan = NVME_FEAT_AE_NAN(value);
@@ -226,75 +235,84 @@ inline void nvme_feature_decode_async_event_config(__u32 value, __u8 *smart,
226235

227236
#define NVME_FEAT_APST_APSTE(v) NVME_GET(v, FEAT_APST_APSTE)
228237

229-
inline void nvme_feature_decode_auto_power_state(__u32 value, bool *apste)
238+
static inline void nvme_feature_decode_auto_power_state(__u32 value,
239+
bool *apste)
230240
{
231241
*apste = NVME_FEAT_APST_APSTE(value);
232242
}
233243

234244
#define NVME_FEAT_HMEM_EHM(v) NVME_GET(v, FEAT_HMEM_EHM)
235245

236-
inline void nvme_feature_decode_host_memory_buffer(__u32 value, bool *ehm)
246+
static inline void nvme_feature_decode_host_memory_buffer(__u32 value, bool *ehm)
237247
{
238248
*ehm = NVME_FEAT_HMEM_EHM(value);
239249
}
240250

241251
#define NVME_FEAT_HCTM_TMT2(v) NVME_GET(v, FEAT_HCTM_TMT2)
242252
#define NVME_FEAT_HCTM_TMT1(v) NVME_GET(v, FEAT_HCTM_TMT1)
243253

244-
inline void nvme_feature_decode_host_thermal_mgmt(__u32 value, __u16 *tmt2, __u16 *tmt1)
254+
static inline void nvme_feature_decode_host_thermal_mgmt(__u32 value,
255+
__u16 *tmt2,
256+
__u16 *tmt1)
245257
{
246258
*tmt2 = NVME_FEAT_HCTM_TMT2(value);
247259
*tmt1 = NVME_FEAT_HCTM_TMT1(value);
248260
}
249261

250262
#define NVME_FEAT_NOPS_NOPPME(v) NVME_GET(v, FEAT_NOPS_NOPPME)
251263

252-
inline void nvme_feature_decode_non_op_power_config(__u32 value, bool *noppme)
264+
static inline void nvme_feature_decode_non_op_power_config(__u32 value,
265+
bool *noppme)
253266
{
254267
*noppme = NVME_FEAT_NOPS_NOPPME(value);
255268
}
256269

257270
#define NVME_FEAT_RRL_RRL(v) NVME_GET(v, FEAT_RRL_RRL)
258271

259-
inline void nvme_feature_decode_read_recovery_level_config(__u32 value, __u8 *rrl)
272+
static inline void nvme_feature_decode_read_recovery_level_config(__u32 value,
273+
__u8 *rrl)
260274
{
261275
*rrl = NVME_FEAT_RRL_RRL(value);
262276
}
263277

264278
#define NVME_FEAT_PLM_PLME(v) NVME_GET(v, FEAT_PLM_PLME)
265279

266-
inline void nvme_feature_decode_predictable_latency_mode_config(__u32 value, bool *plme)
280+
static inline void nvme_feature_decode_predictable_latency_mode_config(__u32 value,
281+
bool *plme)
267282
{
268283
*plme = NVME_FEAT_PLM_PLME(value);
269284
}
270285

271286
#define NVME_FEAT_PLMW_WS(v) NVME_GET(v, FEAT_PLMW_WS)
272287

273-
inline void nvme_feature_decode_predictable_latency_mode_window(__u32 value, __u8 *ws)
288+
static inline void nvme_feature_decode_predictable_latency_mode_window(__u32 value,
289+
__u8 *ws)
274290
{
275291
*ws = NVME_FEAT_PLMW_WS(value);
276292
}
277293

278294
#define NVME_FEAT_LBAS_LSIRI(v) NVME_GET(v, FEAT_LBAS_LSIRI)
279295
#define NVME_FEAT_LBAS_LSIPI(v) NVME_GET(v, FEAT_LBAS_LSIPI)
280296

281-
inline void nvme_feature_decode_lba_status_attributes(__u32 value, __u16 *lsiri, __u16 *lsipi)
297+
static inline void nvme_feature_decode_lba_status_attributes(__u32 value,
298+
__u16 *lsiri,
299+
__u16 *lsipi)
282300
{
283301
*lsiri = NVME_FEAT_LBAS_LSIRI(value);
284302
*lsipi = NVME_FEAT_LBAS_LSIPI(value);
285303
}
286304

287305
#define NVME_FEAT_SC_NODRM(v) NVME_GET(v, FEAT_SC_NODRM)
288306

289-
inline void nvme_feature_decode_sanitize_config(__u32 value, bool *nodrm)
307+
static inline void nvme_feature_decode_sanitize_config(__u32 value, bool *nodrm)
290308
{
291309
*nodrm = NVME_FEAT_SC_NODRM(value);
292310
}
293311

294312
#define NVME_FEAT_EG_ENDGID(v) NVME_GET(v, FEAT_EG_ENDGID)
295313
#define NVME_FEAT_EG_EGCW(v) NVME_GET(v, FEAT_EG_EGCW)
296314

297-
inline void nvme_feature_decode_endurance_group_event_config(__u32 value,
315+
static inline void nvme_feature_decode_endurance_group_event_config(__u32 value,
298316
__u16 *endgid, __u8 *endgcw)
299317
{
300318
*endgid = NVME_FEAT_EG_ENDGID(value);
@@ -303,14 +321,15 @@ inline void nvme_feature_decode_endurance_group_event_config(__u32 value,
303321

304322
#define NVME_FEAT_SPM_PBSLC(v) NVME_GET(v, FEAT_SPM_PBSLC)
305323

306-
inline void nvme_feature_decode_software_progress_marker(__u32 value, __u8 *pbslc)
324+
static inline void nvme_feature_decode_software_progress_marker(__u32 value,
325+
__u8 *pbslc)
307326
{
308327
*pbslc = NVME_FEAT_SPM_PBSLC(value);
309328
}
310329

311330
#define NVME_FEAT_HOSTID_EXHID(v) NVME_GET(v, FEAT_HOSTID_EXHID)
312331

313-
inline void nvme_feature_decode_host_identifier(__u32 value, bool *exhid)
332+
static inline void nvme_feature_decode_host_identifier(__u32 value, bool *exhid)
314333
{
315334
*exhid = NVME_FEAT_HOSTID_EXHID(value);
316335
}
@@ -319,8 +338,10 @@ inline void nvme_feature_decode_host_identifier(__u32 value, bool *exhid)
319338
#define NVME_FEAT_RM_RESREL(v) NVME_GET(v, FEAT_RM_RESREL)
320339
#define NVME_FEAT_RM_RESPRE(v) NVME_GET(v, FEAT_RM_RESPRE)
321340

322-
inline void nvme_feature_decode_reservation_notification(__u32 value, bool *regpre,
323-
bool *resrel, bool *respre)
341+
static inline void nvme_feature_decode_reservation_notification(__u32 value,
342+
bool *regpre,
343+
bool *resrel,
344+
bool *respre)
324345
{
325346
*regpre = NVME_FEAT_RM_REGPRE(value);
326347
*resrel = NVME_FEAT_RM_RESREL(value);
@@ -329,14 +350,16 @@ inline void nvme_feature_decode_reservation_notification(__u32 value, bool *regp
329350

330351
#define NVME_FEAT_RP_PTPL(v) NVME_GET(v, FEAT_RP_PTPL)
331352

332-
inline void nvme_feature_decode_reservation_persistance(__u32 value, bool *ptpl)
353+
static inline void nvme_feature_decode_reservation_persistance(__u32 value,
354+
bool *ptpl)
333355
{
334356
*ptpl = NVME_FEAT_RP_PTPL(value);
335357
}
336358

337359
#define NVME_FEAT_WP_WPS(v) NVME_GET(v, FEAT_WP_WPS)
338360

339-
inline void nvme_feature_decode_namespace_write_protect(__u32 value, __u8 *wps)
361+
static inline void nvme_feature_decode_namespace_write_protect(__u32 value,
362+
__u8 *wps)
340363
{
341364
*wps = NVME_FEAT_WP_WPS(value);
342365
}

0 commit comments

Comments
 (0)