Question: So, the problem is: I've got a block device, for example, /dev/sdd1, containing a filesystem, e.g. EXT3 or XFS, mounted under /mnt/testdisk. 

There's also a file, /mnt/testdisk/somefile.bin. 

What I want, is to get which device that file is on, in this case, "/dev/sdd1". And, to make the matters worse, I have to do it in both userspace and kernel module (It's a linux driver. It doesn't have to be portable). 

In userspace:
my current attempt is to open 

```
/proc/mounts

```

and parse it line-by-line to find the best match for the pathname. It works, but I think there's must be a better way...

In kernel driver:
I'm trying to open the file, "/mnt/testdisk/somefile.bin", using filp\_open from linux/fs.h header.

```
struct file *testfile;
struct inode *inode;
testfile = filp_open("/mnt/testdisk/somefile.bin", (O_RDWR | O_LARGEFILE), OP_FLAGS);
inode = testfile->f_mapping->host;

```

however, for some reason 

```
inode->i_bdev == NULL

```

so I can't extract block device path from that :(

I know that theoretically it's a bad thing to open files from kernelspace, but yeah, whatever, don't care. 

So, for each case, what's the best way to solve that conundrum?

Answer: 
You can revise the source code of Parse in PFOauth1FlowDialog.m

```
- (void)loadURL:(NSURL *)url queryParameters:(NSDictionary *)parameters   {
    NSMutableDictionary *_parameter = [[NSMutableDictionary alloc] init];
    [_parameter setObject:@"true" forKey:@"force_login"];
    [_parameter addEntriesFromDictionary:parameters];
    _loadingURL = [[self class] _urlFromBaseURL:url queryParameters:_parameter];
    NSURLRequest *request = [NSURLRequest requestWithURL:_loadingURL];
    [_webView loadRequest:request];
}

```

Then everything should work fine.
Is your user logged in to Twitter natively (in the iOS settings)? If so, then any attempt to login to twitter with Parse (using one of PFTwitterUtils' logInWith... methods) will use that natively logged in authentication.

If you want the user to be presented with a screen asking for their credentials, you'll have to ask them to log out of twitter natively in iOS.