~ubuntu-branches/debian/sid/lvm2/sid

« back to all changes in this revision

Viewing changes to liblvm/lvm_lv.c

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2013-03-03 12:33:47 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20130303123347-smfwei6dodkdth55
Tags: 2.02.98-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
 */
145
145
lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size)
146
146
{
147
 
        struct lvcreate_params lp;
 
147
        struct lvcreate_params lp = { 0 };
148
148
        uint64_t extents;
149
149
        struct lv_list *lvl;
150
150
 
152
152
                return NULL;
153
153
        if (!vg_check_write_mode(vg))
154
154
                return NULL;
155
 
        memset(&lp, 0, sizeof(lp));
156
 
        extents = extents_from_size(vg->cmd, size / SECTOR_SIZE,
157
 
                                    vg->extent_size);
 
155
 
 
156
        if (!(extents = extents_from_size(vg->cmd, size / SECTOR_SIZE,
 
157
                                          vg->extent_size))) {
 
158
                log_error("Unable to create LV without size.");
 
159
                return NULL;
 
160
        }
 
161
 
158
162
        _lv_set_default_params(&lp, vg, name, extents);
159
163
        if (!_lv_set_default_linear_params(vg->cmd, &lp))
160
164
                return_NULL;
161
165
        if (!lv_create_single(vg, &lp))
162
 
                return NULL;
163
 
        lvl = find_lv_in_vg(vg, name);
164
 
        if (!lvl)
 
166
                return_NULL;
 
167
        if (!(lvl = find_lv_in_vg(vg, name)))
165
168
                return NULL;
166
169
        return (lv_t) lvl->lv;
167
170
}
289
292
        }
290
293
        return NULL;
291
294
}
 
295
 
 
296
int lvm_lv_rename(lv_t lv, const char *new_name)
 
297
{
 
298
        if (!lv_rename(lv->vg->cmd, lv, new_name)) {
 
299
                log_verbose("LV Rename failed.");
 
300
                return -1;
 
301
        }
 
302
        return 0;
 
303
}
 
304
 
292
305
int lvm_lv_resize(const lv_t lv, uint64_t new_size)
293
306
{
294
307
        /* FIXME: add lv resize code here */