openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/util-linux/2.33.2-r0/util-linux-2.33.2/libmount/src/tab_update.c
static int fprintf_mtab_fs(FILE* f, struct libmnt_fs* fs)
{
    const char *o, *src, *fstype, *comm;
    char *m1, *m2, *m3, *m4;
    int rc;

    assert(fs);
    assert(f);

    comm = mnt_fs_get_comment(fs);
    src = mnt_fs_get_source(fs);
    fstype = mnt_fs_get_fstype(fs);
    o = mnt_fs_get_options(fs);

    m1 = src ? mangle(src) : "none";
    m2 = mangle(mnt_fs_get_target(fs));
    m3 = fstype ? mangle(fstype) : "none";
    m4 = o ? mangle(o) : "rw";

    if (m1 && m2 && m3 && m4)
    {
        if (comm)
            fputs(comm, f);
        rc = fprintf(f, "%s %s %s %s %d %d\n", m1, m2, m3, m4,
                     mnt_fs_get_freq(fs), mnt_fs_get_passno(fs));
        if (rc > 0)
            rc = 0;
    }
    else
        rc = -ENOMEM;

    if (src)
        free(m1);
    free(m2);
    if (fstype)
        free(m3);
    if (o)
        free(m4);

    return rc;
}
/* mtab and fstab update -- returns zero on success
 */
mtab and fstab update -- returns zero on success
mtab and fstab update -- returns zero on success
static int fprintf_mtab_fs(FILE* f, struct libmnt_fs* fs)
{
    const char *o, *src, *fstype, *comm;
    char *m1, *m2, *m3, *m4;
    int rc;
    assert(fs);
    assert(f);
    comm = mnt_fs_get_comment(fs);
    src = mnt_fs_get_source(fs);
    fstype = mnt_fs_get_fstype(fs);
    o = mnt_fs_get_options(fs);
    m1 = src ? mangle(src) : "none";
    m2 = mangle(mnt_fs_get_target(fs));
    m3 = fstype ? mangle(fstype) : "none";
    m4 = o ? mangle(o) : "rw";
    if (m1 && m2 && m3 && m4)
    {
        if (comm)
            fputs(comm, f);
        rc = fprintf(f, "%s %s %s %s %d %d\n", m1, m2, m3, m4,
                     mnt_fs_get_freq(fs), mnt_fs_get_passno(fs));
        if (rc > 0)
            rc = 0;
    }
    else
        rc = -ENOMEM;
    if (src)
        free(m1);
    free(m2);
    if (fstype)
        free(m3);
    if (o)
        free(m4);
    return rc;
}
static int fprintf_mtab_fs ( FILE * f , struct libmnt_fs * fs ) { const char * o , * src , * fstype , * comm ; char * m1 , * m2 , * m3 , * m4 ; int rc ; assert ( fs ) ; assert ( f ) ; comm = mnt_fs_get_comment ( fs ) ; src = mnt_fs_get_source ( fs ) ; fstype = mnt_fs_get_fstype ( fs ) ; o = mnt_fs_get_options ( fs ) ; m1 = src ? mangle ( src ) : " " ; m2 = mangle ( mnt_fs_get_target ( fs ) ) ; m3 = fstype ? mangle ( fstype ) : " " ; m4 = o ? mangle ( o ) : " " ; if ( m1 && m2 && m3 && m4 ) { if ( comm ) fputs ( comm , f ) ; rc = fprintf ( f , " \n " , m1 , m2 , m3 , m4 , mnt_fs_get_freq ( fs ) , mnt_fs_get_passno ( fs ) ) ; if ( rc > 0 ) rc = 0 ; } else rc = - ENOMEM ; if ( src ) free ( m1 ) ; free ( m2 ) ; if ( fstype ) free ( m3 ) ; if ( o ) free ( m4 ) ; return rc ; }
mtab and fstab update -- returns zero on success
mtab and fstab update -- returns zero on success