Current-Users archive

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

signed/unsigned disklabel



Just noticed

disklabel:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a: 2930277168         0     4.2BSD      0     0     0  # (Cyl.      0 - 
2907020)
 d: 2930277168         0     unused      0     0        # (Cyl.      0 - 
2907020)

but
disklabel -t:

ST31500341AS    |Automatically generated label:\
        :dt=ESDI:se#512:ns#63:nt#16:sc#1008:nc#2907021:\
        :pa#-1364690128:oa#0:ta=4.2BSD:ba#0:fa#0:\
        :pd#-1364690128:od#0:


Trivial patch attached (
        struct  partition {             /* the partition table */
                uint32_t p_size;        /* number of sectors in partition */
                uint32_t p_offset;      /* starting sector */
)

yielding

ST31500341AS    |Automatically generated label:\
        :dt=ESDI:se#512:ns#63:nt#16:sc#1008:nc#2907021:\
        :pa#2930277168:oa#0:ta=4.2BSD:ba#0:fa#0:\
        :pd#2930277168:od#0:


Cheers,

Patrick
Index: main.c
===================================================================
RCS file: /cvsroot/src/sbin/disklabel/main.c,v
retrieving revision 1.22
diff -u -r1.22 main.c
--- main.c      5 Jan 2010 15:45:26 -0000       1.22
+++ main.c      6 Jan 2011 17:54:37 -0000
@@ -1157,8 +1157,8 @@
                if (pp->p_size) {
                        char c = 'a' + i;
                        (void) fprintf(f, "\\\n\t:");
-                       (void) fprintf(f, "p%c#%d:", c, pp->p_size);
-                       (void) fprintf(f, "o%c#%d:", c, pp->p_offset);
+                       (void) fprintf(f, "p%c#%u:", c, pp->p_size);
+                       (void) fprintf(f, "o%c#%u:", c, pp->p_offset);
                        if (pp->p_fstype != FS_UNUSED) {
                                if ((unsigned) pp->p_fstype < FSMAXTYPES)
                                        (void) fprintf(f, "t%c=%s:", c,


Home | Main Index | Thread Index | Old Index