[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Fwd: Re: Status for reiser support in d-i]



On Tue, Aug 26, 2003 at 01:01:32PM +0400, Yury Umanets wrote:
> On Tue, 2003-08-26 at 12:54, Sven Luther wrote:
> > On Tue, Aug 26, 2003 at 12:44:48PM +0400, Yury Umanets wrote:
> > > On Tue, 2003-08-26 at 12:40, Sven Luther wrote:
> > > > On Tue, Aug 26, 2003 at 12:04:06PM +0400, Yury Umanets wrote:
> > > > > > > > but there should be no problem at least to use
> > > > > > > > parted standalone in place of cfdisk. 
> > > > > > > 
> > > > > > > > But then, parted is less user
> > > > > > > > friendly than cfdisk.
> > > > > > > This is disputable question actually :) Some people like prated much
> > > > > > > more then cfdisk.
> > > > > > 
> > > > > > Well, sure, but as it will be used for the end user, a cfdisk like
> > > > > > thingy would be better suited.
> > > > > okay, probably cfdisk's interface is liked more by end users. But this
> > > > > mean, that somebody should improve parted interface (ncurses, etc) :)
> > > > 
> > > > I think there is something really wrong with parted.
> > > 
> > > It is good, that Andrew Clause did not hear what you said :)
> > 
> > Well, it is not all that bad, just that (in my opinion) more could be
> > moved to libparted.
> > 
> > > >  It should contain
> > > > only the interface stuff, and let the real code sit in libparted,
> > > actually it is exactly what you said. 
> > > 
> > > Parted itself contains commands handling, readline callbacks, list
> > > implementation, etc.
> > 
> 
> > Sure, and the rescue code for example is almost 200 lines long, code
> > which will have to be duplicated in every partitioning application using
> > libparted.
> 
> It is probably less than 200. Also, some of them is really front end
> specific. For instance, exception handler. Parted uses readline for, but
> some GUI program should use something like the following:
> 
> int my_parted_gtk_gui_default_exception_handler(ped_exception_t *ex) {
> 	int res = my_gtk_disalog_box(ex->type, ex->message);
> 
> 	if (res == MB_OK) {
> 		/* do something*/
> 	} else {
> 		/* do yet another something :)*/
> 	}
> }
> 
> Also, parted contains lots of code for output of guessed partitions, fs
> types, etc to terminal. This code is also front end specific. For
> instance a GTK front end will use gtk_list_view for this.

Ok, i may be really wrong, since i just looked at it quickly.

> Okay Sven, can you point me that code, that should be moved from parted to libparted 
> in your opinion. Probably I will agree with you. At least we will talk about something 
> real :)

What about things like this (parted.c line 1026->1063) :

        for (start = start_range->start; start <= start_range->end; start++) {
                ped_timer_update (timer, 1.0 * (start - start_range->start)
                                         / start_range->length);

                ped_geometry_init (&start_geom_exact, disk->dev, start, 1);
                ped_constraint_init (
                        &constraint, ped_alignment_any, ped_alignment_any,
                        &start_geom_exact, &entire_dev,
                        1, disk->dev->length);
                part = ped_partition_new (disk, part_type, NULL, start,
                                end_range->start + end_range->length / 2);
                if (!part) {
                        ped_constraint_done (&constraint);
                        continue;
                }

                ped_exception_fetch_all ();
                if (ped_disk_add_partition (disk, part, &constraint)) {
                        ped_exception_leave_all ();
                        switch (_rescue_add_partition (part)) {
                        case 1:
                                ped_constraint_done (&constraint);
                                return 1;

                        case 0:
                                ped_disk_remove_partition (disk, part);
                                break;

                        case -1:
                                goto error_remove_partition;;
                        }
                } else {
                        ped_exception_leave_all ();
                }
                ped_partition_destroy (part);
                ped_constraint_done (&constraint);
        }
        ped_timer_update (timer, 1.0);

Friendly,

Sven Luther



Reply to: