~ubuntu-branches/ubuntu/raring/libvirt/raring

« back to all changes in this revision

Viewing changes to src/node_device/node_device_driver.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-11-19 10:41:02 UTC
  • mfrom: (1.2.15) (223.1.2 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20121119104102-l6ewdppikysbzztu
Tags: 1.0.0-0ubuntu2
debian/patches/add-armhf-sysinfo-infomration.patch: Disable
to fix FTBFS on arm.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Lesser General Public License for more details.
17
17
 *
18
18
 * You should have received a copy of the GNU Lesser General Public
19
 
 * License along with this library; if not, write to the Free Software
20
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
19
 * License along with this library.  If not, see
 
20
 * <http://www.gnu.org/licenses/>.
21
21
 *
22
22
 * Author: David F. Lively <dlively@virtualiron.com>
23
23
 */
183
183
    return -1;
184
184
}
185
185
 
 
186
int
 
187
nodeListAllNodeDevices(virConnectPtr conn,
 
188
                       virNodeDevicePtr **devices,
 
189
                       unsigned int flags)
 
190
{
 
191
    virDeviceMonitorStatePtr driver = conn->devMonPrivateData;
 
192
    int ret = -1;
 
193
 
 
194
    virCheckFlags(VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP, -1);
 
195
 
 
196
    nodeDeviceLock(driver);
 
197
    ret = virNodeDeviceList(conn, driver->devs, devices, flags);
 
198
    nodeDeviceUnlock(driver);
 
199
    return ret;
 
200
}
186
201
 
187
202
virNodeDevicePtr
188
203
nodeDeviceLookupByName(virConnectPtr conn, const char *name)
196
211
    nodeDeviceUnlock(driver);
197
212
 
198
213
    if (!obj) {
199
 
        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
 
214
        virReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
200
215
        goto cleanup;
201
216
    }
202
217
 
271
286
    nodeDeviceUnlock(driver);
272
287
 
273
288
    if (!obj) {
274
 
        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
275
 
                                 _("no node device with matching name '%s'"),
276
 
                                 dev->name);
 
289
        virReportError(VIR_ERR_NO_NODE_DEVICE,
 
290
                       _("no node device with matching name '%s'"),
 
291
                       dev->name);
277
292
        goto cleanup;
278
293
    }
279
294
 
301
316
    nodeDeviceUnlock(driver);
302
317
 
303
318
    if (!obj) {
304
 
        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
305
 
                                 _("no node device with matching name '%s'"),
306
 
                                 dev->name);
 
319
        virReportError(VIR_ERR_NO_NODE_DEVICE,
 
320
                       _("no node device with matching name '%s'"),
 
321
                       dev->name);
307
322
        goto cleanup;
308
323
    }
309
324
 
312
327
        if (!ret)
313
328
            virReportOOMError();
314
329
    } else {
315
 
        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
316
 
                                 "%s", _("no parent for this device"));
 
330
        virReportError(VIR_ERR_INTERNAL_ERROR,
 
331
                       "%s", _("no parent for this device"));
317
332
    }
318
333
 
319
334
cleanup:
337
352
    nodeDeviceUnlock(driver);
338
353
 
339
354
    if (!obj) {
340
 
        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
341
 
                                 _("no node device with matching name '%s'"),
342
 
                                 dev->name);
 
355
        virReportError(VIR_ERR_NO_NODE_DEVICE,
 
356
                       _("no node device with matching name '%s'"),
 
357
                       dev->name);
343
358
        goto cleanup;
344
359
    }
345
360
 
368
383
    nodeDeviceUnlock(driver);
369
384
 
370
385
    if (!obj) {
371
 
        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
372
 
                                 _("no node device with matching name '%s'"),
373
 
                                 dev->name);
 
386
        virReportError(VIR_ERR_NO_NODE_DEVICE,
 
387
                       _("no node device with matching name '%s'"),
 
388
                       dev->name);
374
389
        goto cleanup;
375
390
    }
376
391
 
414
429
        operation_file = LINUX_SYSFS_VPORT_DELETE_POSTFIX;
415
430
        break;
416
431
    default:
417
 
        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
418
 
                                 _("Invalid vport operation (%d)"), operation);
 
432
        virReportError(VIR_ERR_INTERNAL_ERROR,
 
433
                       _("Invalid vport operation (%d)"), operation);
419
434
        retval = -1;
420
435
        goto cleanup;
421
436
        break;
487
502
 
488
503
    *t = time(NULL);
489
504
    if (*t == (time_t)-1) {
490
 
        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
491
 
                                 "%s", _("Could not get current time"));
 
505
        virReportError(VIR_ERR_INTERNAL_ERROR,
 
506
                       "%s", _("Could not get current time"));
492
507
 
493
508
        *t = 0;
494
509
        ret = -1;
593
608
     * we're returning what we get... */
594
609
 
595
610
    if (dev == NULL) {
596
 
        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
 
611
        virReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
597
612
    }
598
613
 
599
614
cleanup:
619
634
    nodeDeviceUnlock(driver);
620
635
 
621
636
    if (!obj) {
622
 
        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
 
637
        virReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
623
638
        goto out;
624
639
    }
625
640