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/devtable.c
int override_attributes(struct stat* st, struct path_htbl_element* ph_elt,
                        struct name_htbl_element* nh_elt)
{
    if (!path_htbl)
        return 0;

    if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode) || S_ISFIFO(st->st_mode))
        return err_msg("%s/%s both exists at UBIFS root at host, "
                       "and is referred from the device table",
                       strcmp(ph_elt->path, "/") ? ph_elt->path : "",
                       nh_elt->name);

    if ((st->st_mode & S_IFMT) != (nh_elt->mode & S_IFMT))
        return err_msg("%s/%s is referred from the device table also exists in "
                       "the UBIFS root directory at host, but the file type is "
                       "different",
                       strcmp(ph_elt->path, "/") ? ph_elt->path : "",
                       nh_elt->name);

    dbg_msg(3, "set UID %d, GID %d, mode %o for %s/%s as device table says",
            nh_elt->uid, nh_elt->gid, nh_elt->mode, ph_elt->path, nh_elt->name);

    st->st_uid = nh_elt->uid;
    st->st_gid = nh_elt->gid;
    st->st_mode = nh_elt->mode;

    hashtable_remove(ph_elt->name_htbl, (void*)nh_elt->name);
    return 0;
}
/**
 * override_attributes - override inode attributes.
 * @st: struct stat object to containing the attributes to override
 * @ph_elt: path hash table element object
 * @nh_elt: name hash table element object containing the new values
 *
 * The device table file may override attributes like UID of files. For
 * example, the device table may contain a "/dev" entry, and the UBIFS FS on
 * the host may contain "/dev" directory. In this case the attributes of the
 * "/dev" directory inode has to be as the device table specifies.
 *
 * Note, the hash element is removed by this function as well.
 */
override inode attributes.
@st: struct stat object to containing the attributes to override
@ph_elt: path hash table element object
@nh_elt: name hash table element object containing the new values

The device table file may override attributes like UID of files. For
example, the device table may contain a "/dev" entry, and the UBIFS FS on
the host may contain "/dev" directory. In this case the attributes of the
"/dev" directory inode has to be as the device table specifies.

Note, the hash element is removed by this function as well.
override inode attributes . @st : struct stat object to containing the attributes to override @ph_elt : path hash table element object @nh_elt : name hash table element object containing the new values The device table file may override attributes like UID of files . For example the device table may contain a " / dev " entry and the UBIFS FS on the host may contain " / dev " directory . In this case the attributes of the " / dev " directory inode has to be as the device table specifies . Note the hash element is removed by this function as well .
int override_attributes(struct stat* st, struct path_htbl_element* ph_elt,
                        struct name_htbl_element* nh_elt)
{
    if (!path_htbl)
        return 0;
    if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode) || S_ISFIFO(st->st_mode))
        return err_msg("%s/%s both exists at UBIFS root at host, "
                       "and is referred from the device table",
                       strcmp(ph_elt->path, "/") ? ph_elt->path : "",
                       nh_elt->name);
    if ((st->st_mode & S_IFMT) != (nh_elt->mode & S_IFMT))
        return err_msg("%s/%s is referred from the device table also exists in "
                       "the UBIFS root directory at host, but the file type is "
                       "different",
                       strcmp(ph_elt->path, "/") ? ph_elt->path : "",
                       nh_elt->name);
    dbg_msg(3, "set UID %d, GID %d, mode %o for %s/%s as device table says",
            nh_elt->uid, nh_elt->gid, nh_elt->mode, ph_elt->path, nh_elt->name);
    st->st_uid = nh_elt->uid;
    st->st_gid = nh_elt->gid;
    st->st_mode = nh_elt->mode;
    hashtable_remove(ph_elt->name_htbl, (void*)nh_elt->name);
    return 0;
}
int override_attributes ( struct stat * st , struct path_htbl_element * ph_elt , struct name_htbl_element * nh_elt ) { if ( ! path_htbl ) return 0 ; if ( S_ISCHR ( st -> st_mode ) || S_ISBLK ( st -> st_mode ) || S_ISFIFO ( st -> st_mode ) ) return err_msg ( " " " " , strcmp ( ph_elt -> path , " " ) ? ph_elt -> path : " " , nh_elt -> name ) ; if ( ( st -> st_mode & S_IFMT ) != ( nh_elt -> mode & S_IFMT ) ) return err_msg ( " " " " " " , strcmp ( ph_elt -> path , " " ) ? ph_elt -> path : " " , nh_elt -> name ) ; dbg_msg ( 3 , " " , nh_elt -> uid , nh_elt -> gid , nh_elt -> mode , ph_elt -> path , nh_elt -> name ) ; st -> st_uid = nh_elt -> uid ; st -> st_gid = nh_elt -> gid ; st -> st_mode = nh_elt -> mode ; hashtable_remove ( ph_elt -> name_htbl , ( void * ) nh_elt -> name ) ; return 0 ; }
override_attributes - override inode attributes.
override_attributes - override inode attributes .