Hi, i've made this little patch against drivers/char/drm/proc.c to
enable dual head in /proc/dri. I'm quite sure
that it's not SMP safe, so if anybody could give a look. Anyway it
worked for me.

*** proc.c.orig Mon Oct 16 00:45:53 2000
--- proc.c      Mon Oct 16 03:42:30 2000
***************
*** 73,83 ****
--- 73,120 ----
  };
  #define DRM_PROC_ENTRIES
(sizeof(drm_proc_list)/sizeof(drm_proc_list[0]))

+ int proc_match2(int len, const char *name,struct proc_dir_entry * de)
+ {
+       if (!de || !de->low_ino)
+               return 0;
+       if (de->namelen != len)
+               return 0;
+       return !memcmp(name, de->name, len);
+ }
+ static struct proc_dir_entry *exists_proc_dir( char *name )
+ {
+       const char              *cp = name, *next;
+       struct proc_dir_entry   *de;
+       int                     len;
+
+       de = &proc_root;
+       while (1) {
+               next = strchr(cp, '/');
+               if (!next)
+                       break;
+
+               len = next - cp;
+               for (de = de->subdir; de ; de = de->next) {
+                       if (proc_match2(len, cp, de)) break;
+               }
+               if (!de)
+                       return NULL;
+               cp += len + 1;
+       }
+       len = strlen(cp);
+         for (de = de->subdir; de ; de = de->next) {
+           if (proc_match2(len, cp, de)) return de;
+       }
+       return NULL;
+ }
+
  int drm_proc_init(drm_device_t *dev)
  {
        struct proc_dir_entry *ent;
        int                   i, j;

+       drm_root = exists_proc_dir("dri");
+       if( !drm_root )
        drm_root = create_proc_entry("dri", S_IFDIR, NULL);
        if (!drm_root) {
                DRM_ERROR("Cannot create /proc/dri\n");
***************
*** 88,94 ****
--- 125,134 ----
                                   add some global support for
/proc/dri. */
        for (i = 0; i < 8; i++) {
                sprintf(drm_slot_name, "dri/%d", i);
+               drm_dev_root = exists_proc_dir(drm_slot_name);
+               if(drm_dev_root) continue;
                drm_dev_root = create_proc_entry(drm_slot_name, S_IFDIR,
NULL);
+
                if (!drm_dev_root) {
                        DRM_ERROR("Cannot create /proc/%s\n",
drm_slot_name);
                        remove_proc_entry("dri", NULL);


--
%--IRIN->-Institut-de-Recherche-en-Informatique-de-Nantes-----------------%
% FORT David,                                                             %
% 7 avenue de la morvandière                                   0240726275 %
% 44470 Thouare, France                                [EMAIL PROTECTED] %
% ICU:78064991   AIM: enlighted popo             [EMAIL PROTECTED] %
%--LINUX-HTTPD-PIOGENE----------------------------------------------------%
%  -datamining <-/                        |   .~.                         %
%  -networking/flashed PHP3 coming soon   |   /V\        L  I  N  U  X    %
%  -opensource                            |  // \\     >Fear the Penguin< %
%  -GNOME/enlightenment/GIMP              | /(   )\                       %
%           feel enlighted....            |  ^^-^^                        %
%                           http://ibonneace.dnsalias.org/ when connected %
%-------------------------------------------------------------------------%



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to