Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

Folder Redirect and Filtering

IP.com Disclosure Number: IPCOM000199927D
Publication Date: 2010-Sep-21
Document File: 5 page(s) / 106K

Publishing Venue

The IP.com Prior Art Database

Abstract

With the solution that we are providing, user can maintain and organize his Folders and Files In a structural order with minimal overhead. The type of redirection of Folders can also be prioritized.

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 56% of the total text.

Page 1 of 5

Folder Redirect and Filtering

Algorithm for the proposed solution:

Commands like cp and install, opens the source and destination file using the open system call. The data from the source is copied to the destination by repeatedly calling the read followed by write, system calls. This process involves copying the data in the file from kernel memory space to the user memory space and back again.

Now the copying is done by the kernel upon calling read or writes but on some operating

systems, this has moved entirely in to the kernel replacing the copy operation with an equal system call.

In case of File-transfer through a socket, read and write to a socket is made or sendfile() system-call is used

Note

   : The sendfile system call is a relatively recent addition to the Linux kernel that offers significant performance benefits to applications such as ftp and web servers that need to efficiently transfer files
From the above, we have an inference that copying is performed via system-call.

Our Algorithm:


We write a Wrapper to the System calls which will own the responsibility to copy. The

procedure for creating a wrapper varies from OS to OS. Following is an example for creating a

wrapper for write system call, on Linux:

Before a write happens to a folder, the kernel checks for user permission for read and write to that particular folder. If there is write permission then we have to see if the Redirect Flag is set?

If the redirect flag is set, then enable the wrapper that is written to override the path settings in the redirect window

How we do it:

There is a system data structure called struct stat ; which is used to maintain the re-direct information/settings as provided by the user.
and

Along with this, we also maintain a separate data structure separately that gives the permission's through the second operation getOriginalPath(fd).

Code snippet:
Lets create a File IBM.cpp

#include

#include

#include

#include

1

Page 2 of 5

#include

#include

#include

#include

#define size 1024

ssize

_

t write(int fd, const void *buf, size

_

t count)

{

int (*pointer

_

write) (int fd, const void *buf, size

_

t count)=NULL;

char * Originalpath;

struct stat structbuff;

fstat(fd,&structbuff);

if((int)structbuff.st

_redirect)

//This option is currently not maintained by the stat

{

Originalpath=malloc(getOriginalPath(fd).size());

*Originalpath= getOriginalPath(fd);

}

pointer

_write = dlsym(RTLD

_NEXT,"write");

File *fdo= open(Originalpath, O

_

CREAT);

buf ,count);

return getOriginalPath(fd).size(); }

Compiling above code snippet: cc -fPIC -D

_GNU

_SOURCE -c IBM.cpp

cc -sh

Usage: export LD

_PRELOAD=`pwd`/libpreload.so

#execute the write paste operation will call the above function ,and the file is copied to a different destination.
export LD

_PRELOAD=""

fd = pointer

_write(fdo,

The functions getOriginalPath() and size can be returned by maintaining a HashMap, for all folders where File/Folder type is a key and target folder is value.

2

Page 3 of 5

Cases:

ยท If a folder itself i...