 fsg->thread_task = current;  /* Release all our userspace resources */ daemonize("file-storage-gadget"); 
static int fsg_main_thread(void *fsg_){	struct fsg_dev		*fsg = (struct fsg_dev *) fsg_;	fsg->thread_task = current;	/* Release all our userspace resources */	daemonize("file-storage-gadget");	/* Allow the thread to be killed by a signal, but set the signal mask	 * to block everything but INT, TERM, KILL, and USR1. */	siginitsetinv(&fsg->thread_signal_mask, sigmask(SIGINT) |			sigmask(SIGTERM) | sigmask(SIGKILL) |			sigmask(SIGUSR1));	sigprocmask(SIG_SETMASK, &fsg->thread_signal_mask, NULL);	/* Arrange for userspace references to be interpreted as kernel	 * pointers.  That way we can pass a kernel pointer to a routine	 * that expects a __user pointer and it will work okay. */	set_fs(get_ds());	/* Wait for the gadget registration to finish up */	wait_for_completion(&fsg->thread_notifier);	/* The main loop */	while (fsg->state != FSG_STATE_TERMINATED) {		if (exception_in_progress(fsg) || signal_pending(current)) {			handle_exception(fsg);			continue;		}		if (!fsg->running) {			sleep_thread(fsg);			continue;		}		if (get_next_command(fsg))			continue;		spin_lock_irq(&fsg->lock);		if (!exception_in_progress(fsg))			fsg->state = FSG_STATE_DATA_PHASE;		spin_unlock_irq(&fsg->lock);		if (do_scsi_command(fsg) || finish_reply(fsg))			continue;		spin_lock_irq(&fsg->lock);		if (!exception_in_progress(fsg))			fsg->state = FSG_STATE_STATUS_PHASE;		spin_unlock_irq(&fsg->lock);		if (send_status(fsg))			continue;		spin_lock_irq(&fsg->lock);		if (!exception_in_progress(fsg))			fsg->state = FSG_STATE_IDLE;		spin_unlock_irq(&fsg->lock);		}	fsg->thread_task = NULL;	flush_signals(current);	/* In case we are exiting because of a signal, unregister the	 * gadget driver and close the backing file. */	if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) {		usb_gadget_unregister_driver(&fsg_driver);		close_all_backing_files(fsg);	}	/* Let the unbind and cleanup routines know the thread has exited */	complete_and_exit(&fsg->thread_notifier, 0);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/22efcf4adec4262e0f49e6225f6cd070e4a85d20/file_storage.c/clean/drivers/usb/gadget/file_storage.c