Author: aschnell
Date: Wed Feb 13 12:59:39 2008
New Revision: 44414
URL: http://svn.opensuse.org/viewcvs/yast?rev=44414&view=rev
Log:
- extended predicate of MakePartitionList
- show physical volumes of volume group
Modified:
branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp?rev=44414&r1=44413&r2=44414&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp Wed Feb 13 12:59:39 2008
@@ -12,15 +12,25 @@
any filter_ = `all;
- boolean predicate_all(map disk)
+ symbol predicate_all(map disk, map partition)
{
- if (filter_ == `all)
- return true;
-
- // TODO include `CT_DMRAID in `disks
-
- map tmp = $[ `disks : `CT_DISK, `lvm : `CT_LVM, `nfs : `CT_NFS ];
- return disk["type"]:`none == tmp[filter_]:`none;
+ if (partition == nil)
+ {
+ if (filter_ == `all)
+ return `showandfollow;
+
+ // TODO include `CT_DMRAID in `disks
+
+ map tmp = $[ `disks : `CT_DISK, `lvm : `CT_LVM, `nfs : `CT_NFS ];
+ if (disk["type"]:`none == tmp[filter_]:`none)
+ return `showandfollow;
+ else
+ return `ignore;
+ }
+ else
+ {
+ return `show;
+ }
}
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp?rev=44414&r1=44413&r2=44414&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp Wed Feb 13 12:59:39 2008
@@ -65,9 +65,21 @@
void CreateHdDiskPartitionsTab(any user_data)
{
- boolean predicate(map disk)
+ string device = (string) user_data;
+
+ symbol predicate(map disk, map partition)
{
- return disk["device"]:"" == user_data;
+ if (partition == nil)
+ {
+ if (disk["device"]:"" == device)
+ return `showandfollow;
+ else
+ return `ignore;
+ }
+ else
+ {
+ return `show;
+ }
}
list<symbol> columns = [ `device, `size, `format, `fs, `mount, `mount_by, `cyl, `used_by ];
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp?rev=44414&r1=44413&r2=44414&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp Wed Feb 13 12:59:39 2008
@@ -79,9 +79,21 @@
void CreateLvmVgLvsTab(any user_data)
{
- boolean predicate(map disk)
+ string device = (string) user_data;
+
+ symbol predicate(map disk, map partition)
{
- return disk["device"]:"" == user_data;
+ if (partition == nil)
+ {
+ if (disk["device"]:"" == device)
+ return `showandfollow;
+ else
+ return `ignore;
+ }
+ else
+ {
+ return `show;
+ }
}
list<symbol> columns = [ `device, `size, `format, `fs, `mount, `mount_by, `used_by ];
@@ -110,14 +122,36 @@
void CreateLvmVgPvsTab(any user_data)
{
- list<symbol> columns = [ `device, `size, `format, `fs, `mount, `mount_by, `used_by ];
+ string device = (string) user_data;
+
+ map tg = Storage::GetTargetMap();
+ map disk = tg[device]:$[];
+ list pvs = disk["devices"]:[];
+
+ symbol predicate(map disk, map partition)
+ {
+ if (partition == nil)
+ {
+ return `follow;
+ }
+ else
+ {
+ if (contains(pvs, partition["device"]:""))
+ return `show;
+ else
+ return `ignore;
+ }
+ }
+
+ list<symbol> columns = [ `device, `size, `format, `fs ];
term header = GetTableHeaderNew(columns);
+ list table_list = MakePartitionList(tg, columns, predicate);
UI::ReplaceWidget(`tab_panel,
`VBox(
`Table(`opt(`keepSorting),
- header, []
+ header, table_list
),
`HBox(
// `PushButton(`id(`add), "Add..."),
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp?rev=44414&r1=44413&r2=44414&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp Wed Feb 13 12:59:39 2008
@@ -150,20 +150,28 @@
}
- list<term> MakePartitionList(map targets, list columns, boolean(map) predicate)
+ /**
+ * The predicate function determines whether the disk/partition is
+ * included. The predicate function takes two arguments, disk and
+ * partition. For disks predicate is called with the partitions set to
+ * nil.
+ *
+ * Possible return values for predicate:
+ * `show, `follow, `showandfollow, `ignore
+ */
+ list<term> MakePartitionList(map targets, list columns, symbol(map, map) predicate)
{
list<term> table_input = [];
void disk_cb(map targets, map disk)
{
- if (!predicate(disk))
- return;
+ symbol disk_predicate = predicate(disk, nil);
boolean real_disk = Storage::IsPartitionable(disk);
string dev = disk["device"]:"";
- if (!AlwaysHideDisk(targets, disk))
+ if (!AlwaysHideDisk(targets, disk) && contains([`show, `showandfollow], disk_predicate))
{
string vendor = disk["vendor"]:"";
string model = disk["model"]:"";
@@ -201,7 +209,6 @@
vendor = sformat( _("DISK %1"), substring( dev, 5 ));
}
-
term a = `item(`id(dev));
if (contains(columns, `device)) a = add(a, dev );
@@ -233,97 +240,104 @@
table_input = add (table_input, a);
}
- list<map> partitions = disk["partitions"]:[];
-
- foreach(map partition, partitions, ``{
-
- if (AlwaysHidePartition(targets, disk, partition))
- return;
-
- string part_dev_name = partition["device"]:"";
-
- integer start_cyl = partition["region",0]:0;
- integer nb_cyl = partition["region",1]:0;
- symbol type = partition["type"]:`unknown;
- boolean format = partition["format"]:false;
- boolean crypt_fs = partition["enc_type"]:`none != `none;
- symbol used_fs = partition["used_fs"]:`unknown;
- string mount_point = partition["mount"]:"";
- symbol mount_by = partition["mountby"]:`device;
-
- string label = partition["label"]:"";
- string udev_id = mergestring( partition["udev_id"]:[], " ");
- string udev_path = partition["udev_path"]:"";
-
- string used_by = usedByString( partition["used_by_type"]:`UB_NONE,
- partition["used_by"]:"" );
+ if (contains([`follow, `showandfollow], disk_predicate))
+ {
+ list<map> partitions = disk["partitions"]:[];
- string bytes_of_part = ByteToHumanString( partition["size_k"]:0*1024 );
+ foreach(map partition, partitions, ``{
- term a = `item(`id(part_dev_name));
+ if (AlwaysHidePartition(targets, disk, partition))
+ return;
- if (contains(columns, `device)) a = add(a, part_dev_name );
- if (contains(columns, `id) ) a = add(a, "");
- if (contains(columns, `size) ) a = add(a, bytes_of_part);
- if (contains(columns, `format) )
- {
- string format_flag = "";
- if (format) format_flag = "F";
- if (crypt_fs) format_flag = "C" + format_flag;
- a = add(a, format_flag);
- }
- if (contains(columns, `fs) )
- {
- string filesystem_name = partition["fstype"]:"";
- if( format && partition["fsid"]:0 == Partitions::fsid_native)
+ symbol part_predicate = predicate(disk, partition);
+ if (!contains([`show, `showandfollow], part_predicate))
+ return;
+
+ string part_dev_name = partition["device"]:"";
+
+ integer start_cyl = partition["region",0]:0;
+ integer nb_cyl = partition["region",1]:0;
+ symbol type = partition["type"]:`unknown;
+ boolean format = partition["format"]:false;
+ boolean crypt_fs = partition["enc_type"]:`none != `none;
+ symbol used_fs = partition["used_fs"]:`unknown;
+ string mount_point = partition["mount"]:"";
+ symbol mount_by = partition["mountby"]:`device;
+
+ string label = partition["label"]:"";
+ string udev_id = mergestring( partition["udev_id"]:[], " ");
+ string udev_path = partition["udev_path"]:"";
+
+ string used_by = usedByString( partition["used_by_type"]:`UB_NONE,
+ partition["used_by"]:"" );
+
+ string bytes_of_part = ByteToHumanString( partition["size_k"]:0*1024 );
+
+ term a = `item(`id(part_dev_name));
+
+ if (contains(columns, `device)) a = add(a, part_dev_name );
+ if (contains(columns, `id) ) a = add(a, "");
+ if (contains(columns, `size) ) a = add(a, bytes_of_part);
+ if (contains(columns, `format) )
{
- string fs_name = FileSystems::GetName( used_fs, "Ext2" );
- filesystem_name = filesystem_name + " (" + fs_name + ") ";
+ string format_flag = "";
+ if (format) format_flag = "F";
+ if (crypt_fs) format_flag = "C" + format_flag;
+ a = add(a, format_flag);
}
- a = add(a, filesystem_name);
- }
- if (contains(columns, `mount) )
- {
- string tmp = mount_point;
- if( Mode::normal() && partition["inactive"]:false )
+ if (contains(columns, `fs) )
{
- tmp = tmp + " *";
+ string filesystem_name = partition["fstype"]:"";
+ if( format && partition["fsid"]:0 == Partitions::fsid_native)
+ {
+ string fs_name = FileSystems::GetName( used_fs, "Ext2" );
+ filesystem_name = filesystem_name + " (" + fs_name + ") ";
+ }
+ a = add(a, filesystem_name);
}
- a = add(a, tmp );
- }
- if(contains(columns, `mount_by))
- {
- if (mount_point != "")
+ if (contains(columns, `mount) )
{
- map tmp = $[ `device : "K", `uuid : "U", `label : "L",
- `id : "I", `path : "P" ];
- a = add(a, tmp[mount_by]:"");
+ string tmp = mount_point;
+ if( Mode::normal() && partition["inactive"]:false )
+ {
+ tmp = tmp + " *";
+ }
+ a = add(a, tmp );
}
- else
- a = add(a, "");
- }
- if(contains(columns, `cyl))
- {
- if( real_disk ) {
- a = add(a, to4string(start_cyl));
- integer num = start_cyl + nb_cyl - 1;
- if( num<0 )
- num=0;
- a = add(a, to4string(num));
- } else {
- a = add(a, " -- ");
- a = add(a, " -- ");
+ if(contains(columns, `mount_by))
+ {
+ if (mount_point != "")
+ {
+ map tmp = $[ `device : "K", `uuid : "U", `label : "L",
+ `id : "I", `path : "P" ];
+ a = add(a, tmp[mount_by]:"");
+ }
+ else
+ a = add(a, "");
}
- }
- if(contains(columns, `used_by)) a = add(a, used_by);
- if(contains(columns, `label)) a = add(a, label);
+ if(contains(columns, `cyl))
+ {
+ if( real_disk ) {
+ a = add(a, to4string(start_cyl));
+ integer num = start_cyl + nb_cyl - 1;
+ if( num<0 )
+ num=0;
+ a = add(a, to4string(num));
+ } else {
+ a = add(a, " -- ");
+ a = add(a, " -- ");
+ }
+ }
+ if(contains(columns, `used_by)) a = add(a, used_by);
+ if(contains(columns, `label)) a = add(a, label);
- if(contains(columns, `udev_id)) a = add(a, udev_id);
- if(contains(columns, `udev_path)) a = add(a, udev_path);
+ if(contains(columns, `udev_id)) a = add(a, udev_id);
+ if(contains(columns, `udev_path)) a = add(a, udev_path);
- table_input = add (table_input, a);
+ table_input = add (table_input, a);
});
+ }
}
GoOverTargetMap(targets, disk_cb);
@@ -333,7 +347,6 @@
-
include "partitioning/ep-all.ycp";
include "partitioning/ep-hd.ycp";
include "partitioning/ep-lvm.ycp";
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org