Skip to content

Instantly share code, notes, and snippets.

@naota
Created September 3, 2018 06:12
Show Gist options
  • Save naota/261c74c6dfdf19f76bdc58e829d99ae5 to your computer and use it in GitHub Desktop.
Save naota/261c74c6dfdf19f76bdc58e829d99ae5 to your computer and use it in GitHub Desktop.
int user_statfs(const char __user *pathname, struct kstatfs *st)
{
struct path path;
int error;
unsigned int lookup_flags = LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT;
retry:
error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path);
if (!error) {
error = vfs_statfs(&path, st);
path_put(&path);
if (retry_estale(error, lookup_flags)) {
lookup_flags |= LOOKUP_REVAL;
goto retry;
}
}
return error;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment