/[hurd]/hurd-l4/libhurd-cap-server/cap-server-intern.h
ViewVC logotype

Diff of /hurd-l4/libhurd-cap-server/cap-server-intern.h

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

revision 1.9 by neal, Tue Nov 30 16:19:26 2004 UTC revision 1.10 by neal, Wed Dec 1 18:12:20 2004 UTC
# Line 34  Line 34 
34    
35  /* FIXME: For now.  */  /* FIXME: For now.  */
36  #define hurd_cond_wait pthread_cond_wait  #define hurd_cond_wait pthread_cond_wait
37    
38    /* Every capability hurd_cap_handle_t consists of two parts: The upper
39       part is a client ID and the lower part is a capability object ID.
40       The client ID is as long as the task ID (which is as long as the
41       version ID).  The cap ID occupies the remainder.  We intimately
42       know that even on 64 bit architectures, both fit into a 32 bit
43       integer value.  */
44    #define _HURD_CAP_CLIENT_ID_BITS        HURD_TASK_ID_BITS
45    #define _HURD_CAP_ID_BITS ((sizeof (hurd_cap_handle_t) * 8) \
46                               - HURD_TASK_ID_BITS)
47    
48    #define _HURD_CAP_CLIENT_ID_MASK \
49      ((L4_WORD_C(1) << _HURD_CAP_CLIENT_ID_BITS) - 1)
50    #define _HURD_CAP_ID_MASK ((L4_WORD_C(1) << _HURD_CAP_ID_BITS) - 1)
51    
52    typedef l4_uint32_t _hurd_cap_id_t;
53    typedef l4_uint32_t _hurd_cap_client_id_t;
54    
55    
56    /* Get the capability ID from a user capability.  The capabililty ID
57       is an index into the caps table of a client.  */
58    static inline _hurd_cap_client_id_t
59    __attribute__((always_inline))
60    _hurd_cap_client_id (hurd_cap_handle_t cap)
61    {
62      return cap >> _HURD_CAP_ID_BITS;
63    }
64    
65    
66    /* Get the capability ID from a user capability.  The capabililty ID
67       is an index into the caps table of a client.  */
68    static inline _hurd_cap_id_t
69    __attribute__((always_inline))
70    _hurd_cap_id (hurd_cap_handle_t cap)
71    {
72      return cap & _HURD_CAP_ID_MASK;
73    }
74    
75    
76    /* Create a new capability handle from the client and cap ID.  */
77    static inline hurd_cap_handle_t
78    __attribute__((always_inline))
79    _hurd_cap_handle_make (_hurd_cap_client_id_t client_id, _hurd_cap_id_t cap_id)
80    {
81      return ((client_id & _HURD_CAP_CLIENT_ID_MASK) << _HURD_CAP_ID_BITS)
82        | (cap_id & _HURD_CAP_ID_MASK);
83    }
84    
85    
86  /* This is a simple list item, used to maintain lists of pending RPC  /* This is a simple list item, used to maintain lists of pending RPC
# Line 134  struct _hurd_cap_obj_entry Line 181  struct _hurd_cap_obj_entry
181    hurd_cap_obj_t cap_obj;    hurd_cap_obj_t cap_obj;
182    
183    /* The index in the capability table.  */    /* The index in the capability table.  */
184    hurd_cap_id_t id;    _hurd_cap_id_t id;
185        
186    /* A list item that is used for reverse lookup from the capability    /* A list item that is used for reverse lookup from the capability
187       object to the client.  Protected by the lock of the capability       object to the client.  Protected by the lock of the capability
# Line 171  extern struct hurd_slab_space _hurd_cap_ Line 218  extern struct hurd_slab_space _hurd_cap_
218     Returns the capability ID (valid only for this user) in *R_ID, or     Returns the capability ID (valid only for this user) in *R_ID, or
219     an error.  OBJ must be locked.  */     an error.  OBJ must be locked.  */
220  error_t _hurd_cap_obj_copy_out (hurd_cap_obj_t obj, hurd_cap_bucket_t bucket,  error_t _hurd_cap_obj_copy_out (hurd_cap_obj_t obj, hurd_cap_bucket_t bucket,
221                                  _hurd_cap_client_t client, hurd_cap_id_t *r_id)                                  _hurd_cap_client_t client, _hurd_cap_id_t *r_id)
222       __attribute__((visibility("hidden")));       __attribute__((visibility("hidden")));
223    
224    
# Line 189  struct _hurd_cap_client Line 236  struct _hurd_cap_client
236       in the clients_reverse hash of the bucket, and still get the       in the clients_reverse hash of the bucket, and still get the
237       index number.  This allows us to use a location pointer for       index number.  This allows us to use a location pointer for
238       removal (locp) for fast hash removal.  */       removal (locp) for fast hash removal.  */
239    hurd_cap_client_id_t id;    _hurd_cap_client_id_t id;
240    
241    /* The location pointer for fast removal from the reverse lookup    /* The location pointer for fast removal from the reverse lookup
242       hash BUCKET->clients_reverse.  This is protected by the bucket       hash BUCKET->clients_reverse.  This is protected by the bucket
# Line 219  struct _hurd_cap_client Line 266  struct _hurd_cap_client
266       notification handler.  */       notification handler.  */
267    struct _hurd_cap_list_item *pending_rpcs;    struct _hurd_cap_list_item *pending_rpcs;
268    
269    /* The hurd_cap_id_t to _hurd_cap_obj_entry_t mapping.  */    /* The _hurd_cap_id_t to _hurd_cap_obj_entry_t mapping.  */
270    struct hurd_table caps;    struct hurd_table caps;
271    
272    /* Reverse lookup from hurd_cap_obj_t to _hurd_cap_obj_entry_t.  */    /* Reverse lookup from hurd_cap_obj_t to _hurd_cap_obj_entry_t.  */
# Line 250  void _hurd_cap_client_dealloc (hurd_cap_ Line 297  void _hurd_cap_client_dealloc (hurd_cap_
297  /* Release a reference for the client with the ID IDX in class  /* Release a reference for the client with the ID IDX in class
298     CLASS.  */     CLASS.  */
299  void _hurd_cap_client_release (hurd_cap_bucket_t bucket,  void _hurd_cap_client_release (hurd_cap_bucket_t bucket,
300                                 hurd_cap_client_id_t idx)                                 _hurd_cap_client_id_t idx)
301       __attribute__((visibility("hidden")));       __attribute__((visibility("hidden")));
302    
303    
# Line 458  _hurd_cap_client_cond_busy (_hurd_cap_cl Line 505  _hurd_cap_client_cond_busy (_hurd_cap_cl
505  }  }
506    
507    
508  /* Check if the inhibition state of the capability client CLIENT has  /* Check if the inhibited state of the capability client CLIENT has to
509     to be changed.  CLIENT must be locked.  */     be changed.  CLIENT must be locked.  */
510  static inline void  static inline void
511  __attribute__((always_inline))  __attribute__((always_inline))
512  _hurd_cap_client_cond_check (hurd_cap_bucket_t bucket,  _hurd_cap_client_cond_check (hurd_cap_bucket_t bucket,

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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