Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7716097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:33:04+00:00 2026-06-01T02:33:04+00:00

I have noticed that when I call lseek64 on my block device driver file

  • 0

I have noticed that when I call lseek64 on my block device driver file (/dev/mybd), it always fails. (I can open, read and write on /dev/mybd ok).

However, if I can lseek64 with the same argument on /dev/sdb, which is an sata disk, it always succeed.

Does lseek requires any block device support? Or is it a pure kernel function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:33:06+00:00Added an answer on June 1, 2026 at 2:33 am

    Looking at the code, the default seek for block devices is in fs/block_dev.c:

    static loff_t block_llseek(struct file *file, loff_t offset, int origin)
    {
            struct inode *bd_inode = file->f_mapping->host;
            loff_t size;
            loff_t retval;
    
            mutex_lock(&bd_inode->i_mutex);
            size = i_size_read(bd_inode);
    
            retval = -EINVAL;
            switch (origin) {
                    case SEEK_END:
                            offset += size;
                            break;
                    case SEEK_CUR:
                            offset += file->f_pos;
                    case SEEK_SET:
                            break;
                    default:
                            goto out;
            }
            if (offset >= 0 && offset <= size) {
                    if (offset != file->f_pos) {
                            file->f_pos = offset;
                    }
                    retval = offset;
            }
    out:
            mutex_unlock(&bd_inode->i_mutex);
            return retval;
    }
    

    No call to the specific block device. The only particular call is to i_size_read, that just does some SMP magic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have noticed that regardless of a given script's execution time, every date() call
I have just noticed that my ViewController does not call init (See below) when
I have noticed that I can use memory blocks for matrices either allocated using
I have noticed that, from Google Maps page, you can get an embed link
I have noticed that when I do a call to modifyAttributes via SpringLDAP, the
I have just noticed that when i call the following code from a console
I have noticed that when I call the /install flag on NServiceBus.host.exe an event
I have noticed that cURL in PHP returns different data when told to output
I have noticed that some apps like Safari and Mail show a loading indicator
I have noticed that my particular instance of Trac is not running quickly and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.