Is prototyped as:
extern int iofunc_open_default(resmgr_context_t *__ctp, io_open_t *__msg, iofunc_attr_t *__attr, void *__extra);
in <sys/iofunc.h>
I’m wondering if the third argument, the “attr”, should really be prototyped as
the extensible “overridable” attr type? The reasoning is, logically I’m binding
the “entire” extended attribute type to the OCB, not just the “regular” attr structure,
even though it may “appear” that I’m just binding the attr.
Prolly a semantics issue; just wanted to raise it and get it addressed…
Here’s a code snippet to illustrate, using extended attributes structures (see last line):
int
captivefs_io_open (resmgr_context_t *ctp, io_open_t *msg, RESMGR_HANDLE_T *handle, void *extra)
{
char fname [_POSIX_PATH_MAX];
char *p;
int nels, i;
eas_t *attr; // the extended attributes structure
strcpy (fname, msg → connect.path);
p = strtok (fname, “/”);
attr = handle;
while (p != NULL) {
nels = attr → type.dirblock ? attr → type.dirblock → nels : 0;
for (i = 0; i < nels; i++) {
if (!strcmp (attr → type.dirblock → els _-> name, p)) { // found it!
if (!S_ISDIR (attr → attr.mode)) {
return (ENOTDIR); // can’t “cd” into it if it’s not a directory
}
attr = attr → type.dirblock → els → attr; // effectively, “cd” into the directory
break;
}
}
if (i == nels) {
return (ENOENT); // couldn’t find it, so go away.
}
p = strtok (NULL, “/”) ; // get next pathname element
}
return (iofunc_open_default (ctp, msg, attr, extra)); // done, bind this OCB to the extended attributes structure that was found
}
Compiler whines about:
captivefs.c:80: warning: passing arg 3 of `iofunc_open_default’ from incompatible pointer type
Thanks,
-RK
\
Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com._