lkml.org 
[lkml]   [2003]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] DM 3/6: Move retrieve_status function
    Date
    Move retrieve_status up so dev_wait() can use it.

    --- diff/drivers/md/dm-ioctl-v4.c 2003-09-17 13:08:53.000000000 +0100
    +++ source/drivers/md/dm-ioctl-v4.c 2003-09-17 13:09:04.000000000 +0100
    @@ -700,6 +700,69 @@
    }

    /*
    + * Build up the status struct for each target
    + */
    +static void retrieve_status(struct dm_table *table,
    + struct dm_ioctl *param, size_t param_size)
    +{
    + unsigned int i, num_targets;
    + struct dm_target_spec *spec;
    + char *outbuf, *outptr;
    + status_type_t type;
    + size_t remaining, len, used = 0;
    +
    + outptr = outbuf = get_result_buffer(param, param_size, &len);
    +
    + if (param->flags & DM_STATUS_TABLE_FLAG)
    + type = STATUSTYPE_TABLE;
    + else
    + type = STATUSTYPE_INFO;
    +
    + /* Get all the target info */
    + num_targets = dm_table_get_num_targets(table);
    + for (i = 0; i < num_targets; i++) {
    + struct dm_target *ti = dm_table_get_target(table, i);
    +
    + remaining = len - (outptr - outbuf);
    + if (remaining < sizeof(struct dm_target_spec)) {
    + param->flags |= DM_BUFFER_FULL_FLAG;
    + break;
    + }
    +
    + spec = (struct dm_target_spec *) outptr;
    +
    + spec->status = 0;
    + spec->sector_start = ti->begin;
    + spec->length = ti->len;
    + strncpy(spec->target_type, ti->type->name,
    + sizeof(spec->target_type));
    +
    + outptr += sizeof(struct dm_target_spec);
    + remaining = len - (outptr - outbuf);
    +
    + /* Get the status/table string from the target driver */
    + if (ti->type->status) {
    + if (ti->type->status(ti, type, outptr, remaining)) {
    + param->flags |= DM_BUFFER_FULL_FLAG;
    + break;
    + }
    + } else
    + outptr[0] = '\0';
    +
    + outptr += strlen(outptr) + 1;
    + used = param->data_start + (outptr - outbuf);
    +
    + align_ptr(outptr);
    + spec->next = outptr - outbuf;
    + }
    +
    + if (used)
    + param->data_size = used;
    +
    + param->target_count = num_targets;
    +}
    +
    +/*
    * Wait for a device to report an event
    */
    static int dev_wait(struct dm_ioctl *param, size_t param_size)
    @@ -920,69 +983,6 @@
    }

    /*
    - * Build up the status struct for each target
    - */
    -static void retrieve_status(struct dm_table *table,
    - struct dm_ioctl *param, size_t param_size)
    -{
    - unsigned int i, num_targets;
    - struct dm_target_spec *spec;
    - char *outbuf, *outptr;
    - status_type_t type;
    - size_t remaining, len, used = 0;
    -
    - outptr = outbuf = get_result_buffer(param, param_size, &len);
    -
    - if (param->flags & DM_STATUS_TABLE_FLAG)
    - type = STATUSTYPE_TABLE;
    - else
    - type = STATUSTYPE_INFO;
    -
    - /* Get all the target info */
    - num_targets = dm_table_get_num_targets(table);
    - for (i = 0; i < num_targets; i++) {
    - struct dm_target *ti = dm_table_get_target(table, i);
    -
    - remaining = len - (outptr - outbuf);
    - if (remaining < sizeof(struct dm_target_spec)) {
    - param->flags |= DM_BUFFER_FULL_FLAG;
    - break;
    - }
    -
    - spec = (struct dm_target_spec *) outptr;
    -
    - spec->status = 0;
    - spec->sector_start = ti->begin;
    - spec->length = ti->len;
    - strncpy(spec->target_type, ti->type->name,
    - sizeof(spec->target_type));
    -
    - outptr += sizeof(struct dm_target_spec);
    - remaining = len - (outptr - outbuf);
    -
    - /* Get the status/table string from the target driver */
    - if (ti->type->status) {
    - if (ti->type->status(ti, type, outptr, remaining)) {
    - param->flags |= DM_BUFFER_FULL_FLAG;
    - break;
    - }
    - } else
    - outptr[0] = '\0';
    -
    - outptr += strlen(outptr) + 1;
    - used = param->data_start + (outptr - outbuf);
    -
    - align_ptr(outptr);
    - spec->next = outptr - outbuf;
    - }
    -
    - if (used)
    - param->data_size = used;
    -
    - param->target_count = num_targets;
    -}
    -
    -/*
    * Return the status of a device as a text string for each
    * target.
    */
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:48    [W:0.032 / U:0.128 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site