LVM2 lib/display/display.c lib/display/display ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2007-08-20 17:04:53
Modified files:
lib/display : display.c display.h lib/metadata : lv_manip.c metadata-exported.h tools : lvmcmdline.c lvremove.c tools.h
Log message:
Move lv_remove_single() into library (lv_manip.c, metadata-exported.h). Move yes_no_prompt() into library (display.c, display.h). Fixup includes as a result of movement of prior two functions. Fixup force_t enum to be more descriptive.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.76&r2=1.77
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.h.diff?cvsroot=lvm2&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.122&r2=1.123
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvremove.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/tools.h.diff?cvsroot=lvm2&r1=1.54&r2=1.55
lib/display/display.c +31 -0
@@ -726,3 +726,34 @@ } } +char yes_no_prompt (const char *prompt, ...) +{ +int c =0 , ret =0 ; +va_list ap; + +sigint_allow (); +do { +if (c =='\n' || !c) { +va_start (ap, prompt); +vprintf (prompt, ap); +va_end (ap); + } + +if ((c =getchar ()) ==EOF ) { + ret ='n' ; +break ; + } + + c =tolower (c); +if ((c =='y' ) || (c =='n' )) + ret = c; + }while (!ret || c !='\n' ); + +sigint_restore (); + +if (c !='\n' ) +printf ("\n" ); + +return ret; +} +
lib/display/display.h +3 -0
@@ -17,6 +17,7 @@#define _LVM_DISPLAY_H#include "metadata-exported.h" +#include "locking.h" #include <stdint.h>
@@ -58,4 +59,6 @@const char *get_alloc_string (alloc_policy_t alloc);alloc_policy_t get_alloc_from_string (const char *str); +char yes_no_prompt (const char *prompt, ...); +#endif
lib/metadata/lv_manip.c +112 -0
121 lines not on this page · raw message
lib/metadata/metadata-exported.h +5 -2
@@ -108,8 +108,8 @@*/ typedef enum {DONT_FORCE =0 , -FORCE =1 , -FORCE_2 =2 +FORCE_NO_CONFIRM =1 ,/* skip yes/no confirmation of operation */ +FORCE_OVERRIDE =2 /* skip confirmation and bypass a second condition */ }force_t ;struct cmd_context ;
@@ -365,6 +365,9 @@/* lv must be part of lv->vg->lvs */ int lv_remove (struct logical_volume *lv); +int lv_remove_single (struct cmd_context *cmd,struct logical_volume *lv, +force_t force); +int lv_rename (struct cmd_context *cmd,struct logical_volume *lv,const char *new_name);
tools/lvmcmdline.c +0 -31
@@ -368,37 +368,6 @@return 1 ; } -char yes_no_prompt (const char *prompt, ...) -{ -int c =0 , ret =0 ; -va_list ap; - -sigint_allow (); -do { -if (c =='\n' || !c) { -va_start (ap, prompt); -vprintf (prompt, ap); -va_end (ap); - } - -if ((c =getchar ()) ==EOF ) { - ret ='n' ; -break ; - } - - c =tolower (c); -if ((c =='y' ) || (c =='n' )) - ret = c; - }while (!ret || c !='\n' ); - -sigint_restore (); - -if (c !='\n' ) -printf ("\n" ); - -return ret; -} -static void __alloc (int size) {if (!(_cmdline.commands =dm_realloc (_cmdline.commands,sizeof (*_cmdline.commands) * size))) {
tools/lvremove.c +2 -114
127 lines not on this page · raw message
tools/tools.h +0 -1
@@ -144,7 +144,6 @@int segtype_arg (struct cmd_context *cmd,struct arg *a);int alloc_arg (struct cmd_context *cmd,struct arg *a); -char yes_no_prompt (const char *prompt, ...);/* we use the enums to access the switches */ unsigned int arg_count (const struct cmd_context *cmd,int a);