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

`mke2fs' in partition_config.c

Hi :)

In article <[🔎] oaaelnwdcf.fsf@arroz.fake>,
  at 30 Jan 2000 14:48:00 -0500,
    on Re: [boot-floppies] `mke2fs' and new Linux 2.2 ext2 features ?,
 Adam Di Carlo <adam@onshore.com> writes:

> I've changed the logic to use the DLG_YES and DLG_NO stuff.  It should
> be a bit clearer what's going on now.  Please review that and make
> sure it looks right, thanks.

Thanks ! I am now fully assured that Oflag related codes should work well.

  /* Oflag:  DLG_YES == 2.0 compat; DLG_NO == 2.2 only */
  Oflag = DLG_YES;
    Oflag = yesNoBox(prtbuf, _("Pre-2.2 Linux Kernel Compatibility?"));
  sprintf(prtbuf, "mkfs.ext2 %s %s %s", ( Oflag == DLG_NO ? "" : "-O none"),
          ( cflag ? "-c" : ""), p->name);

This makes the default to "-O none", and if user's answer is "Yes" at
the prompt, then they get the same "-O none".

By the way, cflag related codes have some un-cleared thing yet.

This "cflag" variable is initialized by get_cflag() at first.

  |  cflag = get_cflag(p->name);

And get_cflag() returns 0 when /sbin/badblocks is not executable,
or bootargs.isverbose is not set. 

   || static int get_cflag (const char *name) {
   ||   struct stat statbuf;
   ||   if (! NAME_ISEXE("/sbin/badblocks", &statbuf) ||
   ||       ! bootargs.isverbose ) {
   ||     return 0;
   ||   }
   ||   sprintf(prtbuf, _("The system can scan the entire partition for un-readable di
   || sk blocks and will mark any such bad blocks it finds so that they will not be us
   || ed. This requires that every block be read, and thus could take a long time, but
   ||  may save you trouble later.\n\nShould the bad-block scan be performed on %s ?")
   || , name);
   ||   return yesNoBox(prtbuf, _("Scan for Bad Blocks?"));
   || }

But nextline

  |  if (! bootargs.isquiet ) {

makes that if bootargs.isquiet is not set, then the dialog will be shown.

  |    sprintf(prtbuf,_("You have chosen to initialize %s as a Linux \"ext2\"
  | filesystem. This will permanently erase any data on this partition.
  | Are you sure you want to do this?"),
  |            p->name);
  |    if (yesNoBox(prtbuf, _("Are You Sure?")) == DLG_NO)
  |      return 1;

So, if user does not set bootargs.isverbose nor bootargs.isquiet, 
then get_cflag returns 0 for cflag (because bootargs.isverbose is not set), 
but this dialog will be shown (because bootargs.isquiet is not set).
So this could cause the confusion.

Maybe the line

  |  if (! bootargs.isquiet ) {

should be changed into

  |  if (cflag && ! bootargs.isquiet ) {

unless get_cflag() will be changed.

Any comment ?

  Taketoshi Sano: <sano@debian.org>,<sano@debian.or.jp>,<kgh12351@nifty.ne.jp>

Reply to: