>> Here's the fix for the fdisk problem:
>> 
>> /sys/src/cmd/disk/prep/edit.c:503,508 - edit.c:503,509
>>       */
>>      for(i=0; i<edit->nctlpart; i++) {
>>              p = edit->ctlpart[i];
>> +            if(strncmp(p->ctlname, "data", 5) != 0)
>>              if(p->changed)
>>              if(fprint(ctlfd, "delpart %s\n", p->ctlname)<0) {
>>                      fprint(2, "delpart failed: %s: %r\n", p->ctlname);

on second read, with this approach, i would think that strcmp() not
strncmp should be used.

> 
> That would work, but one wonders why
> the normal kernel doesn't have this problem.

this must be a quirk of the interaction between
devsd and fdisk.  by hand data does disappear:

        ; lc
        9fat    ctl     data    nvram   plan9   raw
        ; for(i in 9fat data nvram plan9 data)echo delpart $i>ctl
        ; lc
        ctl     raw

by the way, be very careful with this before
applying this patch:

; diff -c /sys/src/9/port/devsd.c /n/dump/2008/0701/sys/src/9/port/devsd.c
/sys/src/9/port/devsd.c:147,153 - 
/n/dump/2008/0701/sys/src/9/port/devsd.c:147,152
         */
        pp = unit->part;
        for(i = 0; i < unit->npart; i++){
-               if(pp->name)
                if(strcmp(name, pp->name) == 0)
                        break;
                pp++;

this is required because npart is set to the number
of partitions allocated.  the names never-set partitions
might be 0.  otherwise "delpart missingpart>/dev/sdXX/ctl"
will be a noisy and somewhat gratituous synonym for
"echo reboot>/dev/reboot".

- erik


Reply via email to