FreeBSD kernel libkern code
iconv.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/iconv.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/sx.h>
#include <sys/syslog.h>
#include "iconv_converter_if.h"
Include dependency graph for iconv.c:

Go to the source code of this file.

Functions

 __FBSDID ("$BSDSUniX$")
 
 SYSCTL_DECL (_kern_iconv)
 
 SYSCTL_NODE (_kern, OID_AUTO, iconv, CTLFLAG_RW, NULL,"kernel iconv interface")
 
 MALLOC_DEFINE (M_ICONV,"iconv","ICONV structures")
 
static MALLOC_DEFINE (M_ICONVDATA,"iconv_data","ICONV data")
 
 MODULE_VERSION (libiconv, 2)
 
static TAILQ_HEAD (iconv_converter_list, iconv_converter_class)
 
static int iconv_mod_handler (module_t mod, int type, void *data)
 
 DECLARE_MODULE (iconv, iconv_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND)
 
static int iconv_register_converter (struct iconv_converter_class *dcp)
 
static int iconv_unregister_converter (struct iconv_converter_class *dcp)
 
static int iconv_lookupconv (const char *name, struct iconv_converter_class **dcpp)
 
static int iconv_lookupcs (const char *to, const char *from, struct iconv_cspair **cspp)
 
static int iconv_register_cspair (const char *to, const char *from, struct iconv_converter_class *dcp, void *data, struct iconv_cspair **cspp)
 
static void iconv_unregister_cspair (struct iconv_cspair *csp)
 
int iconv_open (const char *to, const char *from, void **handle)
 
int iconv_close (void *handle)
 
