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_pnode(struct ubifs_info* c, void* buf,
                       struct ubifs_pnode* pnode)
{
    uint8_t* addr = buf + UBIFS_LPT_CRC_BYTES;
    int i, pos = 0;
    uint16_t crc;

    pack_bits(&addr, &pos, UBIFS_LPT_PNODE, UBIFS_LPT_TYPE_BITS);
    if (c->big_lpt)
        pack_bits(&addr, &pos, pnode->num, c->pcnt_bits);
    for (i = 0; i < UBIFS_LPT_FANOUT; i++)
    {
        pack_bits(&addr, &pos, pnode->lprops[i].free >> 3, c->space_bits);
        pack_bits(&addr, &pos, pnode->lprops[i].dirty >> 3, c->space_bits);
        if (pnode->lprops[i].flags & LPROPS_INDEX)
            pack_bits(&addr, &pos, 1, 1);
        else
            pack_bits(&addr, &pos, 0, 1);
    }
    crc =
        crc16(-1, buf + UBIFS_LPT_CRC_BYTES, c->pnode_sz - UBIFS_LPT_CRC_BYTES);
    addr = buf;
    pos = 0;
    pack_bits(&addr, &pos, crc, UBIFS_LPT_CRC_BITS);
}
/**
 * pack_pnode - pack all the bit fields of a pnode.
 * @c: UBIFS file-system description object
 * @buf: buffer into which to pack
 * @pnode: pnode to pack
 */
pack all the bit fields of a pnode.
@c: UBIFS file-system description object
@buf: buffer into which to pack
@pnode: pnode to pack
pack all the bit fields of a pnode . @c : UBIFS file - system description object @buf : buffer into which to pack @pnode : pnode to pack
static void pack_pnode(struct ubifs_info* c, void* buf,
                       struct ubifs_pnode* pnode)
{
    uint8_t* addr = buf + UBIFS_LPT_CRC_BYTES;
    int i, pos = 0;
    uint16_t crc;
    pack_bits(&addr, &pos, UBIFS_LPT_PNODE, UBIFS_LPT_TYPE_BITS);
    if (c->big_lpt)
        pack_bits(&addr, &pos, pnode->num, c->pcnt_bits);
    for (i = 0; i < UBIFS_LPT_FANOUT; i++)
    {
        pack_bits(&addr, &pos, pnode->lprops[i].free >> 3, c->space_bits);
        pack_bits(&addr, &pos, pnode->lprops[i].dirty >> 3, c->space_bits);
        if (pnode->lprops[i].flags & LPROPS_INDEX)
            pack_bits(&addr, &pos, 1, 1);
        else
            pack_bits(&addr, &pos, 0, 1);
    }
    crc =
        crc16(-1, buf + UBIFS_LPT_CRC_BYTES, c->pnode_sz - UBIFS_LPT_CRC_BYTES);
    addr = buf;
    pos = 0;
    pack_bits(&addr, &pos, crc, UBIFS_LPT_CRC_BITS);
}
static void pack_pnode ( struct ubifs_info * c , void * buf , struct ubifs_pnode * pnode ) { uint8_t * addr = buf + UBIFS_LPT_CRC_BYTES ; int i , pos = 0 ; uint16_t crc ; pack_bits ( & addr , & pos , UBIFS_LPT_PNODE , UBIFS_LPT_TYPE_BITS ) ; if ( c -> big_lpt ) pack_bits ( & addr , & pos , pnode -> num , c -> pcnt_bits ) ; for ( i = 0 ; i < UBIFS_LPT_FANOUT ; i ++ ) { pack_bits ( & addr , & pos , pnode -> lprops [ i ] . free >> 3 , c -> space_bits ) ; pack_bits ( & addr , & pos , pnode -> lprops [ i ] . dirty >> 3 , c -> space_bits ) ; if ( pnode -> lprops [ i ] . flags & LPROPS_INDEX ) pack_bits ( & addr , & pos , 1 , 1 ) ; else pack_bits ( & addr , & pos , 0 , 1 ) ; } crc = crc16 ( -1 , buf + UBIFS_LPT_CRC_BYTES , c -> pnode_sz - UBIFS_LPT_CRC_BYTES ) ; addr = buf ; pos = 0 ; pack_bits ( & addr , & pos , crc , UBIFS_LPT_CRC_BITS ) ; }
pack_pnode - pack all the bit fields of a pnode.
pack_pnode - pack all the bit fields of a pnode .