/[hurd]/hurd-l4/physmem/frame.c
ViewVC logotype

Diff of /hurd-l4/physmem/frame.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by neal, Wed Apr 6 14:07:29 2005 UTC revision 1.4 by neal, Wed Jun 22 10:18:09 2005 UTC
# Line 52  frame_dump (struct frame *frame) Line 52  frame_dump (struct frame *frame)
52  }  }
53    
54  static error_t  static error_t
55  frame_constructor (void *hook, void *buffer)  frame_constructor (void *hook, struct frame *frame)
56  {  {
   struct frame *frame = buffer;  
   
57    frame->refs = 1;    frame->refs = 1;
58    pthread_mutex_init (&frame->lock, 0);    pthread_mutex_init (&frame->lock, 0);
59    pthread_mutex_lock (&frame->lock);    pthread_mutex_lock (&frame->lock);
# Line 65  frame_constructor (void *hook, void *buf Line 63  frame_constructor (void *hook, void *buf
63    return 0;    return 0;
64  }  }
65    
66  static struct hurd_slab_space frame_space  SLAB_CLASS(frame, struct frame)
67    = HURD_SLAB_SPACE_INITIALIZER (struct frame,  
68                                   NULL, NULL,  static struct hurd_frame_slab_space frame_space;
69                                   frame_constructor, NULL,  
70                                   NULL);  void
71    frame_init (void)
72    {
73      hurd_frame_slab_init (&frame_space, NULL, NULL,
74                            frame_constructor, NULL, NULL);
75    }
76    
77  struct frame *  struct frame *
78  frame_alloc (size_t size)  frame_alloc (size_t size)
# Line 80  frame_alloc (size_t size) Line 83  frame_alloc (size_t size)
83    /* The size must be a power of 2.  */    /* The size must be a power of 2.  */
84    assert ((size & (size - 1)) == 0);    assert ((size & (size - 1)) == 0);
85    
86    err = hurd_slab_alloc (&frame_space, (void *) &frame);    err = hurd_frame_slab_alloc (&frame_space, &frame);
87    if (err)    if (err)
88      /* XXX: Free some memory and try again.  */      /* XXX: Free some memory and try again.  */
89      assert_perror (err);      assert_perror (err);
# Line 147  frame_deref (struct frame *frame) Line 150  frame_deref (struct frame *frame)
150        frame->memory = l4_fpage (0xDEAD000, 0);        frame->memory = l4_fpage (0xDEAD000, 0);
151  #endif  #endif
152    
153        hurd_slab_dealloc (&frame_space, frame);        hurd_frame_slab_dealloc (&frame_space, frame);
154      }      }
155    else    else
156      {      {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26