FreeBSD Bugzilla – Attachment 247922 Details for
Bug 243530
sysutils/cciss_vol_status: Does not display (some) physical drives
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to solve numerous issues in cciss_vol_status
cciss_vol_status.patch (text/plain), 7.97 KB, created by
Peter Eriksson
on 2024-01-24 12:25:49 UTC
(
hide
)
Description:
Patch to solve numerous issues in cciss_vol_status
Filename:
MIME Type:
Creator:
Peter Eriksson
Created:
2024-01-24 12:25:49 UTC
Size:
7.97 KB
patch
obsolete
>--- cciss_vol_status.c.orig 2017-03-10 23:14:51.000000000 +0100 >+++ cciss_vol_status.c 2024-01-24 13:16:15.820173000 +0100 >@@ -52,6 +52,7 @@ > #include <sys/types.h> > #include <sys/stat.h> > #include <fcntl.h> >+#include <arpa/inet.h> > > #if HAVE_ERRNO_H > #include <errno.h> >@@ -613,13 +614,14 @@ > > void usage() > { >- fprintf(stderr, "%s: usage: %s [-p] [-q] [-v] [-u] [-x] /dev/cciss/c*d0 /dev/sg*\n", progname, progname); >+ fprintf(stderr, "Usage: %s [<switches>] /dev/ciss* [/dev/pass*]\n", progname); > fprintf(stderr, " -p --persnickety Complain about device nodes which can't be opened.\n"); > fprintf(stderr, " -u --try-unknown-devices Allow interrogation of even unrecognized controllers\n"); > fprintf(stderr, " (useful for brand new hardware.)\n"); > fprintf(stderr, " -s --smart Report S.M.A.R.T. predictive failures. \n"); > fprintf(stderr, " -v --version Print program version and exit.\n"); > fprintf(stderr, " -V --verbose Print more info about controller and disks.\n"); >+ fprintf(stderr, " -D --details Print even more info.\n"); > fprintf(stderr, " -C --copyright Print copyright notice first.\n"); > exit(-1); > } >@@ -637,7 +639,7 @@ > int big_map_support; > int drives_per_scsi_bus; > >- big_map_support = (id->controller_flags && (1<<7)); >+ big_map_support = (id->controller_flags & (1<<7)); > drives_per_scsi_bus = id->drives_per_scsi_bus;; > > /* if no big drive map support, & zero devices per scsi bus */ >@@ -683,7 +685,7 @@ > copy_drive_field(model, device_data->drive_model, sizeof(device_data->drive_model)); > copy_drive_field(serial_no, device_data->drive_serial_no, sizeof(device_data->drive_serial_no)); > copy_drive_field(fw_rev, device_data->drive_fw_rev, sizeof(device_data->drive_fw_rev)); >- sprintf(tail, " connector %c%c box %d bay %d %40s %40s %8s", >+ sprintf(tail, " connector %c%c box %2d bay %2d %40s %40s %8s", > device_data->phys_connector[0], > device_data->phys_connector[1], > device_data->phys_box_on_bus, >@@ -1001,7 +1003,7 @@ > struct identify_physical_device device_data; > char location[300]; > >- big_map_support = (id->controller_flags && (1<<7)); >+ big_map_support = (id->controller_flags & (1<<7)); > drives_per_scsi_bus = id->drives_per_scsi_bus;; > > /* if no big drive map support, & zero devices per scsi bus */ >@@ -1098,7 +1100,7 @@ > break; > case 1: sprintf(raid_level, "RAID 4"); > break; >- case 2: sprintf(raid_level, "RAID 1"); >+ case 2: sprintf(raid_level, "RAID 1(1+0)"); > break; > case 3: sprintf(raid_level, "RAID 5"); > break; >@@ -1180,7 +1182,7 @@ > int alarms; > char status[4*60]; > char enclosure_name[17]; >- char enclosure_sn[41]; >+ char enclosure_sn[42]; > int i; > > /* check if inquiry was valid (if not, bus does not exist) */ >@@ -2291,7 +2293,7 @@ > return; > > printf("%35s: %hu MiB\n", "Total cache memory", cache_config->total_memory_size); >- printf("%35s: %d% Read / %d% Write\n", "Cache Ratio", cache_config->percent_read_cache, cache_config->percent_write_cache); >+ printf("%35s: %d%% Read / %d%% Write\n", "Cache Ratio", cache_config->percent_read_cache, cache_config->percent_write_cache); > printf("%35s: %hu MiB\n", "Read cache memory", cache_config->mem_for_read_cache); > printf("%35s: %hu MiB\n", "Write cache memory", cache_config->mem_for_write_cache); > printf("%35s: %s\n", "Write cache enabled", >@@ -2357,6 +2359,8 @@ > } > } > >+#ifdef HAVE_SCSI_SG_H >+ > static int msa1000_status(char *file, int fd) > { > int i, rc, numluns; >@@ -2378,6 +2382,7 @@ > close(fd); > return 0; > } >+#endif > > static int cciss_device_type_is_correct(char *file, int fd) > { >@@ -2477,7 +2482,7 @@ > > static inline int bmic_supports_big_maps(struct identify_controller *id) > { >- return id->controller_flags && (1<<7); >+ return id->controller_flags & (1<<7); > } > > static int bmic_next_disk_bits(uint8_t *bits, int bitmapsize, int disk) >@@ -2489,6 +2494,14 @@ > return -1; > } > >+static int bmic_is_ext_phy_disk(struct identify_controller *id, int bmic_drive_number) >+{ >+ if (bmic_supports_big_maps(id)) >+ return bitisset((uint8_t *) id->big_ext_drive_map, bmic_drive_number, 128); >+ else >+ return bitisset((uint8_t *) &id->external_drive_bit_map, bmic_drive_number, 32); >+} >+ > static inline int bmic_next_phy_disk(struct identify_controller *id, int bmic_drive_number) > { > if (bmic_supports_big_maps(id)) >@@ -2574,7 +2587,9 @@ > int i, rc; > struct identify_controller id; > int physical_drive_count = 0; >- >+ int ext_physical_drive_count = 0; >+ int non_disks_count = 0; >+ > rc = id_ctlr_fd(file, fd, controller_lun, &id); > if (rc != 0) { > fprintf(stderr, "%s: cannot identify controller 0x%02x%02x%02x%02x%02x%02x%02x%02x\n", >@@ -2588,12 +2603,46 @@ > for (i = bmic_next_phy_disk(&id, -1); i != -1; i = bmic_next_phy_disk(&id, i)) > physical_drive_count++; > >- if (verbose) >- printf(" Physical drives: %d\n", physical_drive_count); >+ for (i = bmic_next_ext_phy_disk(&id, -1); i != -1; i = bmic_next_ext_phy_disk(&id, i)) >+ ext_physical_drive_count++; > >- /* For each physical disk i... */ >- for (i = bmic_next_phy_disk(&id, -1); i != -1; i = bmic_next_phy_disk(&id, i)) >- check_physical_drive(file, fd, controller_lun, &id, i); >+ for (i = bmic_next_non_disk(&id, -1); i != -1; i = bmic_next_non_disk(&id, i)) >+ non_disks_count++; >+ >+ if (verbose) { >+ if (verbose > 1) { >+ int n_internal = physical_drive_count-ext_physical_drive_count; >+ >+ if (n_internal > 0) { >+ printf(" Internal Physical Drives: %d\n", n_internal); >+ >+ for (i = bmic_next_phy_disk(&id, -1); i != -1; i = bmic_next_phy_disk(&id, i)) { >+ if (!bmic_is_ext_phy_disk(&id, i)) >+ check_physical_drive(file, fd, controller_lun, &id, i); >+ } >+ } >+ if (ext_physical_drive_count > 0) { >+ printf(" External Physical Drives: %d\n", ext_physical_drive_count); >+ for (i = bmic_next_ext_phy_disk(&id, -1); i != -1; i = bmic_next_ext_phy_disk(&id, i)) >+ check_physical_drive(file, fd, controller_lun, &id, i); >+ } >+ } else { >+ printf(" Physical Drives: %d\n", physical_drive_count); >+ >+ if (physical_drive_count > 0) { >+ for (i = bmic_next_phy_disk(&id, -1); i != -1; i = bmic_next_phy_disk(&id, i)) { >+ check_physical_drive(file, fd, controller_lun, &id, i); >+ } >+ } >+ } >+ >+ } >+ >+ if (verbose && non_disks_count > 0) { >+ printf(" Non-Compliant Drives: %d\n", non_disks_count); >+ for (i = bmic_next_non_disk(&id, -1); i != -1; i = bmic_next_non_disk(&id, i)) >+ check_physical_drive(file, fd, controller_lun, &id, i); >+ } > } > > static void check_physical_drives(char *file, int fd) >@@ -2707,7 +2756,7 @@ > static void intro() > { > if (isatty(2) && !be_quiet) { /* Only print this message if stderr is a tty */ >- fprintf(stderr, "%s version %s,\n" >+ fprintf(stderr, "%s version %s-pen,\n" > "Copyright (C) 2007 Hewlett-Packard Development Company, L.P.\n", > progname, VERSION_NUMBER); > fprintf(stderr, "%s comes with ABSOLUTELY NO WARRANTY.\n", progname); >@@ -2729,6 +2778,7 @@ > { "smart", 0, NULL, 's'}, > { "copyright", 0, NULL, 'C'}, /* opposite of -q */ > { "verbose", 0, NULL, 'V'}, >+ { "detailed", 0, NULL, 'D'}, > { NULL, 0, NULL, 0}, > }; > >@@ -2738,7 +2788,7 @@ > > do { > >- opt = getopt_long(argc, argv, "dpqusvVxC", longopts, NULL ); >+ opt = getopt_long(argc, argv, "dpqushvVDxC", longopts, NULL ); > switch (opt) { > case 'd': debug = 1; > continue; >@@ -2753,21 +2803,25 @@ > case 'C': be_quiet = 0; > intro(); > continue; >- case 'v': fprintf(stderr, "%s version %s%s\n", progname, >- VERSION_NUMBER, >+ case 'v': fprintf(stderr, "%s version %s-pen%s\n", >+ progname, >+ VERSION_NUMBER, > #ifdef HAVE_SCSI_SG_H >- "" >+ "" > #else >- "(without support for MSA1000)" >+ " (without support for MSA1000)" > #endif >- ); >+ ); > exit(0); > case 'x' : exhaustive_search = 1; > /* exhaustive search doesn't really do anything anymore. */ > continue; > case 'V' : verbose = 1; > continue; >+ case 'D' : verbose = 2; >+ continue; > case '?' : >+ case 'h' : > case ':' : > usage(); /* usage calls exit(), so no fall thru */ > case -1 :
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 243530
:
247922
|
254634