devfs
[Top] [All Lists]

[PATCH]: devfs & DAC960

To: "Leonard N. Zubkoff" <lnz@xxxxxxxxxxxxx>, Richard Gooch <rgooch@xxxxxxxxxxxxx>
Subject: [PATCH]: devfs & DAC960
From: Martin Wilck <Martin.Wilck@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 31 May 2001 19:38:31 +0200 (CEST)
Cc: devfs mailing list <devfs@xxxxxxxxxxx>, Richard Gooch <rgooch@xxxxxxxxxxxxxxx>, Tom Duffy <tduffy@xxxxxxxxxxxx>, Martin Wilck <mwilck@xxxxxxxxxx>
In-reply-to: <Pine.LNX.4.33.0105291757050.300-200000@dbear.engr.sgi.com>
Sender: owner-devfs@xxxxxxxxxxx
Hello Leonard, Richard, all,

in response to my inquiry about the current conflicts between devfs
and the DAC960 driver, Richard told me he was too busy to
go into this problem. So I took some time myself and made a patch
that makes the DAC960 driver behave correctly with devfs. I got some
guidance by the patch against 2.2.16 Tom Duffy sent me (thanks Tom!),
but I basically rewrote the patch from scratch.

The patch is against kernel 2.4.4 with IA64, it works with plain 2.4.4.

I have made the patch a configurable option that appears below "/dev
filesystem support". I have taken much care to make the DAC960 driver
behave exactly the same as the original if this option is disabled.

I also wrote a devfsd patch that brings up the /dev/rd/cXdYpZ devices
again.

Since it is certainly not my business to decide what the final device
names should be, I have made these configurable through a set of macros
in DAC960.h. An anologous macro (DAC960_BASE_DIR_NAME) appears also
in the patch for devfsd.

Also, I decided to make /proc file names configurable independently of
the /dev file names, and in the current version of the patch left the
/proc file names as they used to be with the DAC960 driver (in order
not to break user space software that reads these /proc files).

I hope sincerely that this will be a solid base for you to get devfs
and the DAC960 driver in sync. Any suggestions and improvements are
of course greatly appreciated.

I am including the two patches in this e-mail. The devfsd patch (against
1.3.11) comes first.

Cheers,
Martin

-- 
Martin Wilck     <Martin.Wilck@xxxxxxxxxxxxxxxxxxx>
FSC EP PS DS1, Paderborn      Tel. +49 5251 8 15113

******************* devfsd patch **************************

diff -ur -x *.o -x devfsd devfsd/devfsd.c devfsd.mw/devfsd.c
--- devfsd/devfsd.c     Tue Feb  6 07:13:19 2001
+++ devfsd.mw/devfsd.c  Thu May 31 20:33:59 2001
@@ -203,6 +203,7 @@
 #include <karma.h>
 #include "devfsd.h"
 #include "version.h"
+#include <linux/major.h>

 #ifndef RTLD_DEFAULT  /*  Glibc 2.2 broke old code  */
 #  define RTLD_DEFAULT RTLD_NEXT
@@ -233,6 +234,8 @@
 #define AC_RMOLDCOMPAT              9
 #define AC_RMNEWCOMPAT              10

+#define DAC960_MINOR_SHIFT 3
+#define DAC960_BASE_DIR_NAME "dac960/"

 struct permissions_type
 {
@@ -1340,6 +1343,19 @@
                         host, bus, target, lun, ptr + 2);
            else compat_name = NULL;
        }
+        else if (strncmp  (info->devname, DAC960_BASE_DIR_NAME,
+                          strlen (DAC960_BASE_DIR_NAME)) == 0) {
+           int ctrl = info->major - DAC960_MAJOR;
+           int disk = info->minor >> DAC960_MINOR_SHIFT;
+           int part = info->minor & ((1 << DAC960_MINOR_SHIFT) - 1);
+           sprintf (dest_buf, "../%s", info->devname);
+           dest_name = dest_buf;
+           if (!part)
+               sprintf (compat_buf, "rd/c%dd%d", ctrl, disk);
+           else
+               sprintf (compat_buf, "rd/c%dd%dp%d", ctrl, disk, part);
+           compat_name = compat_buf;
+    };
        break;
     }
     if (compat_name == NULL) return;


