Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/pdisk/dist Apply our fixes



details:   https://anonhg.NetBSD.org/src/rev/257fee5f9905
branches:  trunk
changeset: 785612:257fee5f9905
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 23 15:39:43 2013 +0000

description:
Apply our fixes

diffstat:

 external/bsd/pdisk/dist/ATA_media.c      |  151 ++++++------
 external/bsd/pdisk/dist/DoSCSICommand.c  |   16 +-
 external/bsd/pdisk/dist/DoSCSICommand.h  |   16 +-
 external/bsd/pdisk/dist/MacSCSICommand.h |  158 ++++++------
 external/bsd/pdisk/dist/SCSI_media.c     |   25 +-
 external/bsd/pdisk/dist/bitfield.c       |   17 +-
 external/bsd/pdisk/dist/bitfield.h       |    5 +-
 external/bsd/pdisk/dist/convert.c        |   88 +++---
 external/bsd/pdisk/dist/cvt_pt.c         |   17 +-
 external/bsd/pdisk/dist/deblock_media.c  |   37 +-
 external/bsd/pdisk/dist/deblock_media.h  |    2 +-
 external/bsd/pdisk/dist/dpme.h           |  116 ++++-----
 external/bsd/pdisk/dist/dump.c           |  193 +++++++--------
 external/bsd/pdisk/dist/dump.h           |    8 +-
 external/bsd/pdisk/dist/errors.c         |   17 +-
 external/bsd/pdisk/dist/errors.h         |    8 +-
 external/bsd/pdisk/dist/file_media.c     |   46 ++-
 external/bsd/pdisk/dist/hfs_misc.c       |  138 +++++-----
 external/bsd/pdisk/dist/io.c             |   37 +-
 external/bsd/pdisk/dist/io.h             |   14 +-
 external/bsd/pdisk/dist/layout_dump.c    |   31 +-
 external/bsd/pdisk/dist/layout_dump.h    |    2 +-
 external/bsd/pdisk/dist/makefile         |    2 +-
 external/bsd/pdisk/dist/media.c          |    6 +-
 external/bsd/pdisk/dist/media.h          |   12 +-
 external/bsd/pdisk/dist/partition_map.c  |  265 ++++++++++++++++------
 external/bsd/pdisk/dist/partition_map.h  |   17 +-
 external/bsd/pdisk/dist/pathname.c       |   15 +-
 external/bsd/pdisk/dist/pdisk.8          |  372 ++++++++++++++++--------------
 external/bsd/pdisk/dist/pdisk.c          |  223 +++++++++++++-----
 external/bsd/pdisk/dist/util.c           |   15 +-
 external/bsd/pdisk/dist/util.h           |    2 +-
 external/bsd/pdisk/dist/validate.c       |   45 ++-
 external/bsd/pdisk/dist/version.h        |    2 +-
 34 files changed, 1182 insertions(+), 936 deletions(-)

diffs (truncated from 4523 to 300 lines):

