Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

Commit

Permalink
Partman
Browse files Browse the repository at this point in the history
  • Loading branch information
UzixLS committed Jul 31, 2012
1 parent 60030e6 commit 203a748
Show file tree
Hide file tree
Showing 4 changed files with 480 additions and 108 deletions.
18 changes: 12 additions & 6 deletions distrib/utils/sysinst/bsddisklabel.c
Expand Up @@ -119,7 +119,9 @@ save_ptn(int ptn, daddr_t start, daddr_t size, int fstype, const char *mountpt)
p->pi_size = size;
set_ptype(p, fstype, mountpt ? PIF_NEWFS : 0);

if (mountpt != NULL) {
if (mountpt != NULL && ! strcmp(mountpt, "lvm"))
p->lvmpv = 1;
else if (mountpt != NULL) {
for (pp = 0; pp < maxptn; pp++) {
if (strcmp(pm->bsdlabel[pp].pi_mount, mountpt) == 0)
pm->bsdlabel[pp].pi_flags &= ~PIF_MOUNT;
Expand Down Expand Up @@ -218,7 +220,7 @@ set_ptn_size(menudesc *m, void *arg)
return 0;

if (p->mount[0] == 0) {
msg_prompt_win(partman_go?"Mountpoint or 'raid' or 'cgd'?":MSG_askfsmount,
msg_prompt_win(partman_go?"Mountpoint or 'raid' or 'cgd' or 'lvm'?":MSG_askfsmount,
-1, 18, 0, 0, NULL, p->mount, sizeof p->mount);
if (p->mount[0] == 0)
return 0;
Expand Down Expand Up @@ -708,16 +710,20 @@ make_bsd_partitions(void)

if (layoutkind == LY_SETNEW)
get_ptn_sizes(partstart, ptend - partstart, no_swap);

if (layoutkind == LY_NEWRAID) {
else if (layoutkind == LY_NEWRAID) {
set_ptype(&(pm->bsdlabel[PART_E]), FS_RAID, 0);
pm->bsdlabel[PART_E].pi_size = pm->ptsize;
}

if (layoutkind == LY_NEWCGD) {
else if (layoutkind == LY_NEWCGD) {
set_ptype(&(pm->bsdlabel[PART_E]), FS_CGD, 0);
pm->bsdlabel[PART_E].pi_size = pm->ptsize;
}
else if (layoutkind == LY_NEWLVM) {
set_ptype(&(pm->bsdlabel[PART_E]), FS_BSDFFS, 0);
pm->bsdlabel[PART_E].pi_size = pm->ptsize;
pm->bsdlabel[PART_E].lvmpv = 1;
}

/*
* OK, we have a partition table. Give the user the chance to
Expand Down
6 changes: 2 additions & 4 deletions distrib/utils/sysinst/defs.h
Expand Up @@ -85,10 +85,7 @@ deconst(const void *p)
#define RUN_XFER_DIR 0x0200 /* cd to xfer_dir in child */

/* for bsddisklabel.c */
#define LY_SETNEW 1
#define LY_NEWRAID 2
#define LY_NEWCGD 3
#define LY_USEEXIST 4
enum { LY_SETNEW, LY_NEWRAID, LY_NEWCGD, LY_NEWLVM, LY_USEEXIST };

/* Installation sets */
enum {
Expand Down Expand Up @@ -217,6 +214,7 @@ typedef struct _partinfo {
#define PIF_RESET 0x1000 /* internal - restore previous values */
const char *mnt_opts;
const char *fsname;
int lvmpv; /* should we use partition as LVM PV? */
} partinfo; /* Single partition from a disklabel */

struct ptn_info {
Expand Down
5 changes: 4 additions & 1 deletion distrib/utils/sysinst/menus.mi
Expand Up @@ -519,9 +519,12 @@ menu pmentry, x=50, y=5, exit, default exit; /* TODO: localize */
option "Set disk name", exit, action { msg_prompt_win(MSG_packname, -1,
18, 0, 0, pm->bsddiskname, pm->bsddiskname,
sizeof pm->bsddiskname); };
option "RAID there", exit, action { *(int *)arg = 1; pm->changed = 1;
option "Format as RAID", exit, action { *(int *)arg = 1; pm->changed = 1;
layoutkind = LY_NEWRAID;
md_make_bsd_partitions(); };
option "Format as LVM PV", exit, action { *(int *)arg = 1; pm->changed = 1;
layoutkind = LY_NEWLVM;
md_make_bsd_partitions(); };
option "Encrypt", exit, action { *(int *)arg = 1; pm->changed = 1;
layoutkind = LY_NEWCGD;
md_make_bsd_partitions();
Expand Down

0 comments on commit 203a748

Please sign in to comment.