[Libsysio-commit] cplant: libsysio/src namei.c
Brought to you by:
lward
From: Ruth K. <rk...@us...> - 2003-06-27 18:31:18
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv27841 Modified Files: Tag: cplant namei.c Log Message: add function to provide backwards compatibility for path prefix on cplant Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -u -w -b -B -p -r1.5.2.1 -r1.5.2.2 --- namei.c 12 Jun 2003 23:48:48 -0000 1.5.2.1 +++ namei.c 27 Jun 2003 18:11:04 -0000 1.5.2.2 @@ -434,6 +434,33 @@ _sysio_path_walk(struct pnode *parent, s return err; } +#ifdef CPLANT_YOD +static const char * +strip_prefix(const char *path) +{ + + /* + * for backward compatibility w/protocol switch + * remove 'prefix:' iff first ':' immediately + * precedes first '/' + */ + + char *colon, *slash; + + colon = strchr(path, ':'); + slash = strchr(path, '/'); + + if (slash == colon + 1) + return(slash); + else + return(path); + +} +#define STRIP_PREFIX(p) strip_prefix(p) +#else +#define STRIP_PREFIX(p) p +#endif + /* * Expanded form of the path-walk routine, with the common arguments, builds * the nameidata bundle and calls path-walk. @@ -448,7 +475,7 @@ _sysio_namei(struct pnode *parent, struct nameidata nameidata; int err; - ND_INIT(&nameidata, flags, path, _sysio_root, intnt); + ND_INIT(&nameidata, flags, STRIP_PREFIX(path), _sysio_root, intnt); err = _sysio_path_walk(parent, &nameidata); if (!err) *pnop = nameidata.nd_pno; |