justincormack / ljsyscall

LuaJIT Unix syscall FFI
http://www.myriabit.com/ljsyscall/
Other
440 stars 54 forks source link

syscall.lfs improvement #216

Open tst2005 opened 6 years ago

tst2005 commented 6 years ago

Hello

I compared the syscall.lfs to lua file-system (lfs). Even there are not far to be equivalent I found some differences. Some of them should be emulated or fixed.

I found one I'm not able to fix : about the device information returned by lfs.attributes.

I need it to make a find like that are able to stay on the same file system.

print( require"syscall.lfs".attributes(".","dev") )

I got a cdata (cdata<struct 1222>: 0x40e43248).

Any help is welcome!

Regards

justincormack commented 6 years ago

Oh, currently dev returns a type that has major, minor and dev, so print(lfs.attributes(".", "dev").dev) will work. Thats not correct for compatibility...

tst2005 commented 6 years ago

Oh thanks! Now I will be able to make some compat stuff...

justincormack commented 6 years ago

I think this should be fixed to be compatible..

tst2005 commented 6 years ago

Hello, I made my possible to follow the luafilesystem behavior/API :

  1. about lfs.attributes and lfs.symlinkattributes : see https://github.com/justincormack/ljsyscall/pull/227 to have a number value in dev and rdev field and also support the table argument.
  2. fix the case when lfs.dir raise an error : see https://github.com/justincormack/ljsyscall/pull/228

Note: the 2nd PR is made on the base of the first one, I don't know if it the best way to do...