int iconv_conv (void *handle, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
 
int iconv_conv_case (void *handle, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft, int casetype)
 
int iconv_convchr (void *handle, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
 
int iconv_convchr_case (void *handle, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft, int casetype)
 
int towlower (int c, void *handle)
 
int towupper (int c, void *handle)
 
static int iconv_sysctl_drvlist (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern_iconv, OID_AUTO, drvlist, CTLFLAG_RD|CTLTYPE_OPAQUE, NULL, 0, iconv_sysctl_drvlist,"S,xlat","registered converters")
 
static int iconv_sysctl_cslist (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern_iconv, OID_AUTO, cslist, CTLFLAG_RD|CTLTYPE_OPAQUE, NULL, 0, iconv_sysctl_cslist,"S,xlat","registered charset pairs")
 
int iconv_add (const char *converter, const char *to, const char *from)
 
static int iconv_sysctl_add (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern_iconv, OID_AUTO, add, CTLFLAG_RW|CTLTYPE_OPAQUE, NULL, 0, iconv_sysctl_add,"S,xlat","register charset pair")
 
int iconv_converter_initstub (struct iconv_converter_class *dp)
 
int iconv_converter_donestub (struct iconv_converter_class *dp)
 
int iconv_converter_tolowerstub (int c, void *handle)
 
int iconv_converter_handler (module_t mod, int type, void *data)
 
char * iconv_convstr (void *handle, char *dst, const char *src)
 
void * iconv_convmem (void *handle, void *dst, const void *src, int size)
 
int iconv_lookupcp (char **cpp, const char *s)
 
int iconv_vfs_refcount (const char *fsname)
 

Variables

static struct sx iconv_lock
 
struct sysctl_oid * iconv_oid_hook = &sysctl___kern_iconv
 
static moduledata_t iconv_mod
 

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
DECLARE_MODULE ( iconv  ,
iconv_mod  ,
SI_SUB_DRIVERS  ,
SI_ORDER_SECOND   
)
int iconv_add ( const char *  converter,
const char *  to,
const char *  from 
)

Definition at line 383 of file iconv.c.

References iconv_lookupconv(), and iconv_register_cspair().

Referenced by iconv_ucs_init().

Here is the call graph for this function:

Here is the caller graph for this function:

int iconv_close ( void *  handle)

Definition at line 273 of file iconv.c.

Referenced by iconv_ucs_close(), and iconv_xlat16_close().

Here is the caller graph for this function:

int iconv_conv ( void *  handle,
const char **  inbuf,
size_t *  inbytesleft,
char **  outbuf,
size_t *  outbytesleft 
)

Definition at line 279 of file iconv.c.

Referenced by iconv_convmem(), and iconv_convstr().

Here is the caller graph for this function:

int iconv_conv_case ( void *  handle,
const char **  inbuf,
size_t *  inbytesleft,
char **  outbuf,
size_t *  outbytesleft,
int  casetype 
)

Definition at line 286 of file iconv.c.

int iconv_convchr ( void *  handle,
const char **  inbuf,
size_t *  inbytesleft,
char **  outbuf,
size_t *  outbytesleft 
)

Definition at line 293 of file iconv.c.

int iconv_convchr_case ( void *  handle,
const char **  inbuf,
size_t *  inbytesleft,
char **  outbuf,
size_t *  outbytesleft,
int  casetype 
)

Definition at line 300 of file iconv.c.

Referenced by iconv_ucs_conv().

Here is the caller graph for this function:

int iconv_converter_donestub ( struct iconv_converter_class *  dp)

Definition at line 459 of file iconv.c.

int iconv_converter_handler ( module_t  mod,
int  type,
void *  data 
)

Definition at line 471 of file iconv.c.

References iconv_lock, iconv_register_converter(), and iconv_unregister_converter().

Here is the call graph for this function:

int iconv_converter_initstub ( struct iconv_converter_class *  dp)

Definition at line 453 of file iconv.c.

int iconv_converter_tolowerstub ( int  c,
void *  handle 
)

Definition at line 465 of file iconv.c.

void* iconv_convmem ( void *  handle,
void *  dst,
const void *  src,
int  size 
)

Definition at line 527 of file iconv.c.

References iconv_conv().

Here is the call graph for this function:

char* iconv_convstr ( void *  handle,
char *  dst,
const char *  src 
)

Definition at line 505 of file iconv.c.

References iconv_conv(), strcpy(), and strlen().

Here is the call graph for this function:

static int iconv_lookupconv ( const char *  name,
struct iconv_converter_class **  dcpp 
)
static

Definition at line 148 of file iconv.c.

References strcmp().

Referenced by iconv_add(), and iconv_sysctl_add().

Here is the call graph for this function:

Here is the caller graph for this function:

int iconv_lookupcp ( char **  cpp,
const char *  s 
)

Definition at line 551 of file iconv.c.

References strcmp().

Here is the call graph for this function:

static int iconv_lookupcs ( const char *  to,
const char *  from,
struct iconv_cspair **  cspp 
)
static

Definition at line 165 of file iconv.c.

References strcasecmp().

Referenced by iconv_open(), and iconv_register_cspair().

Here is the call graph for this function:

Here is the caller graph for this function:

static int iconv_mod_handler ( module_t  mod,
int  type,
void *  data 
)
static

Definition at line 102 of file iconv.c.

References iconv_lock.

int iconv_open ( const char *  to,
const char *  from,
void **  handle 
)

Definition at line 236 of file iconv.c.

References cspfrom, cspto, and iconv_lookupcs().

Referenced by iconv_ucs_open(), and iconv_xlat16_open().

Here is the call graph for this function:

Here is the caller graph for this function:

static int iconv_register_converter ( struct iconv_converter_class *  dcp)
static

Definition at line 127 of file iconv.c.

Referenced by iconv_converter_handler().

Here is the caller graph for this function:

static int iconv_register_cspair ( const char *  to,
const char *  from,
struct iconv_converter_class *  dcp,
void *  data,
struct iconv_cspair **  cspp 
)
static

Definition at line 181 of file iconv.c.

References iconv_lookupcs(), strcmp(), strcpy(), and strlen().

Referenced by iconv_add(), and iconv_sysctl_add().

Here is the call graph for this function:

Here is the caller graph for this function:

static int iconv_sysctl_add ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 398 of file iconv.c.

References iconv_lock, iconv_lookupconv(), iconv_register_cspair(), iconv_unregister_cspair(), and strlen().

Here is the call graph for this function:

static int iconv_sysctl_cslist ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 355 of file iconv.c.

References iconv_lock, and strcpy().

Here is the call graph for this function:

static int iconv_sysctl_drvlist ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 323 of file iconv.c.

References iconv_lock, name, and strlen().

Here is the call graph for this function:

static int iconv_unregister_converter ( struct iconv_converter_class *  dcp)
static

Definition at line 136 of file iconv.c.

Referenced by iconv_converter_handler().

Here is the caller graph for this function:

static void iconv_unregister_cspair ( struct iconv_cspair *  csp)
static

Definition at line 222 of file iconv.c.

Referenced by iconv_sysctl_add(), and TAILQ_HEAD().

Here is the caller graph for this function:

int iconv_vfs_refcount ( const char *  fsname)

Definition at line 569 of file iconv.c.

MALLOC_DEFINE ( M_ICONV  ,
"iconv"  ,
"ICONV structures"   
)
static MALLOC_DEFINE ( M_ICONVDATA  ,
"iconv_data"  ,
"ICONV data"   
)
static
MODULE_VERSION ( libiconv  ,
 
)
SYSCTL_DECL ( _kern_iconv  )
SYSCTL_NODE ( _kern  ,
OID_AUTO  ,
iconv  ,
CTLFLAG_RW  ,
NULL  ,
"kernel iconv interface"   
)
SYSCTL_PROC ( _kern_iconv  ,
OID_AUTO  ,
drvlist  ,
CTLFLAG_RD|  CTLTYPE_OPAQUE,
NULL  ,
,
iconv_sysctl_drvlist  ,
S,
xlat"  ,
"registered converters"   
)
SYSCTL_PROC ( _kern_iconv  ,
OID_AUTO  ,
cslist  ,
CTLFLAG_RD|  CTLTYPE_OPAQUE,
NULL  ,
,
iconv_sysctl_cslist  ,
S,
xlat"  ,
"registered charset pairs"   
)
SYSCTL_PROC ( _kern_iconv  ,
OID_AUTO  ,
add  ,
CTLFLAG_RW|  CTLTYPE_OPAQUE,
NULL  ,
,
iconv_sysctl_add  ,
S,
xlat"  ,
"register charset pair"   
)
static TAILQ_HEAD ( iconv_converter_list  ,
iconv_converter_class   
)
static

Definition at line 67 of file iconv.c.

References iconv_lock, and iconv_unregister_cspair().

Here is the call graph for this function:

int towlower ( int  c,
void *  handle 
)

Definition at line 307 of file iconv.c.

Referenced by iconv_ucs_conv(), and iconv_xlat16_conv().

Here is the caller graph for this function:

int towupper ( int  c,
void *  handle 
)

Definition at line 313 of file iconv.c.

Referenced by iconv_ucs_conv(), and iconv_xlat16_conv().

Here is the caller graph for this function:

Variable Documentation

struct sx iconv_lock
static
moduledata_t iconv_mod
static
Initial value:
= {
"iconv", iconv_mod_handler, NULL
}
static int iconv_mod_handler(module_t mod, int type, void *data)
Definition: iconv.c:102

Definition at line 120 of file iconv.c.

struct sysctl_oid* iconv_oid_hook = &sysctl___kern_iconv

Definition at line 62 of file iconv.c.