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/libfdisk/src/context.c
int fdisk_reassign_device(struct fdisk_context* cxt)
{
    char* devname;
    int rdonly, rc;

    assert(cxt);
    assert(cxt->dev_fd >= 0);

    DBG(CXT, ul_debugobj(cxt, "re-assigning device %s", cxt->dev_path));

    devname = strdup(cxt->dev_path);
    if (!devname)
        return -ENOMEM;

    rdonly = cxt->readonly;

    fdisk_deassign_device(cxt, 1);
    rc = fdisk_assign_device(cxt, devname, rdonly);
    free(devname);

    return rc;
}
/**
 * fdisk_reassign_device:
 * @cxt: context
 *
 * This function is "hard reset" of the context and it does not write anything
 * to the device. All in-memory changes associated with the context will be
 * lost. It's recommended to use this function after some fatal problem when the
 * context (and label specific driver) is in an undefined state.
 *
 * Returns: 0 on success, < 0 on error.
 */
@cxt: context

This function is "hard reset" of the context and it does not write anything
to the device. All in-memory changes associated with the context will be
lost. It's recommended to use this function after some fatal problem when the
context (and label specific driver) is in an undefined state.

0 on success, < 0 on error.
@cxt : context This function is " hard reset " of the context and it does not write anything to the device . All in - memory changes associated with the context will be lost . It ' s recommended to use this function after some fatal problem when the context ( and label specific driver ) is in an undefined state . 0 on success < 0 on error .
int fdisk_reassign_device(struct fdisk_context* cxt)
{
    char* devname;
    int rdonly, rc;
    assert(cxt);
    assert(cxt->dev_fd >= 0);
    DBG(CXT, ul_debugobj(cxt, "re-assigning device %s", cxt->dev_path));
    devname = strdup(cxt->dev_path);
    if (!devname)
        return -ENOMEM;
    rdonly = cxt->readonly;
    fdisk_deassign_device(cxt, 1);
    rc = fdisk_assign_device(cxt, devname, rdonly);
    free(devname);
    return rc;
}
int fdisk_reassign_device ( struct fdisk_context * cxt ) { char * devname ; int rdonly , rc ; assert ( cxt ) ; assert ( cxt -> dev_fd >= 0 ) ; DBG ( CXT , ul_debugobj ( cxt , " " , cxt -> dev_path ) ) ; devname = strdup ( cxt -> dev_path ) ; if ( ! devname ) return - ENOMEM ; rdonly = cxt -> readonly ; fdisk_deassign_device ( cxt , 1 ) ; rc = fdisk_assign_device ( cxt , devname , rdonly ) ; free ( devname ) ; return rc ; }
fdisk_reassign_device:
 @cxt: context
fdisk_reassign_device : @cxt : context