include: Add libhusb_internal.h
authorPawel Szewczyk <p.szewczyk@samsung.com>
Mon, 28 Sep 2015 11:33:35 +0000 (13:33 +0200)
committerStanislaw Wadas <s.wadas@samsung.com>
Wed, 2 Dec 2015 12:50:46 +0000 (13:50 +0100)
For convenience of testing, internal data structures are moved to
separate header. They are still used only internally, but can be
included in tests as well.

Change-Id: I419f155cd5c5251a716f3b8e430074309664a2e5
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
include/libhusb_internal.h [new file with mode: 0644]
src/libhusb.c

diff --git a/include/libhusb_internal.h b/include/libhusb_internal.h
new file mode 100644 (file)
index 0000000..92cfb5f
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * libhusb_internal.h
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "libhusb.h"
+#include "uref.h"
+#include "common.h"
+#include "log.h"
+#include <libusb-1.0/libusb.h>
+
+#define MAX_NMB_OF_CONFIGS 255
+
+struct libhusb_context {
+       libusb_context *lusb_ctx;
+};
+
+struct libhusb_device {
+       struct uref ref;
+       libusb_device *lusb_dev;
+       int refcnt;
+};
+
+struct libhusb_device_handle {
+       struct libhusb_device *device;
+       struct libusb_device_handle *lusb_dev_handle;
+       /* TODO: replace with bit fields */
+       unsigned char driver_detached[MAX_NMB_OF_CONFIGS];
+};
index 51b075cb864a9ed7ab9453ce21adbdf6174df9d1..06443c190b2c0de8f7c07383e4ee53b84a4b4579 100644 (file)
 #include "common.h"
 #include "log.h"
 
-#define MAX_NMB_OF_CONFIGS 255
-
-struct libhusb_context {
-       libusb_context *lusb_ctx;
-};
-
-struct libhusb_device {
-       struct uref ref;
-       libusb_device *lusb_dev;
-       int refcnt;
-};
+#include "libhusb_internal.h"
 
 static inline struct libhusb_device *to_libhusb_device(struct uref *_uref)
 {
        return container_of(_uref, struct libhusb_device, ref);
 }
 
-struct libhusb_device_handle {
-       struct libhusb_device *device;
-       struct libusb_device_handle *lusb_dev_handle;
-       /* TODO: replace with bit fields */
-       unsigned char driver_detached[MAX_NMB_OF_CONFIGS];
-};
-
 static int translate_error(int error_code)
 {
        switch (error_code) {