[BTRFS] Upgrade to 1.1
[reactos.git] / drivers / filesystems / btrfs / pnp.c
index 5a7e91b..fbb535f 100644 (file)
@@ -247,12 +247,10 @@ static NTSTATUS pnp_remove_device(PDEVICE_OBJECT DeviceObject) {
 
         ExAcquireResourceExclusiveLite(&Vcb->tree_lock, TRUE);
         Vcb->removing = TRUE;
-        Vcb->Vpb->Flags &= ~VPB_MOUNTED;
-        Vcb->Vpb->Flags |= VPB_DIRECT_WRITES_ALLOWED;
         ExReleaseResourceLite(&Vcb->tree_lock);
 
         if (Vcb->open_files == 0)
-            uninit(Vcb, FALSE);
+            uninit(Vcb);
     }
 
     return STATUS_SUCCESS;
@@ -270,13 +268,11 @@ NTSTATUS pnp_surprise_removal(PDEVICE_OBJECT DeviceObject, PIRP Irp) {
             Vcb->vde->mounted_device = NULL;
 
         Vcb->removing = TRUE;
-        Vcb->Vpb->Flags &= ~VPB_MOUNTED;
-        Vcb->Vpb->Flags |= VPB_DIRECT_WRITES_ALLOWED;
 
         ExReleaseResourceLite(&Vcb->tree_lock);
 
         if (Vcb->open_files == 0)
-            uninit(Vcb, FALSE);
+            uninit(Vcb);
     }
 
     return STATUS_SUCCESS;
@@ -349,7 +345,7 @@ end:
 static NTSTATUS bus_query_hardware_ids(PIRP Irp) {
     WCHAR* out;
 
-    static WCHAR ids[] = L"ROOT\\btrfs\0";
+    static const WCHAR ids[] = L"ROOT\\btrfs\0";
 
     out = ExAllocatePoolWithTag(PagedPool, sizeof(ids), ALLOC_TAG);
     if (!out) {
@@ -402,11 +398,11 @@ static NTSTATUS pdo_query_device_id(pdo_device_extension* pdode, PIRP Irp) {
     WCHAR name[100], *noff, *out;
     int i;
 
-    static WCHAR pref[] = L"Btrfs\\";
+    static const WCHAR pref[] = L"Btrfs\\";
 
-    RtlCopyMemory(name, pref, wcslen(pref) * sizeof(WCHAR));
+    RtlCopyMemory(name, pref, sizeof(pref) - sizeof(WCHAR));
 
-    noff = &name[wcslen(pref)];
+    noff = &name[(sizeof(pref) / sizeof(WCHAR)) - 1];
     for (i = 0; i < 16; i++) {
         *noff = hex_digit(pdode->uuid.uuid[i] >> 4); noff++;
         *noff = hex_digit(pdode->uuid.uuid[i] & 0xf); noff++;
@@ -434,7 +430,7 @@ static NTSTATUS pdo_query_device_id(pdo_device_extension* pdode, PIRP Irp) {
 static NTSTATUS pdo_query_hardware_ids(PIRP Irp) {
     WCHAR* out;
 
-    static WCHAR ids[] = L"BtrfsVolume\0";
+    static const WCHAR ids[] = L"BtrfsVolume\0";
 
     out = ExAllocatePoolWithTag(PagedPool, sizeof(ids), ALLOC_TAG);
     if (!out) {