diff -r 2e7e7d6e5727 -r 257fee5f9905 external/bsd/pdisk/dist/ATA_media.c
--- a/external/bsd/pdisk/dist/ATA_media.c       Sat Mar 23 15:36:43 2013 +0000
+++ b/external/bsd/pdisk/dist/ATA_media.c       Sat Mar 23 15:39:43 2013 +0000
@@ -87,69 +87,69 @@
 };
 
 struct ATA_identify_drive_info {        /* word */
-    unsigned short  config_bits;        /*  0 */
-    unsigned short  num_cylinders;      /*  1 */
-    unsigned short  reserved2;          /*  2 */
-    unsigned short  num_heads;          /*  3 */
-    unsigned short  bytes_per_track;    /*  4 */
-    unsigned short  bytes_per_sector;   /*  5 */
-    unsigned short  sectors_per_track;  /*  6 */
-    unsigned short  vendor7[3];         /*  7-9 */
+    uint16_t  config_bits;        /*  0 */
+    uint16_t  num_cylinders;      /*  1 */
+    uint16_t  reserved2;          /*  2 */
+    uint16_t  num_heads;          /*  3 */
+    uint16_t  bytes_per_track;    /*  4 */
+    uint16_t  bytes_per_sector;   /*  5 */
+    uint16_t  sectors_per_track;  /*  6 */
+    uint16_t  vendor7[3];         /*  7-9 */
     char            serial_number[20];  /* 10-19 */
-    unsigned short  buffer_type;        /* 20 */
-    unsigned short  buffer_size;        /* 21 */
-    unsigned short  num_of_ecc_bytes;   /* 22 */
+    uint16_t  buffer_type;        /* 20 */
+    uint16_t  buffer_size;        /* 21 */
+    uint16_t  num_of_ecc_bytes;   /* 22 */
     char            firmware_rev[8];    /* 23-26 */
     char            model_number[40];   /* 27-46 */
-    unsigned short  word47;             /* 47 */
-    unsigned short  double_word_io;     /* 48 */
-    unsigned short  capabilities;       /* 49 */
-    unsigned short  reserved50;         /* 50 */
-    unsigned short  pio_timing;         /* 51 */
-    unsigned short  dma_timing;         /* 52 */
-    unsigned short  current_is_valid;   /* 53 */
-    unsigned short  cur_cylinders;      /* 54 */
-    unsigned short  cur_heads;          /* 55 */
-    unsigned short  cur_sec_per_track;  /* 56 */
-    unsigned long   total_sectors;      /* 57-58 */
-    unsigned short  multiple_sectors;   /* 59 */
-    unsigned long   lba_sectors;        /* 60-61 */
-    unsigned short  singleword_dma;     /* 62 */
-    unsigned short  multiword_dma;      /* 63 */
-    unsigned short  reserved64[64];     /* 64-127 */
-    unsigned short  vendor128[32];      /* 128-159 */
-    unsigned short  reserved160[96];    /* 160-255 */
+    uint16_t  word47;             /* 47 */
+    uint16_t  double_word_io;     /* 48 */
+    uint16_t  capabilities;       /* 49 */
+    uint16_t  reserved50;         /* 50 */
+    uint16_t  pio_timing;         /* 51 */
+    uint16_t  dma_timing;         /* 52 */
+    uint16_t  current_is_valid;   /* 53 */
+    uint16_t  cur_cylinders;      /* 54 */
+    uint16_t  cur_heads;          /* 55 */
+    uint16_t  cur_sec_per_track;  /* 56 */
+    uint32_t   total_sectors;      /* 57-58 */
+    uint16_t  multiple_sectors;   /* 59 */
+    uint32_t   lba_sectors;        /* 60-61 */
+    uint16_t  singleword_dma;     /* 62 */
+    uint16_t  multiword_dma;      /* 63 */
+    uint16_t  reserved64[64];     /* 64-127 */
+    uint16_t  vendor128[32];      /* 128-159 */
+    uint16_t  reserved160[96];    /* 160-255 */
 };
 
 struct ATAPI_identify_drive_info {      /* word */
-    unsigned short  config_bits;        /*  0 */
-    unsigned short  retired1[9];        /*  1-9 */
+    uint16_t  config_bits;        /*  0 */
+    uint16_t  retired1[9];        /*  1-9 */
     char            serial_number[20];  /* 10-19 */
-    unsigned short  retired20[3];       /* 20-22 */
+    uint16_t  retired20[3];       /* 20-22 */
     char            firmware_rev[8];    /* 23-26 */
     char            model_number[40];   /* 27-46 */
-    unsigned short  retired47[2];       /* 47-48 */
-    unsigned short  capabilities;       /* 49 */
-    unsigned short  reserved50;         /* 50 */
-    unsigned short  pio_timing;         /* 51 */
-    unsigned short  dma_timing;         /* 52 */
-    unsigned short  current_is_valid;   /* 53 */
-    unsigned short  retired54[8];       /* 54-61 */
-    unsigned short  singleword_dma;     /* 62 */
-    unsigned short  multiword_dma;      /* 63 */
-    unsigned short  pio_transfer;       /* 64 */
-    unsigned short  min_cycle_time;     /* 65 */
-    unsigned short  rec_cycle_time;     /* 66 */
-    unsigned short  min_wo_flow;        /* 67 */
-    unsigned short  min_with_flow;      /* 68 */
-    unsigned short  reserved69[2];      /* 69-70 */
-    unsigned short  release_over;       /* 71 */
-    unsigned short  release_service;    /* 72 */
-    unsigned short  major_rev;          /* 73 */
-    unsigned short  minor_rev;          /* 74 */
-    unsigned short  reserved75[53];     /* 75-127 */
-    unsigned short  vendor128[32];      /* 128-159 */
-    unsigned short  reserved160[96];    /* 160-255 */
+    uint16_t  retired47[2];       /* 47-48 */
+    uint16_t  capabilities;       /* 49 */
+    uint16_t  reserved50;         /* 50 */
+    uint16_t  pio_timing;         /* 51 */
+    uint16_t  dma_timing;         /* 52 */
+    uint16_t  current_is_valid;   /* 53 */
+    uint16_t  retired54[8];       /* 54-61 */
+    uint16_t  singleword_dma;     /* 62 */
+    uint16_t  multiword_dma;      /* 63 */
+    uint16_t  pio_transfer;       /* 64 */
+    uint16_t  min_cycle_time;     /* 65 */
+    uint16_t  rec_cycle_time;     /* 66 */
+    uint16_t  min_wo_flow;        /* 67 */
+    uint16_t  min_with_flow;      /* 68 */
+    uint16_t  reserved69[2];      /* 69-70 */
+    uint16_t  release_over;       /* 71 */
+    uint16_t  release_service;    /* 72 */
+    uint16_t  major_rev;          /* 73 */
+    uint16_t  minor_rev;          /* 74 */
+    uint16_t  reserved75[53];     /* 75-127 */
+    uint16_t  vendor128[32];      /* 128-159 */
+    uint16_t  reserved160[96];    /* 160-255 */
 };
 
 /* Identifies the bus protocol type. */
