Changeset d0dd7b5 in mainline for uspace/lib/c/generic/loc.c


Ignore:
Timestamp:
2011-08-18T20:10:47Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ef7052ec
Parents:
763e0cd
Message:

Work on device removal:

  • properly track service memberships in categories
  • implement loc_service_unregister()
  • ddf_fun_unbind() (limited to exposed functions for now)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/loc.c

    r763e0cd rd0dd7b5  
    267267}
    268268
    269 /** Register new device.
    270  *
    271  * The @p interface is used when forwarding connection to the driver.
     269/** Register new service.
     270 *
     271 * The @p interface is used when forwarding connection to the server.
    272272 * If not 0, the first argument is the interface and the second argument
    273273 * is the service ID.
     
    276276 * the handle (to ensure backward compatibility).
    277277 *
    278  * @param      fqdn      Fully qualified device name.
    279  * @param[out] handle    Handle to the created instance of device.
    280  * @param      interface Interface when forwarding.
    281  *
    282  */
    283 int loc_service_register_with_iface(const char *fqdn,
    284     service_id_t *handle, sysarg_t interface)
     278 * @param      fqsn      Fully qualified service name
     279 * @param[out] sid       Service ID of new service
     280 * @param      interface Interface when forwarding
     281 *
     282 */
     283int loc_service_register_with_iface(const char *fqsn,
     284    service_id_t *sid, sysarg_t interface)
    285285{
    286286        async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER);
     
    289289        aid_t req = async_send_2(exch, LOC_SERVICE_REGISTER, interface, 0,
    290290            &answer);
    291         sysarg_t retval = async_data_write_start(exch, fqdn, str_size(fqdn));
     291        sysarg_t retval = async_data_write_start(exch, fqsn, str_size(fqsn));
    292292       
    293293        loc_exchange_end(exch);
     
    301301       
    302302        if (retval != EOK) {
    303                 if (handle != NULL)
    304                         *handle = -1;
    305                
    306                 return retval;
    307         }
    308        
    309         if (handle != NULL)
    310                 *handle = (service_id_t) IPC_GET_ARG1(answer);
     303                if (sid != NULL)
     304                        *sid = -1;
     305               
     306                return retval;
     307        }
     308       
     309        if (sid != NULL)
     310                *sid = (service_id_t) IPC_GET_ARG1(answer);
    311311       
    312312        return retval;
    313313}
    314314
    315 /** Register new device.
    316  *
    317  * @param fqdn   Fully qualified device name.
    318  * @param handle Output: Handle to the created instance of device.
    319  *
    320  */
    321 int loc_service_register(const char *fqdn, service_id_t *handle)
    322 {
    323         return loc_service_register_with_iface(fqdn, handle, 0);
     315/** Register new service.
     316 *
     317 * @param fqsn  Fully qualified service name
     318 * @param sid   Output: ID of new service
     319 *
     320 */
     321int loc_service_register(const char *fqdn, service_id_t *sid)
     322{
     323        return loc_service_register_with_iface(fqdn, sid, 0);
     324}
     325
     326/** Unregister service.
     327 *
     328 * @param sid   Service ID
     329 */
     330int loc_service_unregister(service_id_t sid)
     331{
     332        async_exch_t *exch;
     333        sysarg_t retval;
     334       
     335        exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER);
     336        retval = async_req_1_0(exch, LOC_SERVICE_UNREGISTER, sid);
     337        loc_exchange_end(exch);
     338       
     339        return (int)retval;
    324340}
    325341
Note: See TracChangeset for help on using the changeset viewer.