Hi all,
have problems with uploading files to cr.opensolaris.org, so
what you think for these addons in td_dd.c for bug 5929 :

##################################################
/*
 * ddm_drive_is_zvol()
 *      Checks if drive is ZVOLUME
 *
 * Parameters:
 *      ddm_handle_t *d
 * Return:
 *      int
 * Status:
 *      public
 */
static int
ddm_drive_is_zvol(ddm_handle_t d)
{
        dm_descriptor_t *ad;
        int             errn;
        nvlist_t        *dz;
        char            *devid;
        int             drive_is_zvol;

        drive_is_zvol = 0;
        
        dz = dm_get_attributes(d, &errn);

        if (errn == 0) {
                if (nvlist_lookup_string(dz, DM_OPATH, &devid) == 0) {
                
                        if (strstr(devid, "/dev/zvol") != NULL)
                                drive_is_zvol = 1;
                        else
                                drive_is_zvol = 0;
                }

        nvlist_free(dz);

        return (drive_is_zvol);

        }

        return (0);
        
}

/*
 * ddm_filter_disks()
 *      Excludes all drives not applicable as install target media from
 *      list of dm_descriptor_t and creates list of all possible target
 *      drives. CD/DVD drives are excluded from list for now.
 *
 * Parameters:
 *      dm_descriptor_t *drives
 * Return:
 *
 * Status:
 *      public
 */
static dm_descriptor_t *
ddm_filter_disks(dm_descriptor_t *drives)
{
        int             i;
        int             df_num;

        dm_descriptor_t *df;

        /*
         * Obtain size of drives descriptor array and allocate memory
         * for filtered array with the same size.
         * Filtered array might be smaller than original one. In this
         * case, part of it is left unused.
         */

        for (i = 0; drives[i] != NULL; i++)
                ;

        df = malloc((i + 1) * sizeof (dm_descriptor_t));

        if (df == NULL) {
                DDM_DEBUG(DDM_DBGLVL_ERROR, "%s", "malloc() OOM :-(\n");
                return (NULL);
        }

        for (i = df_num = 0; drives[i] != NULL; i++) {
                /* omit floppy disks */

                if (ddm_drive_is_floppy(drives[i]))
                        continue;


                /* omit zvol */

                if (ddm_drive_is_zvol(drives[i]))
                        continue; 

                /* omit CD/DVD drives */

                if (ddm_drive_is_cdrom(drives[i]))
                        continue;

                df[df_num++] = drives[i];
        }

        df[df_num] = NULL;
        return (df);
}

#############################################################


Test before:

./test_td_static -d
Disk discovery
Total number of disks: 2
---------------------------------
 num |    name|  ctype|size [MB]|
---------------------------------
   1 |*   c0d0|    ata|    76350|
   2 |    swap|unknown|     1024|
---------------------------------

Test after:

./test_td_static -d
Disk discovery
Total number of disks: 1
---------------------------------
 num |    name|  ctype|size [MB]|
---------------------------------
   1 |*   c0d0|    ata|    76350|
---------------------------------


Cheers,
-- 

::alhazred

Reply via email to