@@ -185,8 +185,8 @@
 pascal SInt16 ataManager(ataPB *pb);
 void ata_init(void);
 ATA_MEDIA new_ata_media(void);
-long read_ata_media(MEDIA m, long long offset, unsigned long count, void *address);
-long write_ata_media(MEDIA m, long long offset, unsigned long count, void *address);
+long read_ata_media(MEDIA m, long long offset, uint32_t count, void *address);
+long write_ata_media(MEDIA m, long long offset, uint32_t count, void *address);
 long close_ata_media(MEDIA m);
 long os_reload_ata_media(MEDIA m);
 long compute_id(long bus, long device);
@@ -196,11 +196,11 @@
 long get_info(long id, struct ATA_identify_drive_info *ip);
 long get_pi_info(long id, struct ATAPI_identify_drive_info *ip);
 long is_atapi(long id);
-long read_atapi_media(MEDIA m, long long offset, unsigned long count, void *address);
-long write_atapi_media(MEDIA m, long long offset, unsigned long count, void *address);
+long read_atapi_media(MEDIA m, long long offset, uint32_t count, void *address);
+long write_atapi_media(MEDIA m, long long offset, uint32_t count, void *address);
 int ATAPI_ReadBlock(UInt32 deviceID, UInt32 block_size, UInt32 block, UInt8 *address);
 int ATAPI_TestUnitReady(UInt32 deviceID);
-int ATAPI_ReadCapacity(UInt32 deviceID, unsigned long *block_size, unsigned long *blocks);
+int ATAPI_ReadCapacity(UInt32 deviceID, uint32_t *block_size, uint32_t *blocks);
 ATA_MEDIA_ITERATOR new_ata_iterator(void);
 void reset_ata_iterator(MEDIA_ITERATOR m);
 char *step_ata_iterator(MEDIA_ITERATOR m);
@@ -439,8 +439,8 @@
     ATA_MEDIA   a;
     long        id;
     struct ATA_identify_drive_info  info;
