summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-07-09 17:16:05 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-07-09 17:16:05 +0200
commitcbc9bed8ae85af36ad8579476ab91e89c3cd310e (patch)
tree2a070c03426a8d110428a41388b090bd4b339427 /methods
parent8e372e79de1277f3508c20c2eb486165402e5afc (diff)
move libudev based code into libapt cdrom.cc class
Diffstat (limited to 'methods')
-rw-r--r--methods/cdrom.cc54
1 files changed, 0 insertions, 54 deletions
diff --git a/methods/cdrom.cc b/methods/cdrom.cc
index 0310b66cd..7a20ae514 100644
--- a/methods/cdrom.cc
+++ b/methods/cdrom.cc
@@ -25,23 +25,6 @@
using namespace std;
-struct udev;
-struct udev_list_entry;
-
-// libudev dlopen stucture
-struct udev_p {
- struct udev* (*udev_new)(void);
- int (*udev_enumerate_add_match_property)(struct udev_enumerate *udev_enumerate, const char *property, const char *value);
- int (*udev_enumerate_scan_devices)(struct udev_enumerate *udev_enumerate);
- struct udev_list_entry *(*udev_enumerate_get_list_entry)(struct udev_enumerate *udev_enumerate);
- struct udev_device *(*udev_device_new_from_syspath)(struct udev *udev, const char *syspath);
- struct udev *(*udev_enumerate_get_udev)(struct udev_enumerate *udev_enumerate);
- const char *(*udev_list_entry_get_name)(struct udev_list_entry *list_entry);
- const char *(*udev_device_get_devnode)(struct udev_device *udev_device);
- struct udev_enumerate *(*udev_enumerate_new) (struct udev *udev);
- struct udev_list_entry *(*udev_list_entry_get_next)(struct udev_list_entry *list_entry);
-};
-
class CDROMMethod : public pkgAcqMethod
{
bool DatabaseLoaded;
@@ -49,7 +32,6 @@ class CDROMMethod : public pkgAcqMethod
string CurrentID;
string CDROM;
bool MountedByApt;
- vector<string> CdromDevices;
virtual bool Fetch(FetchItem *Itm);
string GetID(string Name);
@@ -69,42 +51,6 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
DatabaseLoaded(false),
MountedByApt(false)
{
- // see if we can get libudev
- void *h = dlopen("libudev.so.0", RTLD_LAZY);
- if (h) {
- // the pointers for the udev struct
- struct udev_p p;
- p.udev_new = (udev* (*)(void)) dlsym(h, "udev_new");
- p.udev_enumerate_add_match_property = (int (*)(udev_enumerate*, const char*, const char*))dlsym(h, "udev_enumerate_add_match_property");
- p.udev_enumerate_scan_devices = (int (*)(udev_enumerate*))dlsym(h, "udev_enumerate_scan_devices");
- p.udev_enumerate_get_list_entry = (udev_list_entry* (*)(udev_enumerate*))dlsym(h, "udev_enumerate_get_list_entry");
- p.udev_device_new_from_syspath = (udev_device* (*)(udev*, const char*))dlsym(h, "udev_device_new_from_syspath");
- p.udev_enumerate_get_udev = (udev* (*)(udev_enumerate*))dlsym(h, "udev_enumerate_get_udev");
- p.udev_list_entry_get_name = (const char* (*)(udev_list_entry*))dlsym(h, "udev_list_entry_get_name");
- p.udev_device_get_devnode = (const char* (*)(udev_device*))dlsym(h, "udev_device_get_devnode");
- p.udev_enumerate_new = (udev_enumerate* (*)(udev*))dlsym(h, "udev_enumerate_new");
- p.udev_list_entry_get_next = (udev_list_entry* (*)(udev_list_entry*))dlsym(h, "udev_list_entry_get_next");
- struct udev_enumerate *enumerate;
- struct udev_list_entry *l, *devices;
- struct udev *udev_ctx;
-
- udev_ctx = p.udev_new();
- enumerate = p.udev_enumerate_new (udev_ctx);
- p.udev_enumerate_add_match_property(enumerate, "ID_CDROM", "1");
-
- p.udev_enumerate_scan_devices (enumerate);
- devices = p.udev_enumerate_get_list_entry (enumerate);
- for (l = devices; l != NULL; l = p.udev_list_entry_get_next (l))
- {
- struct udev_device *udevice;
- udevice = p.udev_device_new_from_syspath (p.udev_enumerate_get_udev (enumerate), p.udev_list_entry_get_name (l));
- if (udevice == NULL)
- continue;
- const char* devnode = p.udev_device_get_devnode(udevice);
- //std::cerr << devnode << std::endl;
- CdromDevices.push_back(string(devnode));
- }
- }
};