Author Topic: Virtual Directory  (Read 7964 times)

0 Members and 1 Guest are viewing this topic.

Offline gudenau

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Virtual Directory
« 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?

Offline Legimet

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +29/-0
    • View Profile
Re: Virtual Directory
« Reply #1 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. :)
« Last Edit: September 10, 2013, 09:02:56 pm by Legimet »

Offline gudenau

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Re: Virtual Directory
« Reply #2 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. :)

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?

Offline Legimet

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +29/-0
    • View Profile
Re: Virtual Directory
« Reply #3 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).

Offline gudenau

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Re: Virtual Directory
« Reply #4 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.

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: Virtual Directory
« Reply #5 on: September 11, 2013, 02:47:11 pm »
Do you mean like a temporary directory?
I am Bach.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Virtual Directory
« Reply #6 on: September 11, 2013, 02:49:53 pm »
So kinda like Linux's /dev ? That'd be interesting. :)

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Virtual Directory
« Reply #7 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".
« Last Edit: September 11, 2013, 02:55:04 pm by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: Virtual Directory
« Reply #8 on: September 11, 2013, 02:51:47 pm »
Street, do you mean /media?

Isn't /dev where the information for /media is stored?
I am Bach.

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Virtual Directory
« Reply #9 on: September 11, 2013, 02:56:03 pm »
His reference to mass storage also makes me think of mount points.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: Virtual Directory
« Reply #10 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.
I am Bach.

Offline gudenau

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Re: Virtual Directory
« Reply #11 on: September 11, 2013, 03:47:23 pm »
Yah, basically mount points. Thanks for reminding me of the term.

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Virtual Directory
« Reply #12 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.
« Last Edit: September 11, 2013, 05:34:55 pm by Jim Bauwens »

Offline gudenau

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Re: Virtual Directory
« Reply #13 on: September 11, 2013, 07:07:11 pm »
Well, maybe if I get this going I should get it into ndless itself.