Omnimaga

Omnimaga => Our Projects => Ndless => Topic started by: gudenau on September 10, 2013, 08:31:05 pm

Title: Virtual Directory
Post by: gudenau on September 10, 2013, 08:31:05 pm
I would like to create a virtual directory in the root of the file explored on the cx, how would I go about doing this in c?
Title: Re: Virtual Directory
Post by: Legimet on September 10, 2013, 08:59:41 pm
To create a directory:
Code: [Select]
mkdir("/dirname", 0755);
Also, welcome to Omnimaga, and be sure to Introduce yourself (http://www.omnimaga.org/index.php?board=10.0). :)
Title: Re: Virtual Directory
Post by: gudenau on September 10, 2013, 09:30:25 pm
To create a directory:
Code: [Select]
mkdir("/dirname", 0755);
Also, welcome to Omnimaga, and be sure to Introduce yourself (http://www.omnimaga.org/index.php?board=10.0). :)

Could I then tell the os that there are files there when there are not, then have it do stuff when I/O is preformed on them?
Title: Re: Virtual Directory
Post by: Legimet on September 10, 2013, 09:39:12 pm
I don't understand, what exactly do you mean by "virtual directory"?
The code I gave simply creates a regular directory in the root of the filesystem (which cannot be seen from the document browser).
Title: Re: Virtual Directory
Post by: gudenau on September 11, 2013, 01:52:03 pm
I don't understand, what exactly do you mean by "virtual directory"?
The code I gave simply creates a regular directory in the root of the filesystem (which cannot be seen from the document browser).

What I want is to have a directory at the root of the file system that is not there, the os just thinks it is there and can use it as if it where not there, so when it reads and writes to that location a program on the calculator can then interpret it and do things based on the io that is being preformed. In the end I hope to have removable storage, as I have yet to see this on the nspire.
Title: Re: Virtual Directory
Post by: pimathbrainiac on September 11, 2013, 02:47:11 pm
Do you mean like a temporary directory?
Title: Re: Virtual Directory
Post by: Streetwalrus on September 11, 2013, 02:49:53 pm
So kinda like Linux's /dev ? That'd be interesting. :)
Title: Re: Virtual Directory
Post by: Lionel Debroux on September 11, 2013, 02:50:48 pm
Rather a filesystem in userspace, or something along those lines, judging by "a program on the calculator can then interpret it and do things based on the io that is being preformed".
Title: Re: Virtual Directory
Post by: pimathbrainiac on September 11, 2013, 02:51:47 pm
Street, do you mean /media?

Isn't /dev where the information for /media is stored?
Title: Re: Virtual Directory
Post by: Lionel Debroux on September 11, 2013, 02:56:03 pm
His reference to mass storage also makes me think of mount points.
Title: Re: Virtual Directory
Post by: pimathbrainiac on September 11, 2013, 02:57:40 pm
So maybe trying to use external storage or another Nspire for storage? Sound interesting... I'll look and see how it's done (code wise) in linux.
Title: Re: Virtual Directory
Post by: gudenau on September 11, 2013, 03:47:23 pm
Yah, basically mount points. Thanks for reminding me of the term.
Title: Re: Virtual Directory
Post by: Jim Bauwens on September 11, 2013, 05:23:30 pm
Because the TI-Nspire OS is bases on the Nucleus RTOS, you should look if you can find some info regarding filesystem implementations on Nucleus. According to Wikipedia, it has a "Virtual file system Application programming interface", which is just what you need I think.

Edit: AFAICT, the Datalight Reliance filesystem that is being used on the TI-Nspire uses this API. So in theory you might be able to reverse engineer how this API works out of the OS. But I think I don't need to say that that's going to be a hard and complex task.

AFAIK, at the moment there is no easy way to do what you want. Maybe it would even be easier to patch the functions that are used to open files.
Title: Re: Virtual Directory
Post by: gudenau on September 11, 2013, 07:07:11 pm
Well, maybe if I get this going I should get it into ndless itself.