openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/mtd-utils/2.1.0+AUTOINC+b5027be5f4-r0/git/ubifs-utils/mkfs.ubifs/lpt.c
static void pack_nnode(struct ubifs_info* c, void* buf,
                       struct ubifs_nnode* nnode)
{
    uint8_t* addr = buf + UBIFS_LPT_CRC_BYTES;
    int i, pos = 0;
    uint16_t crc;

    pack_bits(&addr, &pos, UBIFS_LPT_NNODE, UBIFS_LPT_TYPE_BITS);
    if (c->big_lpt)
        pack_bits(&addr, &pos, nnode->num, c->pcnt_bits);
    for (i = 0; i < UBIFS_LPT_FANOUT; i++)
    {
        int lnum = nnode->nbranch[i].lnum;

        if (lnum == 0)
            lnum = c->lpt_last + 1;
        pack_bits(&addr, &pos, lnum - c->lpt_first, c->lpt_lnum_bits);
        pack_bits(&addr, &pos, nnode->nbranch[i].offs, c->lpt_offs_bits);
    }
    crc =
        crc16(-1, buf + UBIFS_LPT_CRC_BYTES, c->nnode_sz - UBIFS_LPT_CRC_BYTES);
    addr = buf;
    pos = 0;
    pack_bits(&addr, &pos, crc, UBIFS_LPT_CRC_BITS);
}
/**
 * pack_nnode - pack all the bit fields of a nnode.
 * @c: UBIFS file-system description object
 * @buf: buffer into which to pack
 * @nnode: nnode to pack
 */
pack all the bit fields of a nnode.
@c: UBIFS file-system description object
@buf: buffer into which to pack
@nnode: nnode to pack
pack all the bit fields of a nnode . @c : UBIFS file - system description object @buf : buffer into which to pack @nnode : nnode to pack
static void pack_nnode(struct ubifs_info* c, void* buf,
                       struct ubifs_nnode* nnode)
{
    uint8_t* addr = buf + UBIFS_LPT_CRC_BYTES;
    int i, pos = 0;
    uint16_t crc;
    pack_bits(&addr, &pos, UBIFS_LPT_NNODE, UBIFS_LPT_TYPE_BITS);
    if (c->big_lpt)
        pack_bits(&addr, &pos, nnode->num, c->pcnt_bits);
    for (i = 0; i < UBIFS_LPT_FANOUT; i++)
    {
        int lnum = nnode->nbranch[i].lnum;
        if (lnum == 0)
            lnum = c->lpt_last + 1;
        pack_bits(&addr, &pos, lnum - c->lpt_first, c->lpt_lnum_bits);
        pack_bits(&addr, &pos, nnode->nbranch[i].offs, c->lpt_offs_bits);
    }
    crc =
        crc16(-1, buf + UBIFS_LPT_CRC_BYTES, c->nnode_sz - UBIFS_LPT_CRC_BYTES);
    addr = buf;
    pos = 0;
    pack_bits(&addr, &pos, crc, UBIFS_LPT_CRC_BITS);
}
static void pack_nnode ( struct ubifs_info * c , void * buf , struct ubifs_nnode * nnode ) { uint8_t * addr = buf + UBIFS_LPT_CRC_BYTES ; int i , pos = 0 ; uint16_t crc ; pack_bits ( & addr , & pos , UBIFS_LPT_NNODE , UBIFS_LPT_TYPE_BITS ) ; if ( c -> big_lpt ) pack_bits ( & addr , & pos , nnode -> num , c -> pcnt_bits ) ; for ( i = 0 ; i < UBIFS_LPT_FANOUT ; i ++ ) { int lnum = nnode -> nbranch [ i ] . lnum ; if ( lnum == 0 ) lnum = c -> lpt_last + 1 ; pack_bits ( & addr , & pos , lnum - c -> lpt_first , c -> lpt_lnum_bits ) ; pack_bits ( & addr , & pos , nnode -> nbranch [ i ] . offs , c -> lpt_offs_bits ) ; } crc = crc16 ( -1 , buf + UBIFS_LPT_CRC_BYTES , c -> nnode_sz - UBIFS_LPT_CRC_BYTES ) ; addr = buf ; pos = 0 ; pack_bits ( & addr , & pos , crc , UBIFS_LPT_CRC_BITS ) ; }
pack_nnode - pack all the bit fields of a nnode.
pack_nnode - pack all the bit fields of a nnode .