dm-ioctl.c (bb56acf840600421e68f49bb037d1c659fcb37f8) dm-ioctl.c (96a1f7dba6e464155c0d1dc69c6c2efa96b644ac)
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
3 * Copyright (C) 2004 - 2006 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm.h"

--- 1501 unchanged lines hidden (view full) ---

1510
1511void dm_interface_exit(void)
1512{
1513 if (misc_deregister(&_dm_misc) < 0)
1514 DMERR("misc_deregister failed for control device");
1515
1516 dm_hash_exit();
1517}
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
3 * Copyright (C) 2004 - 2006 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm.h"

--- 1501 unchanged lines hidden (view full) ---

1510
1511void dm_interface_exit(void)
1512{
1513 if (misc_deregister(&_dm_misc) < 0)
1514 DMERR("misc_deregister failed for control device");
1515
1516 dm_hash_exit();
1517}
1518
1519/**
1520 * dm_copy_name_and_uuid - Copy mapped device name & uuid into supplied buffers
1521 * @md: Pointer to mapped_device
1522 * @name: Buffer (size DM_NAME_LEN) for name
1523 * @uuid: Buffer (size DM_UUID_LEN) for uuid or empty string if uuid not defined
1524 */
1525int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid)
1526{
1527 int r = 0;
1528 struct hash_cell *hc;
1529
1530 if (!md)
1531 return -ENXIO;
1532
1533 dm_get(md);
1534 down_read(&_hash_lock);
1535 hc = dm_get_mdptr(md);
1536 if (!hc || hc->md != md) {
1537 r = -ENXIO;
1538 goto out;
1539 }
1540
1541 strcpy(name, hc->name);
1542 strcpy(uuid, hc->uuid ? : "");
1543
1544out:
1545 up_read(&_hash_lock);
1546 dm_put(md);
1547
1548 return r;
1549}