Changeset e160bfe8 in mainline for uspace


Ignore:
Timestamp:
2017-10-23T18:51:34Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
327f147
Parents:
31cca4f3 (diff), 367db39a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mainline (again) to fix build

Perhaps it wasn't so good idea to start merging mainline in these unstable times :)

Location:
uspace
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    r31cca4f3 re160bfe8  
    100100endif
    101101
    102 DEPEND = Makefile.depend
    103 DEPEND_PREV = $(DEPEND).prev
    104 
    105102LIB_PREFIX = $(USPACE_PREFIX)/lib
    106103
     
    223220endif
    224221
    225 .PHONY: all clean
     222.PHONY: all clean depend
    226223
    227224all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT)
    228         -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
    229225
    230226all-test: $(TEST_OUTPUT) $(TEST_DISASM)
    231227
    232228clean:
    233         rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(LARCHIVE) $(LOUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
     229        rm -f $(JOB) $(OUTPUT) $(LARCHIVE) $(LOUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
    234230        find . -name '*.o' -follow -exec rm \{\} \;
    235231        find . -name '*.lo' -follow -exec rm \{\} \;
     232        find . -name '*.d' -follow -exec rm \{\} \;
    236233
    237234COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
     
    276273JOBFILE = $(LIBC_PREFIX)/../../../tools/jobfile.py
    277274
    278 ifeq ($(COMPILER),gcc_cross)
    279         CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
    280         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    281 endif
    282 
    283 ifeq ($(COMPILER),gcc_helenos)
    284         CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
    285         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    286 endif
    287 
    288 ifeq ($(COMPILER),gcc_native)
    289         CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
    290         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    291 endif
    292 
    293275ifeq ($(COMPILER),clang)
    294276        CFLAGS += $(COMMON_CFLAGS) $(CLANG_CFLAGS)
    295         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     277else
     278        CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
    296279endif
    297280
    298281LIB_CFLAGS = $(CFLAGS) -fPIC
    299282LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive
    300 
    301 ifneq ($(MAKECMDGOALS),clean)
    302 -include $(DEPEND)
    303 endif
    304283
    305284AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
     
    309288LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES)))
    310289TEST_OBJECTS := $(addsuffix .test.o,$(basename $(TEST_SOURCES)))
     290DEPENDS := $(addsuffix .d,$(basename $(SOURCES))) $(addsuffix .test.d,$(basename $(TEST_SOURCES)))
     291
     292-include $(DEPENDS)
    311293
    312294ifneq ($(BINARY),)
     
    367349endif
    368350
    369 %.o: %.S $(DEPEND)
    370         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     351%.o: %.S | depend
     352        $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    371353ifeq ($(PRECHECK),y)
    372354        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -D__ASM__
    373355endif
    374356
    375 %.o: %.s $(DEPEND)
    376         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     357%.o: %.s | depend
     358        $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    377359ifeq ($(PRECHECK),y)
    378360        $(JOBFILE) $(JOB) $< $@ as asm
    379361endif
    380362
    381 %.o: %.c $(DEPEND)
    382         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
     363%.o: %.c | depend
     364        $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
    383365ifeq ($(PRECHECK),y)
    384366        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS)
    385367endif
    386368
    387 %.test.o: %.c $(DEPEND)
    388         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) -c $< -o $@
     369%.test.o: %.c | depend
     370        $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) -c $< -o $@
    389371ifeq ($(PRECHECK),y)
    390372        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS)
    391373endif
    392374
    393 %.lo: %.S $(DEPEND)
    394         $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     375%.lo: %.S | depend
     376        $(CC) -MD $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    395377ifeq ($(PRECHECK),y)
    396378        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__
    397379endif
    398380
    399 %.lo: %.s $(DEPEND)
    400         $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     381%.lo: %.s | depend
     382        $(CC) -MD $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    401383ifeq ($(PRECHECK),y)
    402384        $(JOBFILE) $(JOB) $< $@ as asm
    403385endif
    404386
    405 %.lo: %.c $(DEPEND)
    406         $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
     387%.lo: %.c | depend
     388        $(CC) -MD $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
    407389ifeq ($(PRECHECK),y)
    408390        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS)
    409391endif
    410392
    411 $(DEPEND): $(PRE_DEPEND)
    412         makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
    413         makedepend -f - -o.test.o -- $(DEPEND_DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) -- $(TEST_SOURCES) >> $@ 2> /dev/null
    414         -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
     393depend: $(PRE_DEPEND)
    415394
    416395##
  • uspace/app/devctl/devctl.c

    r31cca4f3 re160bfe8  
    337337}
    338338
     339static int drv_unload(const char *drvname)
     340{
     341        int rc;
     342        devman_handle_t drvh;
     343
     344        rc = devman_driver_get_handle(drvname, &drvh);
     345        if (rc != EOK) {
     346                printf("Failed resolving driver '%s' (%d).\n", drvname, rc);
     347                return rc;
     348        }
     349
     350        rc = devman_driver_unload(drvh);
     351        if (rc != EOK) {
     352                printf("Failed unloading driver '%s' (%d).\n", drvname, rc);
     353                return rc;
     354        }
     355
     356        return EOK;
     357}
     358
    339359static void print_syntax(void)
    340360{
     
    346366        printf("\tdevctl show-drv <driver-name>\n");
    347367        printf("\tdevctl load-drv <driver-name>\n");
     368        printf("\tdevctl unload-drv <driver-name>\n");
    348369}
    349370
     
    412433                if (rc != EOK)
    413434                        return 2;
     435        } else if (str_cmp(argv[1], "unload-drv") == 0) {
     436                if (argc < 3) {
     437                        printf(NAME ": Argument missing.\n");
     438                        print_syntax();
     439                        return 1;
     440                }
     441
     442                rc = drv_unload(argv[2]);
     443                if (rc != EOK)
     444                        return 2;
    414445        } else {
    415446                printf(NAME ": Invalid argument '%s'.\n", argv[1]);
  • uspace/lib/c/generic/devman.c

    r31cca4f3 re160bfe8  
    719719}
    720720
     721int devman_driver_unload(devman_handle_t drvh)
     722{
     723        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
     724        if (exch == NULL)
     725                return ENOMEM;
     726       
     727        int rc = async_req_1_0(exch, DEVMAN_DRIVER_UNLOAD, drvh);
     728       
     729        devman_exchange_end(exch);
     730        return rc;
     731}
     732
    721733/** @}
    722734 */
  • uspace/lib/c/include/devman.h

    r31cca4f3 re160bfe8  
    8282extern int devman_driver_get_state(devman_handle_t, driver_state_t *);
    8383extern int devman_driver_load(devman_handle_t);
     84extern int devman_driver_unload(devman_handle_t);
    8485
    8586#endif
  • uspace/lib/c/include/ipc/devman.h

    r31cca4f3 re160bfe8  
    156156        DRIVER_FUN_ONLINE,
    157157        DRIVER_FUN_OFFLINE,
     158        DRIVER_STOP
    158159} devman_to_driver_t;
    159160
     
    176177        DEVMAN_DRIVER_GET_NAME,
    177178        DEVMAN_DRIVER_GET_STATE,
    178         DEVMAN_DRIVER_LOAD
     179        DEVMAN_DRIVER_LOAD,
     180        DEVMAN_DRIVER_UNLOAD
    179181} client_to_devman_t;
    180182
  • uspace/lib/drv/generic/driver.c

    r31cca4f3 re160bfe8  
    6868FIBRIL_MUTEX_INITIALIZE(functions_mutex);
    6969
     70FIBRIL_RWLOCK_INITIALIZE(stopping_lock);
     71static bool stopping = false;
     72
    7073static ddf_dev_t *create_device(void);
    7174static void delete_device(ddf_dev_t *);
     
    127130        }
    128131       
     132        fibril_rwlock_read_lock(&stopping_lock);
     133
     134        if (stopping) {
     135                fibril_rwlock_read_unlock(&stopping_lock);
     136                async_answer_0(iid, EIO);
     137                return;
     138        }
     139       
    129140        ddf_dev_t *dev = create_device();
    130141        if (!dev) {
     142                fibril_rwlock_read_unlock(&stopping_lock);
    131143                free(dev_name);
    132144                async_answer_0(iid, ENOMEM);
     
    148160       
    149161        if (res != EOK) {
     162                fibril_rwlock_read_unlock(&stopping_lock);
    150163                dev_del_ref(dev);
    151164                async_answer_0(iid, res);
     
    156169        list_append(&dev->link, &devices);
    157170        fibril_mutex_unlock(&devices_mutex);
     171        fibril_rwlock_read_unlock(&stopping_lock);
    158172       
    159173        async_answer_0(iid, res);
     
    282296       
    283297        async_answer_0(iid, (sysarg_t) rc);
     298}
     299
     300static void driver_stop(ipc_callid_t iid, ipc_call_t *icall)
     301{
     302        /* Prevent new devices from being added */
     303        fibril_rwlock_write_lock(&stopping_lock);
     304        stopping = true;
     305
     306        /* Check if there are any devices */
     307        fibril_mutex_lock(&devices_mutex);
     308        if (list_first(&devices) != NULL) {
     309                /* Devices exist, roll back */
     310                fibril_mutex_unlock(&devices_mutex);
     311                stopping = false;
     312                fibril_rwlock_write_unlock(&stopping_lock);
     313                async_answer_0(iid, EBUSY);
     314                return;
     315        }
     316
     317        fibril_rwlock_write_unlock(&stopping_lock);
     318
     319        /* There should be no functions at this point */
     320        fibril_mutex_lock(&functions_mutex);
     321        assert(list_first(&functions) == NULL);
     322        fibril_mutex_unlock(&functions_mutex);
     323
     324        /* Reply with success and terminate */
     325        async_answer_0(iid, EOK);
     326        exit(0);
    284327}
    285328
     
    312355                case DRIVER_FUN_OFFLINE:
    313356                        driver_fun_offline(callid, &call);
     357                        break;
     358                case DRIVER_STOP:
     359                        driver_stop(callid, &call);
    314360                        break;
    315361                default:
  • uspace/srv/devman/client_conn.c

    r31cca4f3 re160bfe8  
    726726}
    727727
     728/** Unload a driver by user request. */
     729static void devman_driver_unload(ipc_callid_t iid, ipc_call_t *icall)
     730{
     731        driver_t *drv;
     732        int rc;
     733       
     734        drv = driver_find(&drivers_list, IPC_GET_ARG1(*icall));
     735        if (drv == NULL) {
     736                async_answer_0(iid, ENOENT);
     737                return;
     738        }
     739       
     740        fibril_mutex_lock(&drv->driver_mutex);
     741        rc = stop_driver(drv);
     742        fibril_mutex_unlock(&drv->driver_mutex);
     743
     744        async_answer_0(iid, rc);
     745}
     746
    728747/** Function for handling connections from a client to the device manager. */
    729748void devman_connection_client(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     
    794813                        devman_driver_load(callid, &call);
    795814                        break;
     815                case DEVMAN_DRIVER_UNLOAD:
     816                        devman_driver_unload(callid, &call);
     817                        break;
    796818                default:
    797819                        async_answer_0(callid, ENOENT);
  • uspace/srv/devman/driver.c

    r31cca4f3 re160bfe8  
    298298        drv->state = DRIVER_STARTING;
    299299        return true;
     300}
     301
     302/** Stop a driver
     303 *
     304 * @param drv           The driver's structure.
     305 * @return              True if the driver's task is successfully spawned, false
     306 *                      otherwise.
     307 */
     308int stop_driver(driver_t *drv)
     309{
     310        async_exch_t *exch;
     311        sysarg_t retval;
     312       
     313        log_msg(LOG_DEFAULT, LVL_DEBUG, "stop_driver(drv=\"%s\")", drv->name);
     314
     315        exch = async_exchange_begin(drv->sess);
     316        retval = async_req_0_0(exch, DRIVER_STOP);
     317        loc_exchange_end(exch);
     318       
     319        if (retval != EOK)
     320                return retval;
     321       
     322        drv->state = DRIVER_NOT_STARTED;
     323        async_hangup(drv->sess);
     324        drv->sess = NULL;
     325        return EOK;
    300326}
    301327
  • uspace/srv/devman/driver.h

    r31cca4f3 re160bfe8  
    5050extern void detach_driver(dev_tree_t *, dev_node_t *);
    5151extern bool start_driver(driver_t *);
     52extern int stop_driver(driver_t *);
    5253extern void add_device(driver_t *, dev_node_t *, dev_tree_t *);
    5354extern int driver_dev_remove(dev_tree_t *, dev_node_t *);
Note: See TracChangeset for help on using the changeset viewer.