********************** kernel patch ************************

--- linux-2.4.4-orig/fs/Config.in       Wed May 30 17:37:00 2001
+++ linux-2.4.4mw/fs/Config.in  Thu May 31 14:05:33 2001
@@ -49,6 +49,7 @@
 dep_bool '/dev file system support (EXPERIMENTAL)' CONFIG_DEVFS_FS 
$CONFIG_EXPERIMENTAL
 dep_bool '  Automatically mount at boot' CONFIG_DEVFS_MOUNT $CONFIG_DEVFS_FS
 dep_bool '  Debug devfs' CONFIG_DEVFS_DEBUG $CONFIG_DEVFS_FS
+dep_bool '  devfs support for Mylex DAC960/DAC1100 driver' CONFIG_DAC960_DEVFS 
$CONFIG_DEVFS_FS

 # It compiles as a module for testing only.  It should not be used
 # as a module in general.  If we make this "tristate", a bunch of people
--- linux-2.4.4-orig/Documentation/Configure.help       Wed May 30 20:31:31 2001
+++ linux-2.4.4mw/Documentation/Configure.help  Thu May 31 14:02:43 2001
@@ -11565,6 +11565,15 @@

   If unsure, say N.

+devfs support for Mylex DAC960/DAC1100 driver
+CONFIG_DAC960_DEVFS
+  This option will add devfs support to the Mylex DAC960/DAC1100
+  PCI RAID driver. If you use this driver in a system configured
+  to use devfs, say Y. Otherwise, say N.
+
+  The RAID devices on the Mylex controller(s) will then appear
+  under /dev/dac960/hostX/ for controller number X.
+
 NFS file system support
 CONFIG_NFS_FS
   If you are connected to some other (usually local) Unix computer
--- linux-2.4.4-orig/drivers/block/DAC960.c     Wed Feb 21 06:26:22 2001
+++ linux-2.4.4mw/drivers/block/DAC960.c        Thu May 31 19:48:20 2001
@@ -45,6 +45,13 @@
 #include <asm/uaccess.h>
 #include "DAC960.h"

+#ifdef CONFIG_DAC960_DEVFS
+/*
+  dac960_top_handle is the devfs handle for the top directory
+  with DAC960 entries (/dev/dac960)
+*/
+static devfs_handle_t dac960_top_handle = NULL;
+#endif

 /*
   DAC960_ControllerCount is the number of DAC960 Controllers detected.
@@ -85,7 +92,8 @@


 /*
-  DAC960_ProcDirectoryEntry is the DAC960 /proc/rd directory entry.
+  DAC960_ProcDirectoryEntry is the DAC960 /proc/[DAC960_PROC_DIR_NAME]
+  directory entry.
 */

 static PROC_DirectoryEntry_T