-    unsigned char *buf;
-    unsigned long total;
+    uint8_t *buf;
+    uint32_t total;
     
     if (ata_inited == 0) {
        ata_init();
@@ -510,7 +510,7 @@
 
 
 long
-read_ata_media(MEDIA m, long long offset, unsigned long count, void *address)
+read_ata_media(MEDIA m, long long offset, uint32_t count, void *address)
 {
     ATA_MEDIA a;
     ataIOPB pb;
@@ -519,7 +519,7 @@
     long block;
     long block_count;
     long block_size;
-    unsigned char *buffer;
+    uint8_t *buffer;
     int i;
     
     a = (ATA_MEDIA) m;
@@ -555,14 +555,14 @@
 
 
 long
-write_ata_media(MEDIA m, long long offset, unsigned long count, void *address)
+write_ata_media(MEDIA m, long long offset, uint32_t count, void *address)
 {
     ATA_MEDIA a;
     long rtn_value;
     long block;
     long block_count;
     long block_size;
-    unsigned char *buffer;
+    uint8_t *buffer;
     int i;
     
     a = (ATA_MEDIA) m;
@@ -772,9 +772,9 @@
     ATA_MEDIA   a;
     long        id;
     struct ATAPI_identify_drive_info    info;
-    unsigned char *buf;
-    unsigned long block_size;
-    unsigned long blocks;   
+    uint8_t *buf;
+    uint32_t block_size;
+    uint32_t blocks;   
     
     if (ata_inited == 0) {
        ata_init();
@@ -821,7 +821,7 @@
 
 
 long
-read_atapi_media(MEDIA m, long long offset, unsigned long count, void *address)
+read_atapi_media(MEDIA m, long long offset, uint32_t count, void *address)
 {
     ATA_MEDIA a;
     ataIOPB pb;
@@ -830,7 +830,7 @@
     long block;
     long block_count;
     long block_size;
-    unsigned char *buffer;
+    uint8_t *buffer;
     int i;
     
     a = (ATA_MEDIA) m;
@@ -866,7 +866,7 @@
 
 
 long
-write_atapi_media(MEDIA m, long long offset, unsigned long count, void *address)
+write_atapi_media(MEDIA m, long long offset, uint32_t count, void *address)
 {   
     return 0;
 }
@@ -974,7 +974,7 @@
 
 
 int
-ATAPI_ReadCapacity(UInt32 deviceID, unsigned long *block_size, unsigned long *blocks)
+ATAPI_ReadCapacity(UInt32 deviceID, uint32_t *block_size, uint32_t *blocks)
 {
     ataIOPB         pb;
     OSErr           status;
@@ -993,7 +993,7 @@
     pb.ataPBFlags           =   mATAFlagTFRead | mATAFlagIORead | mATAFlagProtocol1;
     pb.ataPBTimeOut         =   kATAtimeout;
     
-    pb.ataPBBuffer          =   (unsigned char *)&rcd;
+    pb.ataPBBuffer          =   (uint8_t *)&rcd;
     pb.ataPBByteCount = 8;
     pb.ataPBTaskFile.ataTFCylinder = 8;
     if (deviceID & 0x0FF00) {
@@ -1155,7 +1155,8 @@
                /* generate result */
                result = (char *) malloc(20);
                if (result != NULL) {
-                   sprintf(result, "/dev/ata%c.%c", '0'+a->bus, '0'+a->id);
+                   snprintf(result, 20, "/dev/ata%c.%c",
+                       '0'+a->bus, '0'+a->id);
                }
 
                a->id += 1; /* next id */
@@ -1233,7 +1234,7 @@
        /* name is hda, hdb, hdc, hdd, ...
         * in order (0,0)  (0,1)  (1,0)  (1,1) ...
         */
-       sprintf(result, "/dev/hd%c", 'a' + (bus*2 + id));
+       snprintf(result, 20, "/dev/hd%c", 'a' + (bus*2 + id));
     }
     return result;
 }
diff -r 2e7e7d6e5727 -r 257fee5f9905 external/bsd/pdisk/dist/DoSCSICommand.c
--- a/external/bsd/pdisk/dist/DoSCSICommand.c   Sat Mar 23 15:36:43 2013 +0000
+++ b/external/bsd/pdisk/dist/DoSCSICommand.c   Sat Mar 23 15:39:43 2013 +0000
@@ -93,7 +93,7 @@
 OSErr DoOriginalSCSICommand(
     DeviceIdent             scsiDevice,
     const SCSI_CommandPtr   theSCSICommand,
-    unsigned short          cmdBlockLength,
+    uint16_t          cmdBlockLength,
     Ptr                     dataBuffer,
     ByteCount               dataLength,
     UInt32                  scsiFlags,
@@ -193,7 +193,7 @@
 {
     OSErr                   status;
     SCSI_Command            theSCSICommand;
-    unsigned short          cmdBlockLength;
+    uint16_t          cmdBlockLength;
        
 //      SpinSpinner(&gCurrentInfoPtr->spinnerRecord);
 //      ShowProgressAction(currentAction);
@@ -280,7 +280,7 @@
 DoOriginalSCSICommand(
     DeviceIdent             scsiDevice,



Home | Main Index | Thread Index | Old Index