diff options
author | Karel Zak | 2014-03-21 12:35:21 +0100 |
---|---|---|
committer | Karel Zak | 2014-03-21 12:35:21 +0100 |
commit | 881410671f24fc7910cfcec66f37abb94008bbfd (patch) | |
tree | e72c403befcca2cd89f86456eebc1dbe9b6273a6 /disk-utils | |
parent | libblkid: use new debug functions (diff) | |
download | kernel-qcow2-util-linux-881410671f24fc7910cfcec66f37abb94008bbfd.tar.gz kernel-qcow2-util-linux-881410671f24fc7910cfcec66f37abb94008bbfd.tar.xz kernel-qcow2-util-linux-881410671f24fc7910cfcec66f37abb94008bbfd.zip |
libfdisk: use new debug functions
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils')
-rw-r--r-- | disk-utils/cfdisk.c | 58 | ||||
-rw-r--r-- | disk-utils/fdisk-menu.c | 30 | ||||
-rw-r--r-- | disk-utils/fdisk.c | 18 |
3 files changed, 53 insertions, 53 deletions
diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c index 0b1641eb2..6a07ced25 100644 --- a/disk-utils/cfdisk.c +++ b/disk-utils/cfdisk.c @@ -172,7 +172,7 @@ static char *table_to_string(struct cfdisk *cf, struct fdisk_table *tb) int tree = 0; struct tt_line *ln, *ln_cont = NULL; - DBG(FRONTEND, dbgprint("table: convert to string")); + DBG(FRONTEND, ul_debug("table: convert to string")); assert(cf); assert(cf->cxt); @@ -189,7 +189,7 @@ static char *table_to_string(struct cfdisk *cf, struct fdisk_table *tb) /* get container (e.g. extended partition) */ while (fdisk_table_next_partition(tb, itr, &pa) == 0) { if (fdisk_partition_is_nested(pa)) { - DBG(FRONTEND, dbgprint("table: nested detected, using tree")); + DBG(FRONTEND, ul_debug("table: nested detected, using tree")); tree = TT_FL_TREE; break; } @@ -276,7 +276,7 @@ static int lines_refresh(struct cfdisk *cf) assert(cf); - DBG(FRONTEND, dbgprint("refreshing buffer")); + DBG(FRONTEND, ul_debug("refreshing buffer")); free(cf->linesbuf); free(cf->lines); @@ -562,7 +562,7 @@ static void ui_clean_hint(void) static void die_on_signal(int dummy __attribute__((__unused__))) { - DBG(FRONTEND, dbgprint("die on signal.")); + DBG(FRONTEND, ul_debug("die on signal.")); ui_end(); exit(EXIT_FAILURE); } @@ -582,7 +582,7 @@ static void menu_update_ignore(struct cfdisk *cf) m = cf->menu; org = menu_get_menuitem(cf, m->idx); - DBG(FRONTEND, dbgprint("menu: update menu ignored keys")); + DBG(FRONTEND, ul_debug("menu: update menu ignored keys")); i = m->ignore_cb(cf, ignore, sizeof(ignore)); ignore[i] = '\0'; @@ -621,7 +621,7 @@ static struct cfdisk_menu *menu_push( assert(cf); - DBG(FRONTEND, dbgprint("menu: new menu")); + DBG(FRONTEND, ul_debug("menu: new menu")); m->prev = cf->menu; m->items = items; @@ -645,7 +645,7 @@ static struct cfdisk_menu *menu_pop(struct cfdisk *cf) assert(cf); - DBG(FRONTEND, dbgprint("menu: rem menu")); + DBG(FRONTEND, ul_debug("menu: rem menu")); if (cf->menu) { m = cf->menu->prev; @@ -675,7 +675,7 @@ static int ui_init(struct cfdisk *cf __attribute__((__unused__))) { struct sigaction sa; - DBG(FRONTEND, dbgprint("ui: init")); + DBG(FRONTEND, ul_debug("ui: init")); /* setup SIGCHLD handler */ sigemptyset(&sa.sa_mask); @@ -807,7 +807,7 @@ static void ui_draw_menuitem(struct cfdisk *cf, vert ? MBS_ALIGN_LEFT : MBS_ALIGN_CENTER, 0); - DBG(FRONTEND, dbgprint("ui: menuitem: cl=%d, ln=%d, item='%s'", + DBG(FRONTEND, ul_debug("ui: menuitem: cl=%d, ln=%d, item='%s'", cl, ln, buf)); if (vert) { @@ -836,7 +836,7 @@ static void ui_draw_menu(struct cfdisk *cf) assert(cf); assert(cf->menu); - DBG(FRONTEND, dbgprint("ui: menu: draw start")); + DBG(FRONTEND, ul_debug("ui: menu: draw start")); m = cf->menu; @@ -891,7 +891,7 @@ static void ui_draw_menu(struct cfdisk *cf) mvaddch(ln + nlines, cl + m->width + 3, ACS_DARROW); } - DBG(FRONTEND, dbgprint("ui: menu: draw end.")); + DBG(FRONTEND, ul_debug("ui: menu: draw end.")); } static void ui_menu_goto(struct cfdisk *cf, int where) @@ -941,7 +941,7 @@ static int ui_menu_move(struct cfdisk *cf, int key) m = cf->menu; - DBG(FRONTEND, dbgprint("ui: menu move key >%c<.", key)); + DBG(FRONTEND, ul_debug("ui: menu move key >%c<.", key)); if (m->vertical) { @@ -1013,7 +1013,7 @@ static void ui_draw_partition(struct cfdisk *cf, size_t i) curpg = cf->lines_idx / cf->page_sz; } - DBG(FRONTEND, dbgprint( + DBG(FRONTEND, ul_debug( "ui: draw partition %zu [page_sz=%zu, " "line=%d, idx=%zu]", i, cf->page_sz, ln, cf->lines_idx)); @@ -1053,7 +1053,7 @@ static int ui_draw_table(struct cfdisk *cf) size_t i, nparts = fdisk_table_get_nents(cf->table); size_t curpg = cf->page_sz ? cf->lines_idx / cf->page_sz : 0; - DBG(FRONTEND, dbgprint("ui: draw table")); + DBG(FRONTEND, ul_debug("ui: draw table")); for (i = TABLE_START_LINE; i <= TABLE_START_LINE + cf->page_sz; i++) { move(i, 0); @@ -1088,7 +1088,7 @@ static int ui_table_goto(struct cfdisk *cf, int where) size_t old; size_t nparts = fdisk_table_get_nents(cf->table); - DBG(FRONTEND, dbgprint("ui: goto table %d", where)); + DBG(FRONTEND, ul_debug("ui: goto table %d", where)); if (where < 0) where = 0; @@ -1261,7 +1261,7 @@ static int ui_get_size(struct cfdisk *cf, const char *prompt, uintmax_t *res, ssize_t rc; char *dflt = size_to_human_string(0, *res); - DBG(FRONTEND, dbgprint("ui: get_size (default=%ju)", *res)); + DBG(FRONTEND, ul_debug("ui: get_size (default=%ju)", *res)); ui_clean_info(); @@ -1291,7 +1291,7 @@ static int ui_get_size(struct cfdisk *cf, const char *prompt, uintmax_t *res, } if (rc == 0) { - DBG(FRONTEND, dbgprint("ui: get_size user=%ju, power=%d, sectors=%s", + DBG(FRONTEND, ul_debug("ui: get_size user=%ju, power=%d, sectors=%s", user, pwr, insec ? "yes" : "no")); if (insec) user *= cf->cxt->sector_size; @@ -1316,7 +1316,7 @@ static int ui_get_size(struct cfdisk *cf, const char *prompt, uintmax_t *res, *res = user; free(dflt); - DBG(FRONTEND, dbgprint("ui: get_size (result=%ju, rc=%zd)", *res, rc)); + DBG(FRONTEND, ul_debug("ui: get_size (result=%ju, rc=%zd)", *res, rc)); return rc; } @@ -1328,7 +1328,7 @@ static struct fdisk_parttype *ui_get_parttype(struct cfdisk *cf, struct fdisk_parttype *t = NULL; int has_typestr = 0; - DBG(FRONTEND, dbgprint("ui: asking for parttype.")); + DBG(FRONTEND, ul_debug("ui: asking for parttype.")); /* create cfdisk menu according to label types, note that the * last cm[] item has to be empty -- so nitems + 1 */ @@ -1395,7 +1395,7 @@ done: free((char *) cm[i].name); } free(cm); - DBG(FRONTEND, dbgprint("ui: get parrtype done [type=%s] ", t ? t->name : NULL)); + DBG(FRONTEND, ul_debug("ui: get parrtype done [type=%s] ", t ? t->name : NULL)); return t; } @@ -1409,7 +1409,7 @@ static int ui_create_label(struct cfdisk *cf) assert(cf); - DBG(FRONTEND, dbgprint("ui: asking for new disklabe.")); + DBG(FRONTEND, ul_debug("ui: asking for new disklabe.")); /* create cfdisk menu according to libfdisk labels, note that the * last cm[] item has to be empty -- so nitems + 1 */ @@ -1456,7 +1456,7 @@ static int ui_create_label(struct cfdisk *cf) done: menu_pop(cf); free(cm); - DBG(FRONTEND, dbgprint("ui: create label done [rc=%d] ", rc)); + DBG(FRONTEND, ul_debug("ui: create label done [rc=%d] ", rc)); return rc; } @@ -1550,17 +1550,17 @@ static int main_menu_action(struct cfdisk *cf, int key) } else if (key != 'w' && key != 'W') key = tolower(key); /* case insensitive except 'W'rite */ - DBG(FRONTEND, dbgprint("ui: main menu action: key=%c", key)); + DBG(FRONTEND, ul_debug("ui: main menu action: key=%c", key)); if (cf->menu->ignore && strchr(cf->menu->ignore, key)) { - DBG(FRONTEND, dbgprint(" ignore '%c'", key)); + DBG(FRONTEND, ul_debug(" ignore '%c'", key)); return 0; } pa = get_current_partition(cf); n = fdisk_partition_get_partno(pa); - DBG(FRONTEND, dbgprint("menu action on %p", pa)); + DBG(FRONTEND, ul_debug("menu action on %p", pa)); ui_clean_hint(); ui_clean_info(); @@ -1686,7 +1686,7 @@ static int ui_run(struct cfdisk *cf) { int rc = 0; - DBG(FRONTEND, dbgprint("ui: start COLS=%d, LINES=%d", COLS, LINES)); + DBG(FRONTEND, ul_debug("ui: start COLS=%d, LINES=%d", COLS, LINES)); if (!fdisk_dev_has_disklabel(cf->cxt)) { rc = ui_create_label(cf); @@ -1715,7 +1715,7 @@ static int ui_run(struct cfdisk *cf) if (ui_menu_move(cf, key) == 0) continue; - DBG(FRONTEND, dbgprint("ui: main action key >%c<.", key)); + DBG(FRONTEND, ul_debug("ui: main action key >%c<.", key)); switch (key) { case KEY_DOWN: @@ -1762,7 +1762,7 @@ static int ui_run(struct cfdisk *cf) menu_pop(cf); - DBG(FRONTEND, dbgprint("ui: end")); + DBG(FRONTEND, ul_debug("ui: end")); return 0; } @@ -1849,6 +1849,6 @@ int main(int argc, char *argv[]) rc = fdisk_context_deassign_device(cf->cxt); fdisk_free_context(cf->cxt); - DBG(FRONTEND, dbgprint("bye! [rc=%d]", rc)); + DBG(FRONTEND, ul_debug("bye! [rc=%d]", rc)); return rc == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/disk-utils/fdisk-menu.c b/disk-utils/fdisk-menu.c index d7b852deb..822761568 100644 --- a/disk-utils/fdisk-menu.c +++ b/disk-utils/fdisk-menu.c @@ -325,15 +325,15 @@ static int menu_detect_collisions(struct fdisk_context *cxt) r = get_fdisk_menu_entry(cxt, e->key, NULL); if (!r) { - DBG(FRONTEND, dbgprint("warning: not found " + DBG(FRONTEND, ul_debug("warning: not found " "entry for %c", e->key)); return -1; } if (r != e) { - DBG(FRONTEND, dbgprint("warning: duplicate key '%c'", + DBG(FRONTEND, ul_debug("warning: duplicate key '%c'", e->key)); - DBG(FRONTEND, dbgprint(" : %s", e->title)); - DBG(FRONTEND, dbgprint(" : %s", r->title)); + DBG(FRONTEND, ul_debug(" : %s", e->title)); + DBG(FRONTEND, ul_debug(" : %s", r->title)); abort(); } } @@ -414,18 +414,18 @@ int process_fdisk_menu(struct fdisk_context **cxt0) } rc = 0; - DBG(FRONTEND, dbgprint("selected: key=%c, entry='%s'", + DBG(FRONTEND, ul_debug("selected: key=%c, entry='%s'", key, ent->title)); /* menu has implemented callback, use it */ if (menu->callback) rc = menu->callback(cxt0, menu, ent); else { - DBG(FRONTEND, dbgprint("no callback for key '%c'", key)); + DBG(FRONTEND, ul_debug("no callback for key '%c'", key)); rc = -EINVAL; } - DBG(FRONTEND, dbgprint("process menu done [rc=%d]", rc)); + DBG(FRONTEND, ul_debug("process menu done [rc=%d]", rc)); return rc; } @@ -550,7 +550,7 @@ static int gpt_menu_cb(struct fdisk_context **cxt0, assert(ent); assert(fdisk_is_disklabel(cxt, GPT)); - DBG(FRONTEND, dbgprint("enter GPT menu")); + DBG(FRONTEND, ul_debug("enter GPT menu")); if (ent->expert) { switch (ent->key) { @@ -608,7 +608,7 @@ static int dos_menu_cb(struct fdisk_context **cxt0, struct fdisk_context *cxt = *cxt0; int rc = 0; - DBG(FRONTEND, dbgprint("enter DOS menu")); + DBG(FRONTEND, ul_debug("enter DOS menu")); if (!ent->expert) { switch (ent->key) { @@ -681,13 +681,13 @@ static int sun_menu_cb(struct fdisk_context **cxt0, struct fdisk_context *cxt = *cxt0; int rc = 0; - DBG(FRONTEND, dbgprint("enter SUN menu")); + DBG(FRONTEND, ul_debug("enter SUN menu")); assert(cxt); assert(ent); assert(fdisk_is_disklabel(cxt, SUN)); - DBG(FRONTEND, dbgprint("enter SUN menu")); + DBG(FRONTEND, ul_debug("enter SUN menu")); /* normal mode */ if (!ent->expert) { @@ -736,7 +736,7 @@ static int sgi_menu_cb(struct fdisk_context **cxt0, int rc = -EINVAL; size_t n = 0; - DBG(FRONTEND, dbgprint("enter SGI menu")); + DBG(FRONTEND, ul_debug("enter SGI menu")); assert(cxt); assert(ent); @@ -782,7 +782,7 @@ static int bsd_menu_cb(struct fdisk_context **cxt0, assert(ent); assert(fdisk_is_disklabel(cxt, BSD)); - DBG(FRONTEND, dbgprint("enter BSD menu")); + DBG(FRONTEND, ul_debug("enter BSD menu")); switch(ent->key) { case 'e': @@ -814,7 +814,7 @@ static int geo_menu_cb(struct fdisk_context **cxt0, int rc = -EINVAL; uintmax_t c = 0, h = 0, s = 0; - DBG(FRONTEND, dbgprint("enter GEO menu")); + DBG(FRONTEND, ul_debug("enter GEO menu")); assert(cxt); assert(ent); @@ -846,7 +846,7 @@ static int createlabel_menu_cb(struct fdisk_context **cxt0, struct fdisk_context *cxt = *cxt0; int rc = -EINVAL; - DBG(FRONTEND, dbgprint("enter Create label menu")); + DBG(FRONTEND, ul_debug("enter Create label menu")); assert(cxt); assert(ent); diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index e003baf64..fa7f248cc 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -104,7 +104,7 @@ int get_user_reply(struct fdisk_context *cxt, const char *prompt, if (sz && *(buf + sz - 1) == '\n') *(buf + sz - 1) = '\0'; - DBG(ASK, dbgprint("user's reply: >>>%s<<<", buf)); + DBG(ASK, ul_debug("user's reply: >>>%s<<<", buf)); return 0; } @@ -170,7 +170,7 @@ static int ask_number(struct fdisk_context *cxt, assert(q); - DBG(ASK, dbgprint("asking for number " + DBG(ASK, ul_debug("asking for number " "['%s', <%ju,%ju>, default=%ju, range: %s]", q, low, high, dflt, range)); @@ -241,7 +241,7 @@ static int ask_offset(struct fdisk_context *cxt, assert(q); - DBG(ASK, dbgprint("asking for offset ['%s', <%ju,%ju>, base=%ju, default=%ju, range: %s]", + DBG(ASK, ul_debug("asking for offset ['%s', <%ju,%ju>, base=%ju, default=%ju, range: %s]", q, low, high, base, dflt, range)); if (range && dflt >= low && dflt <= high) @@ -271,7 +271,7 @@ static int ask_offset(struct fdisk_context *cxt, rc = parse_size(p, &num, &pwr); if (rc) continue; - DBG(ASK, dbgprint("parsed size: %ju", num)); + DBG(ASK, ul_debug("parsed size: %ju", num)); if (sig && pwr) { /* +{size}{K,M,...} specified, the "num" is in bytes */ uint64_t unit = fdisk_ask_number_get_unit(ask); @@ -283,7 +283,7 @@ static int ask_offset(struct fdisk_context *cxt, else if (sig == '-') num = base - num; - DBG(ASK, dbgprint("final offset: %ju [sig: %c, power: %d, %s]", + DBG(ASK, ul_debug("final offset: %ju [sig: %c, power: %d, %s]", num, sig, pwr, sig ? "relative" : "absolute")); if (num >= low && num <= high) { @@ -386,7 +386,7 @@ int ask_callback(struct fdisk_context *cxt, struct fdisk_ask *ask, rc = get_user_reply(cxt, _(" [Y]es/[N]o: "), buf, sizeof(buf)); if (rc == 0) fdisk_ask_yesno_set_result(ask, rpmatch(buf)); - DBG(ASK, dbgprint("yes-no ask: reply '%s' [rc=%d]", buf, rc)); + DBG(ASK, ul_debug("yes-no ask: reply '%s' [rc=%d]", buf, rc)); break; case FDISK_ASKTYPE_STRING: { @@ -396,7 +396,7 @@ int ask_callback(struct fdisk_context *cxt, struct fdisk_ask *ask, rc = get_user_reply(cxt, prmt, buf, sizeof(buf)); if (rc == 0) fdisk_ask_string_set_result(ask, xstrdup(buf)); - DBG(ASK, dbgprint("string ask: reply '%s' [rc=%d]", buf, rc)); + DBG(ASK, ul_debug("string ask: reply '%s' [rc=%d]", buf, rc)); break; } default: @@ -731,7 +731,7 @@ static void print_all_devices_pt(struct fdisk_context *cxt) return; } - DBG(FRONTEND, dbgprint("reading "_PATH_PROC_PARTITIONS)); + DBG(FRONTEND, ul_debug("reading "_PATH_PROC_PARTITIONS)); while (fgets(line, sizeof(line), f)) { char ptname[128 + 1], devname[256]; @@ -741,7 +741,7 @@ static void print_all_devices_pt(struct fdisk_context *cxt) snprintf(devname, sizeof(devname), "/dev/%s", ptname); - DBG(FRONTEND, dbgprint("listing %s", devname)); + DBG(FRONTEND, ul_debug("listing %s", devname)); if (is_whole_disk(devname)) { char *cn = canonicalize_path(devname); |