[PATCH 8/8] staging/hv: remove StorVsc.c from BlkVsc.c
Bill Pemberton
wfp5p at virginia.edu
Fri Aug 7 19:52:21 UTC 2009
BlkVsc.c did #include "StorVsc.c". Moves the common function
prototypes in to include/StorVscApi.h and export them.
Signed-off-by: Bill Pemberton <wfp5p at virginia.edu>
---
drivers/staging/hv/BlkVsc.c | 7 ++-
drivers/staging/hv/Makefile | 4 +-
drivers/staging/hv/StorVsc.c | 85 ++++---------------------------
drivers/staging/hv/include/StorVscApi.h | 57 +++++++++++++++++---
4 files changed, 66 insertions(+), 87 deletions(-)
diff --git a/drivers/staging/hv/BlkVsc.c b/drivers/staging/hv/BlkVsc.c
index 5d17877..3dc8b8c 100644
--- a/drivers/staging/hv/BlkVsc.c
+++ b/drivers/staging/hv/BlkVsc.c
@@ -21,8 +21,13 @@
*/
#include <linux/kernel.h>
+#include <linux/string.h>
#include <linux/mm.h>
-#include "StorVsc.c"
+#include <linux/delay.h>
+#include "include/logging.h"
+
+#include "include/StorVscApi.h"
+#include "include/VmbusPacketFormat.h"
static const char* gBlkDriverName="blkvsc";
diff --git a/drivers/staging/hv/Makefile b/drivers/staging/hv/Makefile
index f6ad670..704e0c0 100644
--- a/drivers/staging/hv/Makefile
+++ b/drivers/staging/hv/Makefile
@@ -3,7 +3,7 @@ obj-$(CONFIG_HYPERV_STORAGE) += hv_storvsc.o
obj-$(CONFIG_HYPERV_BLOCK) += hv_blkvsc.o
obj-$(CONFIG_HYPERV_NET) += hv_netvsc.o
-hv_vmbus-objs := vmbus_drv.o osd.o Sources.o
-hv_storvsc-objs := storvsc_drv.o StorVsc.o
+hv_vmbus-objs := vmbus_drv.o osd.o Sources.o StorVsc.o
+hv_storvsc-objs := storvsc_drv.o
hv_blkvsc-objs := blkvsc_drv.o BlkVsc.o
hv_netvsc-objs := netvsc_drv.o NetVsc.o RndisFilter.o
diff --git a/drivers/staging/hv/StorVsc.c b/drivers/staging/hv/StorVsc.c
index 068125d..4f789ca 100644
--- a/drivers/staging/hv/StorVsc.c
+++ b/drivers/staging/hv/StorVsc.c
@@ -25,61 +25,17 @@
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/delay.h>
+#include <linux/module.h>
#include "include/logging.h"
#include "include/StorVscApi.h"
#include "include/VmbusPacketFormat.h"
-#include "include/vstorage.h"
-
/* #defines */
-/* Data types */
-
-
-struct hv_storvsc_request_ext {
- /* LIST_ENTRY ListEntry; */
-
- struct hv_storvsc_request *Request;
- struct hv_device *Device;
-
- /* Synchronize the request/response if needed */
- struct osd_waitevent *WaitEvent;
-
- struct hv_vstor_packet VStorPacket;
-};
-
-
-/* A storvsc device is a device object that contains a vmbus channel */
-struct hv_storvsc_device {
- struct hv_device *Device;
-
- atomic_t RefCount; /* 0 indicates the device is being destroyed */
-
- atomic_t NumOutstandingRequests;
-
- /*
- * Each unique Port/Path/Target represents 1 channel ie scsi
- * controller. In reality, the pathid, targetid is always 0
- * and the port is set by us
- */
- unsigned int PortNumber;
- unsigned char PathId;
- unsigned char TargetId;
-
- /* LIST_ENTRY OutstandingRequestList; */
- /* HANDLE OutstandingRequestLock; */
-
- /* Used for vsc/vsp channel reset process */
- struct hv_storvsc_request_ext InitRequest;
- struct hv_storvsc_request_ext ResetRequest;
-
-};
-
-
/* Globals */
@@ -91,34 +47,12 @@ static const GUID gStorVscDeviceType={
};
-/* Internal routines */
-
-static int
-StorVscOnDeviceAdd(
- struct hv_device *Device,
- void *AdditionalInfo
- );
-
-static int
-StorVscOnDeviceRemove(
- struct hv_device *Device
- );
-
-static int
-StorVscOnIORequest(
- struct hv_device *Device,
- struct hv_storvsc_request *Request
- );
static int
StorVscOnHostReset(
struct hv_device *Device
);
-static void
-StorVscOnCleanup(
- struct hv_driver *Device
- );
static void
StorVscOnChannelCallback(
@@ -296,7 +230,7 @@ StorVscInitialize(
return ret;
}
-
+EXPORT_SYMBOL_GPL(StorVscInitialize);
/*++
Name:
@@ -306,7 +240,7 @@ Description:
Callback when the device belonging to this driver is added
--*/
-static int
+int
StorVscOnDeviceAdd(
struct hv_device *Device,
void *AdditionalInfo
@@ -355,6 +289,7 @@ Cleanup:
return ret;
}
+EXPORT_SYMBOL_GPL(StorVscOnDeviceAdd);
static int StorVscChannelInit(struct hv_device *Device)
{
@@ -563,7 +498,7 @@ Description:
Callback when the our device is being removed
--*/
-static int
+int
StorVscOnDeviceRemove(
struct hv_device *Device
)
@@ -603,6 +538,7 @@ StorVscOnDeviceRemove(
DPRINT_EXIT(STORVSC);
return ret;
}
+EXPORT_SYMBOL_GPL(StorVscOnDeviceRemove);
/* ***************
static void
@@ -692,8 +628,7 @@ Description:
Callback to initiate an I/O request
--*/
-static int
-StorVscOnIORequest(
+int StorVscOnIORequest(
struct hv_device *Device,
struct hv_storvsc_request *Request
)
@@ -786,6 +721,7 @@ StorVscOnIORequest(
DPRINT_EXIT(STORVSC);
return ret;
}
+EXPORT_SYMBOL_GPL(StorVscOnIORequest);
/*++
@@ -796,15 +732,14 @@ Description:
Perform any cleanup when the driver is removed
--*/
-static void
-StorVscOnCleanup(
+void StorVscOnCleanup(
struct hv_driver *Driver
)
{
DPRINT_ENTER(STORVSC);
DPRINT_EXIT(STORVSC);
}
-
+EXPORT_SYMBOL_GPL(StorVscOnCleanup);
static void
StorVscOnIOCompletion(
diff --git a/drivers/staging/hv/include/StorVscApi.h b/drivers/staging/hv/include/StorVscApi.h
index 5d72f29..6ea1d09 100644
--- a/drivers/staging/hv/include/StorVscApi.h
+++ b/drivers/staging/hv/include/StorVscApi.h
@@ -26,7 +26,7 @@
#define _STORVSC_API_H_
#include "VmbusApi.h"
-
+#include "vstorage.h"
/* Defines */
@@ -124,16 +124,55 @@ typedef struct _STORVSC_DEVICE_INFO {
unsigned char TargetId;
} STORVSC_DEVICE_INFO;
+struct hv_storvsc_request_ext {
+ /* LIST_ENTRY ListEntry; */
+
+ struct hv_storvsc_request *Request;
+ struct hv_device *Device;
+
+ /* Synchronize the request/response if needed */
+ struct osd_waitevent *WaitEvent;
+
+ struct hv_vstor_packet VStorPacket;
+};
+
+
+/* A storvsc device is a device object that contains a vmbus channel */
+struct hv_storvsc_device {
+ struct hv_device *Device;
+
+ atomic_t RefCount; /* 0 indicates the device is being destroyed */
+
+ atomic_t NumOutstandingRequests;
+
+ /*
+ * Each unique Port/Path/Target represents 1 channel ie scsi
+ * controller. In reality, the pathid, targetid is always 0
+ * and the port is set by us
+ */
+ unsigned int PortNumber;
+ unsigned char PathId;
+ unsigned char TargetId;
+
+ /* LIST_ENTRY OutstandingRequestList; */
+ /* HANDLE OutstandingRequestLock; */
+
+ /* Used for vsc/vsp channel reset process */
+ struct hv_storvsc_request_ext InitRequest;
+ struct hv_storvsc_request_ext ResetRequest;
+
+};
/* Interface */
-int
-StorVscInitialize(
- struct hv_driver *Driver
- );
+int StorVscInitialize(struct hv_driver *Driver);
+int BlkVscInitialize(struct hv_driver *Driver);
+int StorVscOnDeviceAdd(struct hv_device *Device,
+ void *AdditionalInfo);
+int StorVscOnDeviceRemove(struct hv_device *Device);
+int StorVscOnIORequest(struct hv_device *Device,
+ struct hv_storvsc_request *Request);
+void StorVscOnCleanup(struct hv_driver *Device);
+
-int
-BlkVscInitialize(
- struct hv_driver *Driver
- );
#endif /* _STORVSC_API_H_ */
--
1.6.2.5
More information about the devel
mailing list