The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Functions
size.c File Reference

Size printing and parsing functions. More...

#include <freeradius-devel/util/math.h>
#include <freeradius-devel/util/sbuff.h>
#include "size.h"
+ Include dependency graph for size.c:

Go to the source code of this file.

Data Structures

struct  fr_size_unit_t
 

Functions

fr_slen_t fr_size_from_str (size_t *out, fr_sbuff_t *in)
 Parse a size string with optional unit. More...
 
fr_slen_t fr_size_to_str (fr_sbuff_t *out, size_t in)
 Print a size string with unit. More...
 

Detailed Description

Size printing and parsing functions.

Definition in file size.c.


Data Structure Documentation

◆ fr_size_unit_t

struct fr_size_unit_t

Definition at line 140 of file size.c.

Data Fields
uint64_t mul
char const * suffix

Function Documentation

◆ fr_size_from_str()

fr_slen_t fr_size_from_str ( size_t out,
fr_sbuff_t in 
)

Parse a size string with optional unit.

Default scale with no suffix is bytes.

Parameters
[out]outParsed and scaled size
[in]insbuff to parse.
Returns
  • >0 on success.
  • <0 on error.

Definition at line 40 of file size.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_size_to_str()

fr_slen_t fr_size_to_str ( fr_sbuff_t out,
size_t  in 
)

Print a size string with unit.

Suffix is the largest unit possible without losing precision.

Parameters
[out]outTo write size to.
[in]insize to print.
Returns
  • >0 on success.
  • <0 on error.

Definition at line 155 of file size.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: