Skip to content

Instantly share code, notes, and snippets.

@naota
Created September 3, 2018 06:18
Show Gist options
  • Save naota/5b144de1e2396aab8e717a63c39561f8 to your computer and use it in GitHub Desktop.
Save naota/5b144de1e2396aab8e717a63c39561f8 to your computer and use it in GitHub Desktop.
int livepatch_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);
if (!error)
st->f_type = EXT4_SUPER_MAGIC;
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