@@ -1613,7 +1621,8 @@
     {
       DAC960_V1_LogicalDriveInformation_T *LogicalDriveInformation =
        &Controller->V1.LogicalDriveInformation[LogicalDriveNumber];
-      DAC960_Info("    /dev/rd/c%dd%d: RAID-%d, %s, %d blocks, %s\n",
+      DAC960_Info("    /dev" DAC960_FORMAT
+                 ": RAID-%d, %s, %d blocks, %s\n",
                  Controller, Controller->ControllerNumber, LogicalDriveNumber,
                  LogicalDriveInformation->RAIDLevel,
                  (LogicalDriveInformation->LogicalDriveState
@@ -1746,7 +1755,8 @@
                       Controller, LogicalDeviceInfo->DriveGeometry);
          break;
        }
-      DAC960_Info("    /dev/rd/c%dd%d: RAID-%d, %s, %d blocks\n",
+      DAC960_Info("    /dev" DAC960_FORMAT
+                 ": RAID-%d, %s, %d blocks\n",
                  Controller, Controller->ControllerNumber, LogicalDriveNumber,
                  LogicalDeviceInfo->RAIDLevel,
                  (LogicalDeviceInfo->LogicalDeviceState
@@ -1884,6 +1894,13 @@
   GenericDiskInfo_T *GenericDiskInfo;
   RequestQueue_T *RequestQueue;
   int MinorNumber;
+
+#ifdef CONFIG_DAC960_DEVFS
+  char DevfsName[sizeof (DAC960_HOST_NAME) + 1];
+  char DiskName[sizeof (DAC960_DISK_NAME) + 2];
+  int i;
+#endif
+
   /*
     Register the Block Device Major Number for this DAC960 Controller.
   */
@@ -1894,6 +1911,34 @@
                   Controller, MajorNumber);
       return false;
     }
+
+#ifdef CONFIG_DAC960_DEVFS
+  Controller->TopDevfsHandle = NULL;
+  sprintf (DevfsName, DAC960_HOST_NAME "%d",
+          Controller->ControllerNumber);
+
+  if (!dac960_top_handle) {
+         dac960_top_handle =
+                 devfs_mk_dir (NULL, DAC960_BASE_DIR_NAME, NULL);
+         if (!dac960_top_handle) {
+                 DAC960_Error ("failed to create /dev" DAC960_BASE_DIR,
+                               Controller);
+                 return false;
+         };
+  };
+
+  Controller->TopDevfsHandle =
+         devfs_mk_dir (dac960_top_handle, DevfsName, NULL);
+
+  if (!Controller->TopDevfsHandle) {
+         DAC960_Error ("failed to create /dev"
+                       DAC960_BASE_DIR DAC960_HOST_FORMAT"\n",
+                       Controller,
+                       Controller->ControllerNumber);
+         return false;
+  };
+#endif /* CONFIG_DAC960_DEVFS */
+
   /*
     Initialize the I/O Request Queue.
   */
@@ -1933,6 +1978,29 @@
   Controller->GenericDiskInfo.nr_real = Controller->LogicalDriveCount;
   Controller->GenericDiskInfo.next = NULL;
   Controller->GenericDiskInfo.fops = &DAC960_BlockDeviceOperations;
+
+#ifdef CONFIG_DAC960_DEVFS
+  for (i = 0; i < DAC960_MaxLogicalDrives; i++) {
+         Controller->DevfsHandles[i] = NULL;
+         Controller->DevfsFlags[i] = DEVFS_FL_NONE;
+  };
+
+  /* Create devfs handles only for existing logical disks (??) */
+  for (i = 0; i < Controller->LogicalDriveCount; i++) {
+         sprintf (DiskName, DAC960_DISK_NAME "%d", i);
+         Controller->DevfsHandles[i] =
+                 devfs_mk_dir (Controller->TopDevfsHandle, DiskName, NULL);
+         if (!Controller->DevfsHandles[i]) {
+                 DAC960_Error ("cannot create /dev" DAC960_FORMAT "\n",
+                               Controller, Controller->ControllerNumber, i);
+                 return false;
+         };
+  };
+
+  Controller->GenericDiskInfo.de_arr = Controller->DevfsHandles;
+  Controller->GenericDiskInfo.flags = Controller->DevfsFlags;
+#endif
+
   /*
     Install the Generic Disk Information structure at the end of the list.
   */
@@ -1958,10 +2026,20 @@
 static void DAC960_UnregisterBlockDevice(DAC960_Controller_T *Controller)
 {
   int MajorNumber = DAC960_MAJOR + Controller->ControllerNumber;
+
   /*
     Unregister the Block Device Major Number for this DAC960 Controller.
   */
   devfs_unregister_blkdev(MajorNumber, "dac960");
+
+#ifdef CONFIG_DAC960_DEVFS
+  /*
+     Unregister the devfs handle for this controller.
+  */
+  if (Controller->TopDevfsHandle)
+         devfs_unregister (Controller->TopDevfsHandle);
+#endif
+
   /*
     Remove the I/O Request Queue.
   */
@@ -2879,12 +2957,14 @@
                   Controller, Command->V1.CommandStatus, CommandName);
       break;
     }
-  DAC960_Error("  /dev/rd/c%dd%d:   absolute blocks %d..%d\n",
+  DAC960_Error("  /dev" DAC960_FORMAT
+              ":   absolute blocks %d..%d\n",
               Controller, Controller->ControllerNumber,
               Command->LogicalDriveNumber, Command->BlockNumber,
               Command->BlockNumber + Command->BlockCount - 1);
   if (DAC960_PartitionNumber(Command->BufferHeader->b_rdev) > 0)
-    DAC960_Error("  /dev/rd/c%dd%dp%d: relative blocks %d..%d\n",
+    DAC960_Error("  /dev"  DAC960_FORMAT
+                ": relative blocks %d..%d\n",
                 Controller, Controller->ControllerNumber,
                 Command->LogicalDriveNumber,
                 DAC960_PartitionNumber(Command->BufferHeader->b_rdev),
@@ -3042,7 +3122,8 @@
            {
              int LogicalDriveNumber = Controller->LogicalDriveCount - 1;
              while (++LogicalDriveNumber < NewEnquiry->NumberOfLogicalDrives)
-               DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) "
+               DAC960_Critical("Logical Drive %d (/dev"
+                               DAC960_FORMAT ") "
                                "Now Exists\n", Controller,
                                LogicalDriveNumber,
                                Controller->ControllerNumber,
@@ -3052,7 +3133,8 @@
            {
              int LogicalDriveNumber = NewEnquiry->NumberOfLogicalDrives - 1;
              while (++LogicalDriveNumber < Controller->LogicalDriveCount)
-               DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) "
+               DAC960_Critical("Logical Drive %d (/dev"
+                               DAC960_FORMAT ") "
                                "No Longer Exists\n", Controller,
                                LogicalDriveNumber,
                                Controller->ControllerNumber,
@@ -3308,7 +3390,8 @@
                &Controller->V1.NewLogicalDriveInformation[LogicalDriveNumber];
              if (NewLogicalDriveInformation->LogicalDriveState !=
                  OldLogicalDriveInformation->LogicalDriveState)
-               DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) "
+               DAC960_Critical("Logical Drive %d (/dev"
+                               DAC960_FORMAT ") "
                                "is now %s\n", Controller,
                                LogicalDriveNumber,
                                Controller->ControllerNumber,
@@ -3321,7 +3404,8 @@
                                   ? "CRITICAL" : "OFFLINE"));
              if (NewLogicalDriveInformation->WriteBack !=
                  OldLogicalDriveInformation->WriteBack)
-               DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) "
+               DAC960_Critical("Logical Drive %d (/dev"
+                               DAC960_FORMAT ") "
                                "is now %s\n", Controller,
                                LogicalDriveNumber,
                                Controller->ControllerNumber,
@@ -3349,7 +3433,8 @@
            case DAC960_V1_NormalCompletion:
              Controller->EphemeralProgressMessage = true;
              DAC960_Progress("Rebuild in Progress: "
-                             "Logical Drive %d (/dev/rd/c%dd%d) "
+                             "Logical Drive %d (/dev"
+                             DAC960_FORMAT ") "
                              "%d%% completed\n",
                              Controller, LogicalDriveNumber,
                              Controller->ControllerNumber,
@@ -3406,7 +3491,8 @@
            {
              Controller->EphemeralProgressMessage = true;
              DAC960_Progress("Consistency Check in Progress: "
-                             "Logical Drive %d (/dev/rd/c%dd%d) "
+                             "Logical Drive %d (/dev"
+                             DAC960_FORMAT ") "
                              "%d%% completed\n",
                              Controller, LogicalDriveNumber,
                              Controller->ControllerNumber,
@@ -3662,12 +3748,14 @@
     }
   DAC960_Error("Error Condition %s on %s:\n", Controller,
               SenseErrors[Command->V2.RequestSense.SenseKey], CommandName);
-  DAC960_Error("  /dev/rd/c%dd%d:   absolute blocks %d..%d\n",
+  DAC960_Error("  /dev" DAC960_FORMAT
+              ":   absolute blocks %d..%d\n",
               Controller, Controller->ControllerNumber,
               Command->LogicalDriveNumber, Command->BlockNumber,
               Command->BlockNumber + Command->BlockCount - 1);
   if (DAC960_PartitionNumber(Command->BufferHeader->b_rdev) > 0)
-    DAC960_Error("  /dev/rd/c%dd%dp%d: relative blocks %d..%d\n",
+    DAC960_Error("  /dev" DAC960_FORMAT
+                ": relative blocks %d..%d\n",
                 Controller, Controller->ControllerNumber,
                 Command->LogicalDriveNumber,
                 DAC960_PartitionNumber(Command->BufferHeader->b_rdev),
@@ -3822,12 +3910,15 @@
                      Event->Channel, Event->TargetID, EventMessage);
       break;
     case 'L':
-      DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) %s\n", Controller,
+      DAC960_Critical("Logical Drive %d (/dev"
+                     DAC960_FORMAT ") %s\n", Controller,
                      Event->LogicalUnit, Controller->ControllerNumber,
                      Event->LogicalUnit, EventMessage);
       break;
     case 'M':
-      DAC960_Progress("Logical Drive %d (/dev/rd/c%dd%d) %s\n", Controller,
+      DAC960_Progress("Logical Drive %d (/dev"
+                     DAC960_FORMAT
+                     ") %s\n", Controller,
                      Event->LogicalUnit, Controller->ControllerNumber,
                      Event->LogicalUnit, EventMessage);
       break;
@@ -3892,7 +3983,8 @@
                                     unsigned long LogicalDeviceSize)
 {
   Controller->EphemeralProgressMessage = true;
-  DAC960_Progress("%s in Progress: Logical Drive %d (/dev/rd/c%dd%d) "
+  DAC960_Progress("%s in Progress: Logical Drive %d (/dev"
+                 DAC960_FORMAT ") "
                  "%d%% completed\n", Controller,
                  MessageString,
                  LogicalDeviceNumber,
@@ -4281,7 +4373,8 @@
                kmalloc(sizeof(DAC960_V2_LogicalDeviceInfo_T), GFP_ATOMIC);
              Controller->V2.LogicalDeviceInformation[LogicalDeviceNumber] =
                LogicalDeviceInfo;
-             DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) "
+             DAC960_Critical("Logical Drive %d (/dev"
+                             DAC960_FORMAT ") "
                              "Now Exists%s\n", Controller,
                              LogicalDeviceNumber,
                              Controller->ControllerNumber,
@@ -4298,7 +4391,8 @@
                NewLogicalDeviceInfo->ConfigurableDeviceSizeIn512ByteBlocksOrMB;
              if (NewLogicalDeviceInfo->LogicalDeviceState !=
                  LogicalDeviceInfo->LogicalDeviceState)
-               DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) "
+               DAC960_Critical("Logical Drive %d (/dev"
+                               DAC960_FORMAT ") "
                                "is now %s\n", Controller,
                                LogicalDeviceNumber,
                                Controller->ControllerNumber,
@@ -4315,7 +4409,8 @@
                   LogicalDeviceInfo->CommandsFailed) ||
                  (NewLogicalDeviceInfo->DeferredWriteErrors !=
                   LogicalDeviceInfo->DeferredWriteErrors))
-               DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) Errors: "
+               DAC960_Critical("Logical Drive %d (/dev"
+                               DAC960_FORMAT ") Errors: "
                                "Soft = %d, Failed = %d, Deferred Write = %d\n",
                                Controller, LogicalDeviceNumber,
                                Controller->ControllerNumber,
@@ -4367,7 +4462,8 @@
                                         LogicalDeviceSize);
              if (LogicalDeviceInfo->BackgroundInitializationInProgress &&
                  !NewLogicalDeviceInfo->BackgroundInitializationInProgress)
-               DAC960_Progress("Logical Drive %d (/dev/rd/c%dd%d) "
+               DAC960_Progress("Logical Drive %d (/dev"
+                               DAC960_FORMAT ") "
                                "Background Initialization %s\n",
                                Controller,
                                LogicalDeviceNumber,
@@ -4396,7 +4492,8 @@
                  Controller->V2.LogicalDriveFoundDuringScan
                                 [LogicalDriveNumber])
                continue;
-             DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) "
+             DAC960_Critical("Logical Drive %d (/dev"
+                             DAC960_FORMAT ") "
                              "No Longer Exists\n", Controller,
                              LogicalDriveNumber,
                              Controller->ControllerNumber,
@@ -6126,14 +6223,14 @@
        {
        case DAC960_V1_NormalCompletion:
          DAC960_UserCritical("Consistency Check of Logical Drive %d "
-                             "(/dev/rd/c%dd%d) Initiated\n",
+                             "(/dev" DAC960_FORMAT ") Initiated\n",
                              Controller, LogicalDriveNumber,
                              Controller->ControllerNumber,
                              LogicalDriveNumber);
          break;
        case DAC960_V1_DependentDiskIsDead:
          DAC960_UserCritical("Consistency Check of Logical Drive %d "
-                             "(/dev/rd/c%dd%d) Failed - "
+                             "(/dev" DAC960_FORMAT ") Failed - "
                              "Dependent Physical Device is DEAD\n",
                              Controller, LogicalDriveNumber,
                              Controller->ControllerNumber,
@@ -6141,7 +6238,7 @@
          break;
        case DAC960_V1_InvalidOrNonredundantLogicalDrive:
          DAC960_UserCritical("Consistency Check of Logical Drive %d "
-                             "(/dev/rd/c%dd%d) Failed - "
+                             "(/dev" DAC960_FORMAT ") Failed - "
                              "Invalid or Nonredundant Logical Drive\n",
                              Controller, LogicalDriveNumber,
                              Controller->ControllerNumber,
@@ -6149,7 +6246,7 @@
          break;
        case DAC960_V1_RebuildOrCheckAlreadyInProgress:
          DAC960_UserCritical("Consistency Check of Logical Drive %d "
-                             "(/dev/rd/c%dd%d) Failed - Rebuild or "
+                             "(/dev"  DAC960_FORMAT ") Failed - Rebuild or "
                              "Consistency Check Already in Progress\n",
                              Controller, LogicalDriveNumber,
                              Controller->ControllerNumber,
@@ -6157,7 +6254,7 @@
          break;
        default:
          DAC960_UserCritical("Consistency Check of Logical Drive %d "
-                             "(/dev/rd/c%dd%d) Failed - "
+                             "(/dev" DAC960_FORMAT ") Failed - "
                              "Unexpected Status %04X\n",
                              Controller, LogicalDriveNumber,
                              Controller->ControllerNumber,
@@ -6376,7 +6473,7 @@
       CommandMailbox->ConsistencyCheck.InitializedAreaOnly = false;
       DAC960_ExecuteCommand(Command);
       DAC960_UserCritical("Consistency Check of Logical Drive %d "
-                         "(/dev/rd/c%dd%d) %s\n",
+                         "(/dev" DAC960_FORMAT ") %s\n",
                          Controller, LogicalDriveNumber,
                          Controller->ControllerNumber,
                          LogicalDriveNumber,
@@ -6394,7 +6491,7 @@
        DAC960_V2_ConsistencyCheckStop;
       DAC960_ExecuteCommand(Command);
       DAC960_UserCritical("Consistency Check of Logical Drive %d "
-                         "(/dev/rd/c%dd%d) %s\n",
+                         "(/dev" DAC960_FORMAT ") %s\n",
                          Controller, LogicalDriveNumber,
                          Controller->ControllerNumber,
                          LogicalDriveNumber,
@@ -6414,7 +6511,7 @@


 /*
-  DAC960_ProcReadStatus implements reading /proc/rd/status.
+  DAC960_ProcReadStatus implements reading /proc/[DAC960_PROC_DIR_NAME]/status.
 */

 static int DAC960_ProcReadStatus(char *Page, char **Start, off_t Offset,
@@ -6448,7 +6545,8 @@


 /*
-  DAC960_ProcReadInitialStatus implements reading /proc/rd/cN/initial_status.
+  DAC960_ProcReadInitialStatus implements reading
+  /proc/[DAC960_PROC_DIR_NAME]/[DAC960_HOST_NAME]N/initial_status.
 */

 static int DAC960_ProcReadInitialStatus(char *Page, char **Start, off_t Offset,
@@ -6469,7 +6567,8 @@


 /*
-  DAC960_ProcReadCurrentStatus implements reading /proc/rd/cN/current_status.
+  DAC960_ProcReadCurrentStatus implements reading
+  /proc/[DAC960_PROC_DIR_NAME]/[DAC960_HOST_NAME]N/current_status.
 */

 static int DAC960_ProcReadCurrentStatus(char *Page, char **Start, off_t Offset,
@@ -6517,7 +6616,8 @@


 /*
-  DAC960_ProcReadUserCommand implements reading /proc/rd/cN/user_command.
+  DAC960_ProcReadUserCommand implements reading
+  /proc/[DAC960_PROC_DIR_NAME]/[DAC960_HOST_NAME]N/user_command.
 */

 static int DAC960_ProcReadUserCommand(char *Page, char **Start, off_t Offset,
@@ -6538,7 +6638,8 @@


 /*
-  DAC960_ProcWriteUserCommand implements writing /proc/rd/cN/user_command.
+  DAC960_ProcWriteUserCommand implements writing
+  /proc/[DAC960_PROC_DIR_NAME]/[DAC960_HOST_NAME]N/user_command.
 */

 static int DAC960_ProcWriteUserCommand(File_T *File, const char *Buffer,
@@ -6563,15 +6664,15 @@


 /*
-  DAC960_CreateProcEntries creates the /proc/rd/... entries for the
-  DAC960 Driver.
+  DAC960_CreateProcEntries creates the /proc/[DAC960_PROC_DIR_NAME]/...
+  entries for the DAC960 Driver.
 */

 static void DAC960_CreateProcEntries(void)
 {
   PROC_DirectoryEntry_T *StatusProcEntry;
   int ControllerNumber;
-  DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL);
+  DAC960_ProcDirectoryEntry = proc_mkdir(DAC960_PROC_DIR_NAME, NULL);
   StatusProcEntry = create_proc_read_entry("status", 0,
                                           DAC960_ProcDirectoryEntry,
                                           DAC960_ProcReadStatus, NULL);
@@ -6583,7 +6684,8 @@
       PROC_DirectoryEntry_T *ControllerProcEntry;
       PROC_DirectoryEntry_T *UserCommandProcEntry;
       if (Controller == NULL) continue;
-      sprintf(Controller->ControllerName, "c%d", Controller->ControllerNumber);
+      sprintf(Controller->ControllerName, DAC960_PROC_HOST_NAME "%d",
+             Controller->ControllerNumber);
       ControllerProcEntry = proc_mkdir(Controller->ControllerName,
                                       DAC960_ProcDirectoryEntry);
       create_proc_read_entry("initial_status", 0, ControllerProcEntry,
@@ -6619,8 +6721,8 @@
       remove_proc_entry("user_command", Controller->ControllerProcEntry);
       remove_proc_entry(Controller->ControllerName, DAC960_ProcDirectoryEntry);
     }
-  remove_proc_entry("rd/status", NULL);
-  remove_proc_entry("rd", NULL);
+  remove_proc_entry(DAC960_PROC_DIR_NAME "/status", NULL);
+  remove_proc_entry(DAC960_PROC_DIR_NAME, NULL);
 }


--- linux-2.4.4-orig/drivers/block/DAC960.h     Wed Feb 21 06:26:22 2001
+++ linux-2.4.4mw/drivers/block/DAC960.h        Thu May 31 20:42:39 2001
@@ -60,6 +60,33 @@
 #define DAC960_V1_MaxPhysicalDevices           45
 #define DAC960_V2_MaxPhysicalDevices           272

+/*
+  Names and format strings for /proc and /dev (with devfs) entries.
+ */
+#define DAC960_DRIVER_NAME "dac960"
+#ifdef CONFIG_DAC960_DEVFS
+#  define DAC960_BASE_DIR_NAME "dac960" /* base dir in /dev */
+#  define DAC960_PROC_DIR_NAME "rd"     /* base dir in /proc */
+#  define DAC960_MAJOR_NAME "rd"        /* major_name of gendisk */
+#  define DAC960_BASE_DIR "/" DAC960_BASE_DIR_NAME
+#  define DAC960_HOST_NAME "host"       /* base name of controller ID in /dev 
*/
+#  define DAC960_PROC_HOST_NAME "c"     /* the same in /proc */
+#  define DAC960_HOST_FORMAT "/" DAC960_HOST_NAME "%d"
+#  define DAC960_DISK_NAME "disc"       /* base name of disk ID in /dev */
+#  define DAC960_DISK_FORMAT "/" DAC960_DISK_NAME "%d"
+#else
+#  define DAC960_BASE_DIR_NAME "rd"
+#  define DAC960_PROC_DIR_NAME "rd"
+#  define DAC960_MAJOR_NAME "rd"
+#  define DAC960_BASE_DIR "/" DAC960_BASE_DIR_NAME
+#  define DAC960_HOST_NAME "c"
+#  define DAC960_PROC_HOST_NAME "c"
+#  define DAC960_HOST_FORMAT "/" DAC960_HOST_NAME "%d"
+#  define DAC960_DISK_NAME "d"
+#  define DAC960_DISK_FORMAT DAC960_DISK_NAME "%d"
+#endif
+#define DAC960_FORMAT \
+  DAC960_BASE_DIR DAC960_HOST_FORMAT DAC960_DISK_FORMAT

 /*
   Define a Boolean data type.
@@ -2268,7 +2295,7 @@
   DAC960_IO_Address_T IO_Address;
   DAC960_PCI_Address_T PCI_Address;
   unsigned char ControllerNumber;
-  unsigned char ControllerName[4];
+  unsigned char ControllerName[sizeof (DAC960_PROC_HOST_NAME) + 2];
   unsigned char ModelName[20];
   unsigned char FullModelName[28];
   unsigned char FirmwareVersion[12];
@@ -2415,6 +2442,11 @@
   int PartitionSizes[DAC960_MinorCount];
   int BlockSizes[DAC960_MinorCount];
   int MaxSectorsPerRequest[DAC960_MinorCount];
+#ifdef CONFIG_DAC960_DEVFS
+  devfs_handle_t TopDevfsHandle;
+  devfs_handle_t DevfsHandles[DAC960_MaxLogicalDrives];
+  char DevfsFlags[DAC960_MaxLogicalDrives];
+#endif
   unsigned char ProgressBuffer[DAC960_ProgressBufferSize];
   unsigned char UserStatusBuffer[DAC960_UserMessageSize];
 }



<Prev in Thread] Current Thread [Next in Thread>