|
|
Subscribe / Log in / New account

The kernel and character set encodings

The kernel and character set encodings

Posted Feb 20, 2004 17:37 UTC (Fri) by Ross (guest, #4065)
In reply to: The kernel and character set encodings by flewellyn
Parent article: The kernel and character set encodings

But you are using C strings to denote the elements which means they are
still NUL terminated. To fix it you need a second array for the path
component lengths. I think you are unlikely to convince any of the kernel
guys this isn't too ugly to live.


to post comments

The kernel and character set encodings

Posted Feb 20, 2004 22:32 UTC (Fri) by spitzak (guest, #4593) [Link]

I agree that a length is needed, not just for encoding NUL, but to allow
a slash-seperated name to be quickly converted to this form, without a
need to malloc and copy a block of memory for each piece.

One possibly less-ugly scheme is to use Plan9's "walk" style. You have
"file descriptors" that represent a filename, unopened as yet. These are
created by copying an
existing one (a small set, such as one for "/", are provided when the
program starts up, like stdin/out). There is then a call something like
walk(fd,char* name,int length) which moves fd to the subdirectory in
name[0..length-1]. When you finally are at the desired file you call
open(fd,mode). Existing open() calls would be turned into a bunch of walk
calls followed by a new open.

With this, no arrays are passed to the kernel, and it does not have to
store these arrays.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds