Re: [PATCH] [ConfigFS]: Allow symbolic links from a SysFS struct kobject source.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Joel Becker
Date: Friday, October 17, 2008 - 12:48 pm

On Fri, Oct 17, 2008 at 01:22:18AM -0700, Nicholas A. Bellinger wrote:

	Pass an open file descriptor.  In bash(1):

    exec 3<>/dev/dm-7
    echo 3 >$TARGET/iblock_0/lvm_test0/control  # I'd call it 'fd'

In kernel, in the ->store() function of 'control':

	p = (char *)page;
	fd = simple_strtol(p, &p, 0);
	filp = fget(fd);
	inode = igrab(filp->f_mapping->host);
	dev = I_BDEV(filp->f_mapping->host);
	blkdev_get(dev, FMODE_WRITE | FMODE_READ, 0);

Error handling is left up to you (validate the strtol, fd range, ISBLK,
etc).  This assumes you want the struct block_device and want to pin it
in memory.  I assume you do.

Joel

-- 

Life's Little Instruction Book #450

	"Don't be afraid to say, 'I need help.'"

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] [ConfigFS]: Allow symbolic links from a SysFS stru ..., Nicholas A. Bellinger, (Thu Oct 16, 11:55 pm)
Re: [PATCH] [ConfigFS]: Allow symbolic links from a SysFS ..., Nicholas A. Bellinger, (Fri Oct 17, 1:22 am)
Re: [PATCH] [ConfigFS]: Allow symbolic links from a SysFS ..., Nicholas A. Bellinger, (Fri Oct 17, 12:02 pm)
Re: [PATCH] [ConfigFS]: Allow symbolic links from a SysFS ..., Nicholas A. Bellinger, (Fri Oct 17, 12:19 pm)
Re: [PATCH] [ConfigFS]: Allow symbolic links from a SysFS ..., Joel Becker, (Fri Oct 17, 12:48 pm)
Re: [PATCH] [ConfigFS]: Allow symbolic links from a SysFS ..., Nicholas A. Bellinger, (Fri Oct 17, 12:50 pm)
Re: [PATCH] [ConfigFS]: Allow symbolic links from a SysFS ..., Nicholas A. Bellinger, (Fri Oct 17, 1:03 pm)
Re: [PATCH] [ConfigFS]: Allow symbolic links from a SysFS ..., Nicholas A. Bellinger, (Fri Oct 17, 1:07 pm)
Re: [PATCH] [ConfigFS]: Allow symbolic links from a SysFS ..., Nicholas A. Bellinger, (Fri Oct 17, 7:41 pm)