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 7624711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:02:10+00:00 2026-05-31T05:02:10+00:00

I am writing a stackable file system which would rename unlinked files to a

  • 0

I am writing a stackable file system which would rename unlinked files to a particular folder say abc by default. So as any file /xyz is unlinked its renamed to /abc/xyz. I want to do this by overriding the unlink function of stackable file system. I am using wrapfs so I am modifying wrapfs_unlink for this. I have dentry of the unlinked file also I have inode of parent directory , now I need to have inode of /abc and dentry of /abc/xyz to call vfs_rename instead of vfs_unlink. I could find the dentry and vfsmount for the / so I have a dentry for / but I don’t know how to get the dentry/inode of /abc I know I can get inode from dentry but I cannot get dentry also. I tried using lookup_one_len /abc is created but still it returns a negative inode , also I tried to use vfs_path_lookup to find the directory /abc it also returns an error. Am I using wrong functions? Or these methods see cache only not the actual directory structure ? Please help.

  • 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-05-31T05:02:12+00:00Added an answer on May 31, 2026 at 5:02 am

    You can use the following code to move an object into the trash at unlink.

    static int move_to_trash(struct dentry * trash, struct dentry * object)
    {
        int result;
        char name[32];
        struct dentry * de;
    
        sprintf(name, "XX-%lu", object->d_inode->i_ino);
    
        de = d_alloc_name(trash, name);
        if (!de)
            return -ENOMEM;
    
        trash->d_inode->i_op->lookup(trash->d_inode, de, NULL);
    
        mutex_lock(&trash->d_inode->i_mutex);
        result = trash->d_inode->i_op->link(object, trash->d_inode, de);
        mutex_unlock(&trash->d_inode->i_mutex);
    
        dput(de);
    
        return result;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing a file utility to strip out all non-ASCII characters from files. I have
I'm writing a firefox-extension and I've got this little json file: for (;;);{__ar:1,payload:{stackable:[true,false],title:{__html:How You
Writing a lexer of .java source files in Java. I have a stream of
Writing an app that will include the ability to decompress zip and rar files.
Writing a small command line tool, it would be nice to output in different
Writing an iPhone app in which I want to save the user the grief
Writing a program in which I need to split strings from a struct linked
writing in QT and QErrorMessage by default has checkbox saying: Show this message again
Writing to a file is not working after hosting the web application, whereas they
writing to a text file is working good...But my problem is text file is

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.